Relocate projects to spring-boot-project
Move projects to better reflect the way that Spring Boot is released. The following projects are under `spring-boot-project`: - `spring-boot` - `spring-boot-autoconfigure` - `spring-boot-tools` - `spring-boot-starters` - `spring-boot-actuator` - `spring-boot-actuator-autoconfigure` - `spring-boot-test` - `spring-boot-test-autoconfigure` - `spring-boot-devtools` - `spring-boot-cli` - `spring-boot-docs` See gh-9316
2
spring-boot-project/spring-boot-docs/src/main/asciidoc/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*.html
|
||||
*.css
|
||||
@@ -0,0 +1,20 @@
|
||||
require 'asciidoctor'
|
||||
require 'erb'
|
||||
|
||||
guard 'shell' do
|
||||
watch(/.*\.adoc$/) {|m|
|
||||
Asciidoctor.render_file('index.adoc', \
|
||||
:in_place => true, \
|
||||
:safe => Asciidoctor::SafeMode::UNSAFE, \
|
||||
:attributes=> { \
|
||||
'source-highlighter' => 'prettify', \
|
||||
'icons' => 'font', \
|
||||
'linkcss'=> 'true', \
|
||||
'copycss' => 'true', \
|
||||
'doctype' => 'book'})
|
||||
}
|
||||
end
|
||||
|
||||
guard 'livereload' do
|
||||
watch(%r{^.+\.(css|js|html)$})
|
||||
end
|
||||
@@ -0,0 +1,24 @@
|
||||
[appendix]
|
||||
[[auto-configuration-classes]]
|
||||
== Auto-configuration classes
|
||||
Here is a list of all auto-configuration classes provided by Spring Boot with links to
|
||||
documentation and source code. Remember to also look at the autoconfig report in your
|
||||
application for more details of which features are switched on.
|
||||
(start the app with `--debug` or `-Ddebug`, or in an Actuator application use the
|
||||
`autoconfig` endpoint).
|
||||
|
||||
|
||||
|
||||
[[auto-configuration-classes-from-autoconfigure-module]]
|
||||
=== From the "`spring-boot-autoconfigure`" module
|
||||
The following auto-configuration classes are from the `spring-boot-autoconfigure` module:
|
||||
|
||||
include::../../../target/generated-resources/auto-configuration-classes-spring-boot-autoconfigure.adoc[]
|
||||
|
||||
|
||||
|
||||
[[auto-configuration-classes-from-actuator]]
|
||||
=== From the "`spring-boot-actuator-autoconfigure`" module
|
||||
The following auto-configuration classes are from the `spring-boot-actuator-autoconfigure` module:
|
||||
|
||||
include::../../../target/generated-resources/auto-configuration-classes-spring-boot-actuator-autoconfigure.adoc[]
|
||||
@@ -0,0 +1,838 @@
|
||||
[appendix]
|
||||
[[configuration-metadata]]
|
||||
== Configuration meta-data
|
||||
Spring Boot jars are shipped with meta-data files that provide details of all supported
|
||||
configuration properties. The files are designed to allow IDE developers to offer
|
||||
contextual help and "`code completion`" as users are working with `application.properties`
|
||||
or `application.yml` files.
|
||||
|
||||
The majority of the meta-data file is generated automatically at compile time by
|
||||
processing all items annotated with `@ConfigurationProperties`. However, it is possible
|
||||
to <<configuration-metadata-additional-metadata,write part of the meta-data manually>>
|
||||
for corner cases or more advanced use cases.
|
||||
|
||||
|
||||
|
||||
[[configuration-metadata-format]]
|
||||
=== Meta-data format
|
||||
Configuration meta-data files are located inside jars under
|
||||
`META-INF/spring-configuration-metadata.json` They use a simple JSON format with items
|
||||
categorized under either "`groups`" or "`properties`" and additional values hint
|
||||
categorized under "hints":
|
||||
|
||||
[source,json,indent=0]
|
||||
----
|
||||
{"groups": [
|
||||
{
|
||||
"name": "server",
|
||||
"type": "org.springframework.boot.autoconfigure.web.ServerProperties",
|
||||
"sourceType": "org.springframework.boot.autoconfigure.web.ServerProperties"
|
||||
},
|
||||
{
|
||||
"name": "spring.jpa.hibernate",
|
||||
"type": "org.springframework.boot.autoconfigure.orm.jpa.JpaProperties$Hibernate",
|
||||
"sourceType": "org.springframework.boot.autoconfigure.orm.jpa.JpaProperties",
|
||||
"sourceMethod": "getHibernate()"
|
||||
}
|
||||
...
|
||||
],"properties": [
|
||||
{
|
||||
"name": "server.port",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "org.springframework.boot.autoconfigure.web.ServerProperties"
|
||||
},
|
||||
{
|
||||
"name": "server.servlet.path",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "org.springframework.boot.autoconfigure.web.ServerProperties",
|
||||
"defaultValue": "/"
|
||||
},
|
||||
{
|
||||
"name": "spring.jpa.hibernate.ddl-auto",
|
||||
"type": "java.lang.String",
|
||||
"description": "DDL mode. This is actually a shortcut for the \"hibernate.hbm2ddl.auto\" property.",
|
||||
"sourceType": "org.springframework.boot.autoconfigure.orm.jpa.JpaProperties$Hibernate"
|
||||
}
|
||||
...
|
||||
],"hints": [
|
||||
{
|
||||
"name": "spring.jpa.hibernate.ddl-auto",
|
||||
"values": [
|
||||
{
|
||||
"value": "none",
|
||||
"description": "Disable DDL handling."
|
||||
},
|
||||
{
|
||||
"value": "validate",
|
||||
"description": "Validate the schema, make no changes to the database."
|
||||
},
|
||||
{
|
||||
"value": "update",
|
||||
"description": "Update the schema if necessary."
|
||||
},
|
||||
{
|
||||
"value": "create",
|
||||
"description": "Create the schema and destroy previous data."
|
||||
},
|
||||
{
|
||||
"value": "create-drop",
|
||||
"description": "Create and then destroy the schema at the end of the session."
|
||||
}
|
||||
]
|
||||
}
|
||||
]}
|
||||
----
|
||||
|
||||
Each "`property`" is a configuration item that the user specifies with a given value.
|
||||
For example `server.port` and `server.servlet.path` might be specified in
|
||||
`application.properties` as follows:
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
server.port=9090
|
||||
server.servlet.path=/home
|
||||
----
|
||||
|
||||
The "`groups`" are higher level items that don't themselves specify a value, but instead
|
||||
provide a contextual grouping for properties. For example the `server.port` and
|
||||
`server.servlet.path` properties are part of the `server` group.
|
||||
|
||||
NOTE: It is not required that every "`property`" has a "`group`", some properties might
|
||||
just exist in their own right.
|
||||
|
||||
Finally, "`hints`" are additional information used to assist the user in configuring a
|
||||
given property. When configuring the `spring.jpa.hibernate.ddl-auto` property, a tool can
|
||||
use it to offer some auto-completion help for the `none`, `validate`, `update`, `create`
|
||||
and `create-drop` values.
|
||||
|
||||
|
||||
|
||||
[[configuration-metadata-group-attributes]]
|
||||
==== Group Attributes
|
||||
The JSON object contained in the `groups` array can contain the following attributes:
|
||||
|
||||
[cols="1,1,4"]
|
||||
|===
|
||||
|Name | Type |Purpose
|
||||
|
||||
|`name`
|
||||
| String
|
||||
| The full name of the group. This attribute is mandatory.
|
||||
|
||||
|`type`
|
||||
| String
|
||||
| The class name of the data type of the group. For example, if the group was based
|
||||
on a class annotated with `@ConfigurationProperties` the attribute would contain the
|
||||
fully qualified name of that class. If it was based on a `@Bean` method, it would be
|
||||
the return type of that method. The attribute may be omitted if the type is not known.
|
||||
|
||||
|`description`
|
||||
| String
|
||||
| A short description of the group that can be displayed to users. May be omitted if no
|
||||
description is available. It is recommended that descriptions are a short paragraphs,
|
||||
with the first line providing a concise summary. The last line in the description should
|
||||
end with a period (`.`).
|
||||
|
||||
|`sourceType`
|
||||
| String
|
||||
| The class name of the source that contributed this group. For example, if the group
|
||||
was based on a `@Bean` method annotated with `@ConfigurationProperties` this attribute
|
||||
would contain the fully qualified name of the `@Configuration` class containing the
|
||||
method. The attribute may be omitted if the source type is not known.
|
||||
|
||||
|`sourceMethod`
|
||||
| String
|
||||
| The full name of the method (include parenthesis and argument types) that contributed
|
||||
this group. For example, the name of a `@ConfigurationProperties` annotated `@Bean`
|
||||
method. May be omitted if the source method is not known.
|
||||
|===
|
||||
|
||||
|
||||
|
||||
[[configuration-metadata-property-attributes]]
|
||||
==== Property Attributes
|
||||
The JSON object contained in the `properties` array can contain the following attributes:
|
||||
|
||||
[cols="1,1,4"]
|
||||
|===
|
||||
|Name | Type |Purpose
|
||||
|
||||
|`name`
|
||||
| String
|
||||
| The full name of the property. Names are in lowercase dashed form (e.g.
|
||||
`server.servlet.path`). This attribute is mandatory.
|
||||
|
||||
|`type`
|
||||
| String
|
||||
| The full signature of the data type of the property. For example, `java.lang.String`
|
||||
but also a full generic type such as `java.util.Map<java.util.String,acme.MyEnum>`.
|
||||
This attribute can be used to guide the user as to the types of values that they can
|
||||
enter. For consistency, the type of a primitive is specified using its wrapper
|
||||
counterpart, i.e. `boolean` becomes `java.lang.Boolean`. Note that this class may be
|
||||
a complex type that gets converted from a String as values are bound. May be omitted
|
||||
if the type is not known.
|
||||
|
||||
|`description`
|
||||
| String
|
||||
| A short description of the group that can be displayed to users. May be omitted if no
|
||||
description is available. It is recommended that descriptions are a short paragraphs,
|
||||
with the first line providing a concise summary. The last line in the description should
|
||||
end with a period (`.`).
|
||||
|
||||
|`sourceType`
|
||||
| String
|
||||
| The class name of the source that contributed this property. For example, if the
|
||||
property was from a class annotated with `@ConfigurationProperties` this attribute
|
||||
would contain the fully qualified name of that class. May be omitted if the source type
|
||||
is not known.
|
||||
|
||||
|`defaultValue`
|
||||
| Object
|
||||
| The default value which will be used if the property is not specified. Can also be an
|
||||
array of value(s) if the type of the property is an array. May be omitted if the default
|
||||
value is not known.
|
||||
|
||||
|`deprecation`
|
||||
| Deprecation
|
||||
| Specify if the property is deprecated. May be omitted if the field is not deprecated
|
||||
or if that information is not known. See below for more details.
|
||||
|===
|
||||
|
||||
The JSON object contained in the `deprecation` attribute of each `properties` element can
|
||||
contain the following attributes:
|
||||
|
||||
[cols="1,1,4"]
|
||||
|===
|
||||
|Name | Type |Purpose
|
||||
|
||||
|`level`
|
||||
|String
|
||||
|The level of deprecation, can be either `warning` (default) or `error`. When a property
|
||||
has a `warning` deprecation level it should still be bound in the environment. When it
|
||||
has an `error` deprecation level however, the property is no longer managed and will not
|
||||
be bound.
|
||||
|
||||
|`reason`
|
||||
|String
|
||||
|A short description of the reason why the property was deprecated. May be omitted if no
|
||||
reason is available. It is recommended that descriptions are a short paragraphs,
|
||||
with the first line providing a concise summary. The last line in the description should
|
||||
end with a period (`.`).
|
||||
|
||||
|`replacement`
|
||||
|String
|
||||
|The full name of the property that is _replacing_ this deprecated property. May be omitted
|
||||
if there is no replacement for this property.
|
||||
|===
|
||||
|
||||
NOTE: Prior to Spring Boot 1.3, a single `deprecated` boolean attribute can be used
|
||||
instead of the `deprecation` element. This is still supported in a deprecated fashion and
|
||||
should no longer be used. If no reason and replacement are available, an empty
|
||||
`deprecation` object should be set.
|
||||
|
||||
Deprecation can also be specified declaratively in code by adding the
|
||||
`@DeprecatedConfigurationProperty` annotation to the getter exposing the deprecated
|
||||
property. For instance, let's assume the `app.foo.target` property was confusing and
|
||||
was renamed to `app.foo.name`
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@ConfigurationProperties("app.foo")
|
||||
public class FooProperties {
|
||||
|
||||
private String name;
|
||||
|
||||
public String getName() { ... }
|
||||
|
||||
public void setName(String name) { ... }
|
||||
|
||||
@DeprecatedConfigurationProperty(replacement = "app.foo.name")
|
||||
@Deprecated
|
||||
public String getTarget() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setTarget(String target) {
|
||||
setName(target);
|
||||
}
|
||||
}
|
||||
----
|
||||
|
||||
NOTE: There is no way to set a `level` as `warning` is always assumed since code is still
|
||||
handling the property.
|
||||
|
||||
The code above makes sure that the deprecated property still works (delegating
|
||||
to the `name` property behind the scenes). Once the `getTarget` and `setTarget`
|
||||
methods can be removed from your public API, the automatic deprecation hint in the
|
||||
meta-data will go away as well. If you want to keep a hint, adding manual meta-data with
|
||||
an `error` deprecation level ensures that users are still informed about that property and
|
||||
is particularly useful when a `replacement` is provided.
|
||||
|
||||
|
||||
|
||||
[[configuration-metadata-hints-attributes]]
|
||||
==== Hint Attributes
|
||||
The JSON object contained in the `hints` array can contain the following attributes:
|
||||
|
||||
[cols="1,1,4"]
|
||||
|===
|
||||
|Name | Type |Purpose
|
||||
|
||||
|`name`
|
||||
| String
|
||||
| The full name of the property that this hint refers to. Names are in lowercase dashed
|
||||
form (e.g. `server.servlet.path`). If the property refers to a map (e.g.
|
||||
`system.contexts`) the hint either applies to the _keys_ of the map (`system.context.keys`)
|
||||
or the values (`system.context.values`). This attribute is mandatory.
|
||||
|
||||
|`values`
|
||||
| ValueHint[]
|
||||
| A list of valid values as defined by the `ValueHint` object (see below). Each entry defines
|
||||
the value and may have a description
|
||||
|
||||
|`providers`
|
||||
| ValueProvider[]
|
||||
| A list of providers as defined by the `ValueProvider` object (see below). Each entry defines
|
||||
the name of the provider and its parameters, if any.
|
||||
|
||||
|===
|
||||
|
||||
The JSON object contained in the `values` attribute of each `hint` element can contain the
|
||||
following attributes:
|
||||
|
||||
[cols="1,1,4"]
|
||||
|===
|
||||
|Name | Type |Purpose
|
||||
|
||||
|`value`
|
||||
| Object
|
||||
| A valid value for the element to which the hint refers to. Can also be an array of value(s)
|
||||
if the type of the property is an array. This attribute is mandatory.
|
||||
|
||||
|`description`
|
||||
| String
|
||||
| A short description of the value that can be displayed to users. May be omitted if no
|
||||
description is available. It is recommended that descriptions are a short paragraphs,
|
||||
with the first line providing a concise summary. The last line in the description should
|
||||
end with a period (`.`).
|
||||
|===
|
||||
|
||||
The JSON object contained in the `providers` attribute of each `hint` element can contain the
|
||||
following attributes:
|
||||
|
||||
[cols="1,1,4"]
|
||||
|===
|
||||
|Name | Type |Purpose
|
||||
|
||||
|`name`
|
||||
| String
|
||||
| The name of the provider to use to offer additional content assistance for the element
|
||||
to which the hint refers to.
|
||||
|
||||
|`parameters`
|
||||
| JSON object
|
||||
| Any additional parameter that the provider supports (check the documentation of the
|
||||
provider for more details).
|
||||
|===
|
||||
|
||||
|
||||
|
||||
[[configuration-metadata-repeated-items]]
|
||||
==== Repeated meta-data items
|
||||
It is perfectly acceptable for "`property`" and "`group`" objects with the same name to
|
||||
appear multiple times within a meta-data file. For example, you could bind two separate
|
||||
classes to the same prefix, with each potentially offering overlap of property names.
|
||||
While this is not supposed to be a frequent scenario, consumers of meta-data should take
|
||||
care to ensure that they support such scenarios.
|
||||
|
||||
|
||||
|
||||
[[configuration-metadata-providing-manual-hints]]
|
||||
=== Providing manual hints
|
||||
To improve the user experience and further assist the user in configuring a given
|
||||
property, you can provide additional meta-data that:
|
||||
|
||||
1. Describes the list of potential values for a property.
|
||||
2. Associates a provider to attach a well-defined semantic to a property so that a tool
|
||||
can discover the list of potential values based on the project's context.
|
||||
|
||||
|
||||
==== Value hint
|
||||
The `name` attribute of each hint refers to the `name` of a property. In the initial
|
||||
example above, we provide 5 values for the `spring.jpa.hibernate.ddl-auto` property:
|
||||
`none`, `validate`, `update`, `create` and `create-drop`. Each value may have a
|
||||
description as well.
|
||||
|
||||
If your property is of type `Map`, you can provide hints for both the keys and the
|
||||
values (but not for the map itself). The special `.keys` and `.values` suffixes must
|
||||
be used to refer to the keys and the values respectively.
|
||||
|
||||
Let's assume a `foo.contexts` that maps magic String values to an integer:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@ConfigurationProperties("foo")
|
||||
public class FooProperties {
|
||||
|
||||
private Map<String,Integer> contexts;
|
||||
// getters and setters
|
||||
}
|
||||
----
|
||||
|
||||
The magic values are foo and bar for instance. In order to offer additional content
|
||||
assistance for the keys, you could add the following to
|
||||
<<configuration-metadata-additional-metadata,the manual meta-data of the module>>:
|
||||
|
||||
[source,json,indent=0]
|
||||
----
|
||||
{"hints": [
|
||||
{
|
||||
"name": "foo.contexts.keys",
|
||||
"values": [
|
||||
{
|
||||
"value": "foo"
|
||||
},
|
||||
{
|
||||
"value": "bar"
|
||||
}
|
||||
]
|
||||
}
|
||||
]}
|
||||
----
|
||||
|
||||
NOTE: Of course, you should have an `Enum` for those two values instead. This is by far
|
||||
the most effective approach to auto-completion if your IDE supports it.
|
||||
|
||||
|
||||
|
||||
==== Value provider
|
||||
Providers are a powerful way of attaching semantics to a property. We define in the section
|
||||
below the official providers that you can use for your own hints. Bare in mind however that
|
||||
your favorite IDE may implement some of these or none of them. It could eventually provide
|
||||
its own as well.
|
||||
|
||||
NOTE: As this is a new feature, IDE vendors will have to catch up with this new feature.
|
||||
|
||||
The table below summarizes the list of supported providers:
|
||||
|
||||
[cols="2,4"]
|
||||
|===
|
||||
|Name | Description
|
||||
|
||||
|`any`
|
||||
|Permit any additional value to be provided.
|
||||
|
||||
|`class-reference`
|
||||
|Auto-complete the classes available in the project. Usually constrained by a base
|
||||
class that is specified via the `target` parameter.
|
||||
|
||||
|`handle-as`
|
||||
|Handle the property as if it was defined by the type defined via the mandatory `target` parameter.
|
||||
|
||||
|`logger-name`
|
||||
|Auto-complete valid logger names. Typically, package and class names available in
|
||||
the current project can be auto-completed.
|
||||
|
||||
|`spring-bean-reference`
|
||||
|Auto-complete the available bean names in the current project. Usually constrained
|
||||
by a base class that is specified via the `target` parameter.
|
||||
|
||||
|`spring-profile-name`
|
||||
|Auto-complete the available Spring profile names in the project.
|
||||
|
||||
|===
|
||||
|
||||
TIP: No more than one provider can be active for a given property but you can specify
|
||||
several providers if they can all manage the property _in some ways_. Make sure to place
|
||||
the most powerful provider first as the IDE must use the first one in the JSON section it
|
||||
can handle. If no provider for a given property is supported, no special content
|
||||
assistance is provided either.
|
||||
|
||||
|
||||
|
||||
===== Any
|
||||
The **any** provider permits any additional values to be provided. Regular value
|
||||
validation based on the property type should be applied if this is supported.
|
||||
|
||||
This provider will be typically used if you have a list of values and any extra values
|
||||
are still to be considered as valid.
|
||||
|
||||
The example below offers `on` and `off` as auto-completion values for `system.state`; any
|
||||
other value is also allowed:
|
||||
|
||||
[source,json,indent=0]
|
||||
----
|
||||
{"hints": [
|
||||
{
|
||||
"name": "system.state",
|
||||
"values": [
|
||||
{
|
||||
"value": "on"
|
||||
},
|
||||
{
|
||||
"value": "off"
|
||||
}
|
||||
],
|
||||
"providers": [
|
||||
{
|
||||
"name": "any"
|
||||
}
|
||||
]
|
||||
}
|
||||
]}
|
||||
----
|
||||
|
||||
|
||||
|
||||
===== Class reference
|
||||
The **class-reference** provider auto-completes classes available in the project. This
|
||||
provider supports these parameters:
|
||||
|
||||
[cols="1,1,2,4"]
|
||||
|===
|
||||
|Parameter |Type |Default value |Description
|
||||
|
||||
|`target`
|
||||
|`String` (`Class`)
|
||||
|_none_
|
||||
|The fully qualified name of the class that should be assignable to the chosen value.
|
||||
Typically used to filter out non candidate classes. Note that this information can
|
||||
be provided by the type itself by exposing a class with the appropriate upper bound.
|
||||
|
||||
|`concrete`
|
||||
|`boolean`
|
||||
|true
|
||||
|Specify if only concrete classes are to be considered as valid candidates.
|
||||
|===
|
||||
|
||||
|
||||
The meta-data snippet below corresponds to the standard `server.servlet.jsp.class-name`
|
||||
property that defines the `JspServlet` class name to use:
|
||||
|
||||
[source,json,indent=0]
|
||||
----
|
||||
{"hints": [
|
||||
{
|
||||
"name": "server.servlet.jsp.class-name",
|
||||
"providers": [
|
||||
{
|
||||
"name": "class-reference",
|
||||
"parameters": {
|
||||
"target": "javax.servlet.http.HttpServlet"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]}
|
||||
----
|
||||
|
||||
|
||||
|
||||
===== Handle As
|
||||
The **handle-as** provider allows you to substitute the type of the property to a more
|
||||
high-level type. This typically happens when the property has a `java.lang.String` type
|
||||
because you don't want your configuration classes to rely on classes that may not be
|
||||
on the classpath. This provider supports these parameters:
|
||||
|
||||
[cols="1,1,2,4"]
|
||||
|===
|
||||
|Parameter |Type |Default value |Description
|
||||
|
||||
| **`target`**
|
||||
| `String` (`Class`)
|
||||
|_none_
|
||||
|The fully qualified name of the type to consider for the property. This parameter is mandatory.
|
||||
|===
|
||||
|
||||
The following types can be used:
|
||||
|
||||
* Any `java.lang.Enum` that lists the possible values for the property (By all means, try to
|
||||
define the property with the `Enum` type instead as no further hint should be required for
|
||||
the IDE to auto-complete the values).
|
||||
* `java.nio.charset.Charset`: auto-completion of charset/encoding values (e.g. `UTF-8`)
|
||||
* `java.util.Locale`: auto-completion of locales (e.g. `en_US`)
|
||||
* `org.springframework.util.MimeType`: auto-completion of content type values (e.g. `text/plain`)
|
||||
* `org.springframework.core.io.Resource`: auto-completion of Spring’s Resource abstraction to
|
||||
refer to a file on the filesystem or on the classpath. (e.g. `classpath:/foo.properties`)
|
||||
|
||||
NOTE: If multiple values can be provided, use a `Collection` or _Array_ type to teach the IDE
|
||||
about it.
|
||||
|
||||
The meta-data snippet below corresponds to the standard `spring.liquibase.change-log`
|
||||
property that defines the path to the changelog to use. It is actually used internally as a
|
||||
`org.springframework.core.io.Resource` but cannot be exposed as such as we need to keep the
|
||||
original String value to pass it to the Liquibase API.
|
||||
|
||||
[source,json,indent=0]
|
||||
----
|
||||
{"hints": [
|
||||
{
|
||||
"name": "spring.liquibase.change-log",
|
||||
"providers": [
|
||||
{
|
||||
"name": "handle-as",
|
||||
"parameters": {
|
||||
"target": "org.springframework.core.io.Resource"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]}
|
||||
----
|
||||
|
||||
|
||||
|
||||
===== Logger name
|
||||
The **logger-name** provider auto-completes valid logger names. Typically, package and
|
||||
class names available in the current project can be auto-completed. Specific frameworks
|
||||
may have extra magic logger names that could be supported as well.
|
||||
|
||||
Since a logger name can be any arbitrary name, really, this provider should allow any
|
||||
value but could highlight valid packages and class names that are not available in the
|
||||
project's classpath.
|
||||
|
||||
The meta-data snippet below corresponds to the standard `logging.level` property, keys
|
||||
are _logger names_ and values correspond to the standard log levels or any custom
|
||||
level:
|
||||
|
||||
[source,json,indent=0]
|
||||
----
|
||||
{"hints": [
|
||||
{
|
||||
"name": "logging.level.keys",
|
||||
"values": [
|
||||
{
|
||||
"value": "root",
|
||||
"description": "Root logger used to assign the default logging level."
|
||||
}
|
||||
],
|
||||
"providers": [
|
||||
{
|
||||
"name": "logger-name"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "logging.level.values",
|
||||
"values": [
|
||||
{
|
||||
"value": "trace"
|
||||
},
|
||||
{
|
||||
"value": "debug"
|
||||
},
|
||||
{
|
||||
"value": "info"
|
||||
},
|
||||
{
|
||||
"value": "warn"
|
||||
},
|
||||
{
|
||||
"value": "error"
|
||||
},
|
||||
{
|
||||
"value": "fatal"
|
||||
},
|
||||
{
|
||||
"value": "off"
|
||||
}
|
||||
|
||||
],
|
||||
"providers": [
|
||||
{
|
||||
"name": "any"
|
||||
}
|
||||
]
|
||||
}
|
||||
]}
|
||||
----
|
||||
|
||||
|
||||
|
||||
===== Spring bean reference
|
||||
The **spring-bean-reference** provider auto-completes the beans that are defined in
|
||||
the configuration of the current project. This provider supports these parameters:
|
||||
|
||||
[cols="1,1,2,4"]
|
||||
|===
|
||||
|Parameter |Type |Default value |Description
|
||||
|
||||
|`target`
|
||||
| `String` (`Class`)
|
||||
|_none_
|
||||
|The fully qualified name of the bean class that should be assignable to the candidate.
|
||||
Typically used to filter out non candidate beans.
|
||||
|===
|
||||
|
||||
The meta-data snippet below corresponds to the standard `spring.jmx.server` property
|
||||
that defines the name of the `MBeanServer` bean to use:
|
||||
|
||||
[source,json,indent=0]
|
||||
----
|
||||
{"hints": [
|
||||
{
|
||||
"name": "spring.jmx.server",
|
||||
"providers": [
|
||||
{
|
||||
"name": "spring-bean-reference",
|
||||
"parameters": {
|
||||
"target": "javax.management.MBeanServer"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]}
|
||||
----
|
||||
|
||||
NOTE: The binder is not aware of the meta-data so if you provide that hint, you
|
||||
will still need to transform the bean name into an actual Bean reference using
|
||||
the `ApplicationContext`.
|
||||
|
||||
|
||||
|
||||
===== Spring profile name
|
||||
The **spring-profile-name** provider auto-completes the Spring profiles that are
|
||||
defined in the configuration of the current project.
|
||||
|
||||
The meta-data snippet below corresponds to the standard `spring.profiles.active`
|
||||
property that defines the name of the Spring profile(s) to enable:
|
||||
|
||||
[source,json,indent=0]
|
||||
----
|
||||
{"hints": [
|
||||
{
|
||||
"name": "spring.profiles.active",
|
||||
"providers": [
|
||||
{
|
||||
"name": "spring-profile-name"
|
||||
}
|
||||
]
|
||||
}
|
||||
]}
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[configuration-metadata-annotation-processor]]
|
||||
=== Generating your own meta-data using the annotation processor
|
||||
You can easily generate your own configuration meta-data file from items annotated with
|
||||
`@ConfigurationProperties` by using the `spring-boot-configuration-processor` jar.
|
||||
The jar includes a Java annotation processor which is invoked as your project is
|
||||
compiled. To use the processor, simply include `spring-boot-configuration-processor` as
|
||||
an optional dependency, for example with Maven you would add:
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
----
|
||||
|
||||
With Gradle, you can use the https://github.com/spring-gradle-plugins/propdeps-plugin[propdeps-plugin]
|
||||
and specify:
|
||||
|
||||
[source,groovy,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
dependencies {
|
||||
optional "org.springframework.boot:spring-boot-configuration-processor"
|
||||
}
|
||||
|
||||
compileJava.dependsOn(processResources)
|
||||
----
|
||||
|
||||
NOTE: You need to add `compileJava.dependsOn(processResources)` to your build to ensure
|
||||
that resources are processed before code is compiled. Without this directive any
|
||||
`additional-spring-configuration-metadata.json` files will not be processed.
|
||||
|
||||
The processor will pick up both classes and methods that are annotated with
|
||||
`@ConfigurationProperties`. The Javadoc for field values within configuration classes
|
||||
will be used to populate the `description` attribute.
|
||||
|
||||
NOTE: You should only use simple text with `@ConfigurationProperties` field Javadoc since
|
||||
they are not processed before being added to the JSON.
|
||||
|
||||
Properties are discovered via the presence of standard getters and setters with special
|
||||
handling for collection types (that will be detected even if only a getter is present). The
|
||||
annotation processor also supports the use of the `@Data`, `@Getter` and `@Setter` lombok
|
||||
annotations.
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
If you are using AspectJ in your project, you need to make sure that the annotation
|
||||
processor only runs once. There are several ways to do this: with Maven, you can
|
||||
configure the `maven-apt-plugin` explicitly and add the dependency to the annotation
|
||||
processor only there. You could also let the AspectJ plugin run all the processing
|
||||
and disable annotation processing in the `maven-compiler-plugin` configuration:
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<proc>none</proc>
|
||||
</configuration>
|
||||
</plugin>
|
||||
----
|
||||
====
|
||||
|
||||
|
||||
|
||||
[[configuration-metadata-nested-properties]]
|
||||
==== Nested properties
|
||||
The annotation processor will automatically consider inner classes as nested properties.
|
||||
For example, the following class:
|
||||
|
||||
[source,java,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
@ConfigurationProperties(prefix="server")
|
||||
public class ServerProperties {
|
||||
|
||||
private String name;
|
||||
|
||||
private Host host;
|
||||
|
||||
// ... getter and setters
|
||||
|
||||
private static class Host {
|
||||
|
||||
private String ip;
|
||||
|
||||
private int port;
|
||||
|
||||
// ... getter and setters
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
----
|
||||
|
||||
Will produce meta-data information for `server.name`, `server.host.ip` and
|
||||
`server.host.port` properties. You can use the `@NestedConfigurationProperty`
|
||||
annotation on a field to indicate that a regular (non-inner) class should be treated as
|
||||
if it were nested.
|
||||
|
||||
TIP: This has no effect on collections and maps as those types are automatically
|
||||
identified and a single meta-data property is generated for each of them.
|
||||
|
||||
|
||||
[[configuration-metadata-additional-metadata]]
|
||||
==== Adding additional meta-data
|
||||
Spring Boot's configuration file handling is quite flexible; and it is often the case
|
||||
that properties may exist that are not bound to a `@ConfigurationProperties` bean. You
|
||||
may also need to tune some attributes of an existing key. To support such cases and allow
|
||||
you to provide custom "hints", the annotation processor will automatically merge items
|
||||
from `META-INF/additional-spring-configuration-metadata.json` into the main meta-data
|
||||
file.
|
||||
|
||||
If you refer to a property that has been detected automatically, the description,
|
||||
default value and deprecation information are overridden if specified. If the manual
|
||||
property declaration is not identified in the current module, it is added as a brand new
|
||||
property.
|
||||
|
||||
The format of the `additional-spring-configuration-metadata.json` file is exactly the same
|
||||
as the regular `spring-configuration-metadata.json`. The additional properties file is
|
||||
optional, if you don't have any additional properties, simply don't add it.
|
||||
@@ -0,0 +1,8 @@
|
||||
[appendix]
|
||||
[[appendix-dependency-versions]]
|
||||
== Dependency versions
|
||||
The table below provides details of all of the dependency versions that are provided by Spring Boot
|
||||
in its CLI, Maven dependency management and Gradle plugin. When you declare a dependency on one of
|
||||
these artifacts without declaring a version the version that is listed in the table will be used.
|
||||
|
||||
include::../../../target/generated-resources/effective-pom.adoc[]
|
||||
@@ -0,0 +1,331 @@
|
||||
[appendix]
|
||||
[[executable-jar]]
|
||||
== The executable jar format
|
||||
The `spring-boot-loader` modules allows Spring Boot to support executable jar and
|
||||
war files. If you're using the Maven or Gradle plugin, executable jars are
|
||||
automatically generated and you generally won't need to know the details of how
|
||||
they work.
|
||||
|
||||
If you need to create executable jars from a different build system, or if you are just
|
||||
curious about the underlying technology, this section provides some background.
|
||||
|
||||
|
||||
|
||||
[[executable-jar-nested-jars]]
|
||||
=== Nested JARs
|
||||
Java does not provide any standard way to load nested jar files (i.e. jar files that
|
||||
are themselves contained within a jar). This can be problematic if you are looking
|
||||
to distribute a self-contained application that you can just run from the command line
|
||||
without unpacking.
|
||||
|
||||
To solve this problem, many developers use "`shaded`" jars. A shaded jar simply packages
|
||||
all classes, from all jars, into a single 'uber jar'. The problem with shaded jars is
|
||||
that it becomes hard to see which libraries you are actually using in your application.
|
||||
It can also be problematic if the same filename is used (but with different content)
|
||||
in multiple jars. Spring Boot takes a different approach and allows you to actually nest
|
||||
jars directly.
|
||||
|
||||
|
||||
|
||||
[[executable-jar-jar-file-structure]]
|
||||
==== The executable jar file structure
|
||||
Spring Boot Loader compatible jar files should be structured in the following way:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
example.jar
|
||||
|
|
||||
+-META-INF
|
||||
| +-MANIFEST.MF
|
||||
+-org
|
||||
| +-springframework
|
||||
| +-boot
|
||||
| +-loader
|
||||
| +-<spring boot loader classes>
|
||||
+-BOOT-INF
|
||||
+-classes
|
||||
| +-mycompany
|
||||
| +-project
|
||||
| +-YourClasses.class
|
||||
+-lib
|
||||
+-dependency1.jar
|
||||
+-dependency2.jar
|
||||
----
|
||||
|
||||
Application classes should be placed in a nested `BOOT-INF/classes` directory.
|
||||
Dependencies should be placed in a nested `BOOT-INF/lib` directory.
|
||||
|
||||
|
||||
|
||||
[[executable-jar-war-file-structure]]
|
||||
==== The executable war file structure
|
||||
Spring Boot Loader compatible war files should be structured in the following way:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
example.war
|
||||
|
|
||||
+-META-INF
|
||||
| +-MANIFEST.MF
|
||||
+-org
|
||||
| +-springframework
|
||||
| +-boot
|
||||
| +-loader
|
||||
| +-<spring boot loader classes>
|
||||
+-WEB-INF
|
||||
+-classes
|
||||
| +-com
|
||||
| +-mycompany
|
||||
| +-project
|
||||
| +-YourClasses.class
|
||||
+-lib
|
||||
| +-dependency1.jar
|
||||
| +-dependency2.jar
|
||||
+-lib-provided
|
||||
+-servlet-api.jar
|
||||
+-dependency3.jar
|
||||
----
|
||||
|
||||
Dependencies should be placed in a nested `WEB-INF/lib` directory. Any dependencies
|
||||
that are required when running embedded but are not required when deploying to
|
||||
a traditional web container should be placed in `WEB-INF/lib-provided`.
|
||||
|
||||
|
||||
|
||||
[[executable-jar-jarfile]]
|
||||
=== Spring Boot's "`JarFile`" class
|
||||
The core class used to support loading nested jars is
|
||||
`org.springframework.boot.loader.jar.JarFile`. It allows you to load jar
|
||||
content from a standard jar file, or from nested child jar data. When first loaded, the
|
||||
location of each `JarEntry` is mapped to a physical file offset of the outer jar:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
myapp.jar
|
||||
+-------------------+-------------------------+
|
||||
| /BOOT-INF/classes | /BOOT-INF/lib/mylib.jar |
|
||||
|+-----------------+||+-----------+----------+|
|
||||
|| A.class ||| B.class | C.class ||
|
||||
|+-----------------+||+-----------+----------+|
|
||||
+-------------------+-------------------------+
|
||||
^ ^ ^
|
||||
0063 3452 3980
|
||||
----
|
||||
|
||||
The example above shows how `A.class` can be found in `/BOOT-INF/classes` in `myapp.jar`
|
||||
position `0063`. `B.class` from the nested jar can actually be found in `myapp.jar`
|
||||
position `3452` and `C.class` is at position `3980`.
|
||||
|
||||
Armed with this information, we can load specific nested entries by simply seeking to
|
||||
the appropriate part of the outer jar. We don't need to unpack the archive and we
|
||||
don't need to read all entry data into memory.
|
||||
|
||||
|
||||
|
||||
[[executable-jar-jarfile-compatibility]]
|
||||
==== Compatibility with the standard Java "`JarFile`"
|
||||
Spring Boot Loader strives to remain compatible with existing code and libraries.
|
||||
`org.springframework.boot.loader.jar.JarFile` extends from `java.util.jar.JarFile` and
|
||||
should work as a drop-in replacement. The `getURL()` method will return a `URL` that
|
||||
opens a `java.net.JarURLConnection` compatible connection and can be used with Java's
|
||||
`URLClassLoader`.
|
||||
|
||||
|
||||
|
||||
[[executable-jar-launching]]
|
||||
=== Launching executable jars
|
||||
The `org.springframework.boot.loader.Launcher` class is a special bootstrap class that
|
||||
is used as an executable jars main entry point. It is the actual `Main-Class` in your jar
|
||||
file and it's used to setup an appropriate `URLClassLoader` and ultimately call your
|
||||
`main()` method.
|
||||
|
||||
There are 3 launcher subclasses (`JarLauncher`, `WarLauncher` and `PropertiesLauncher`).
|
||||
Their purpose is to load resources (`.class` files etc.) from nested jar files or war
|
||||
files in directories (as opposed to explicitly on the classpath). In the case of
|
||||
`JarLauncher` and `WarLauncher` the nested paths are fixed. `JarLauncher` looks in
|
||||
`BOOT-INF/lib/` and `WarLauncher` looks in `WEB-INF/lib/` and `WEB-INF/lib-provided/` so
|
||||
you just add extra jars in those locations if you want more. The `PropertiesLauncher`
|
||||
looks in `BOOT-INF/lib/` in your application archive by default, but you can add
|
||||
additional locations by setting an environment variable `LOADER_PATH` or `loader.path`
|
||||
in `loader.properties` (comma-separated list of directories, archives, or directories
|
||||
within archives).
|
||||
|
||||
|
||||
|
||||
[[executable-jar-launcher-manifest]]
|
||||
==== Launcher manifest
|
||||
You need to specify an appropriate `Launcher` as the `Main-Class` attribute of
|
||||
`META-INF/MANIFEST.MF`. The actual class that you want to launch (i.e. the class that
|
||||
you wrote that contains a `main` method) should be specified in the `Start-Class`
|
||||
attribute.
|
||||
|
||||
For example, here is a typical `MANIFEST.MF` for an executable jar file:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
Main-Class: org.springframework.boot.loader.JarLauncher
|
||||
Start-Class: com.mycompany.project.MyApplication
|
||||
----
|
||||
|
||||
For a war file, it would be:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
Main-Class: org.springframework.boot.loader.WarLauncher
|
||||
Start-Class: com.mycompany.project.MyApplication
|
||||
----
|
||||
|
||||
NOTE: You do not need to specify `Class-Path` entries in your manifest file, the classpath
|
||||
will be deduced from the nested jars.
|
||||
|
||||
|
||||
|
||||
[[executable-jar-exploded-archives]]
|
||||
==== Exploded archives
|
||||
Certain PaaS implementations may choose to unpack archives before they run. For example,
|
||||
Cloud Foundry operates in this way. You can run an unpacked archive by simply starting
|
||||
the appropriate launcher:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ unzip -q myapp.jar
|
||||
$ java org.springframework.boot.loader.JarLauncher
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[executable-jar-property-launcher-features]]
|
||||
=== PropertiesLauncher Features
|
||||
|
||||
`PropertiesLauncher` has a few special features that can be enabled with external
|
||||
properties (System properties, environment variables, manifest entries or
|
||||
`loader.properties`).
|
||||
|
||||
|===
|
||||
|Key |Purpose
|
||||
|
||||
|`loader.path`
|
||||
|Comma-separated Classpath, e.g. `lib,${HOME}/app/lib`. Earlier entries take precedence,
|
||||
just like a regular `-classpath` on the `javac` command line.
|
||||
|
||||
|`loader.home`
|
||||
|Used to resolve relative paths in `loader.path`. E.g. `loader.path=lib` then
|
||||
`${loader.home}/lib` is a classpath location (along with all jar files in that
|
||||
directory). Also used to locate a `loader.properties` file. Example `file:///opt/app`
|
||||
(defaults to `${user.dir}`).
|
||||
|
||||
|`loader.args`
|
||||
|Default arguments for the main method (space separated)
|
||||
|
||||
|`loader.main`
|
||||
|Name of main class to launch, e.g. `com.app.Application`.
|
||||
|
||||
|`loader.config.name`
|
||||
|Name of properties file, e.g. `launcher` (defaults to `loader`).
|
||||
|
||||
|`loader.config.location`
|
||||
|Path to properties file, e.g. `classpath:loader.properties` (defaults to
|
||||
`loader.properties`).
|
||||
|
||||
|`loader.system`
|
||||
|Boolean flag to indicate that all properties should be added to System properties
|
||||
(defaults to `false`)
|
||||
|
||||
|===
|
||||
|
||||
When specified as environment variables or manifest entries, the following names should
|
||||
be used:
|
||||
|
||||
|===
|
||||
|Key | Manifest entry | Environment variable
|
||||
|
||||
|`loader.path`
|
||||
|`Loader-Path`
|
||||
|`LOADER_PATH`
|
||||
|
||||
|`loader.home`
|
||||
|`Loader-Home`
|
||||
|`LOADER_HOME`
|
||||
|
||||
|`loader.args`
|
||||
|`Loader-Args`
|
||||
|`LOADER_ARGS`
|
||||
|
||||
|`loader.main`
|
||||
|`Start-Class`
|
||||
|`LOADER_MAIN`
|
||||
|
||||
|`loader.config.location`
|
||||
|`Loader-Config-Location`
|
||||
|`LOADER_CONFIG_LOCATION`
|
||||
|
||||
|`loader.system`
|
||||
|`Loader-System`
|
||||
|`LOADER_SYSTEM`
|
||||
|
||||
|===
|
||||
|
||||
TIP: Build plugins automatically move the `Main-Class` attribute to `Start-Class` when
|
||||
the fat jar is built. If you are using that, specify the name of the class to launch using
|
||||
the `Main-Class` attribute and leave out `Start-Class`.
|
||||
|
||||
* `loader.properties` are searched for in `loader.home` then in the root of the
|
||||
classpath, then in `classpath:/BOOT-INF/classes`. The first location that exists is
|
||||
used.
|
||||
* `loader.home` is only the directory location of an additional properties file
|
||||
(overriding the default) as long as `loader.config.location` is not specified.
|
||||
* `loader.path` can contain directories (scanned recursively for jar and zip files),
|
||||
archive paths, a directory within an archive that is scanned for jar files (for
|
||||
example, `dependencies.jar!/lib`), or wildcard patterns (for the default JVM behavior).
|
||||
Archive paths can be relative to `loader.home`, or anywhere in the file system with a
|
||||
`jar:file:` prefix.
|
||||
* `loader.path` (if empty) defaults to `BOOT-INF/lib` (meaning a local directory or a
|
||||
nested one if running from an archive). Because of this `PropertiesLauncher` behaves the
|
||||
same as `JarLauncher` when no additional configuration is provided.
|
||||
* `loader.path` can not be used to configure the location of `loader.properties` (the
|
||||
classpath used to search for the latter is the JVM classpath when `PropertiesLauncher`
|
||||
is launched).
|
||||
* Placeholder replacement is done from System and environment variables plus the
|
||||
properties file itself on all values before use.
|
||||
* The search order for properties (where it makes sense to look in more than one place)
|
||||
is env vars, system properties, `loader.properties`, exploded archive manifest, archive
|
||||
manifest.
|
||||
|
||||
|
||||
|
||||
[[executable-jar-restrictions]]
|
||||
=== Executable jar restrictions
|
||||
There are a number of restrictions that you need to consider when working with a Spring
|
||||
Boot Loader packaged application.
|
||||
|
||||
|
||||
|
||||
[[executable-jar-zip-entry-compression]]
|
||||
==== Zip entry compression
|
||||
The `ZipEntry` for a nested jar must be saved using the `ZipEntry.STORED` method. This
|
||||
is required so that we can seek directly to individual content within the nested jar.
|
||||
The content of the nested jar file itself can still be compressed, as can any other
|
||||
entries in the outer jar.
|
||||
|
||||
|
||||
|
||||
[[executable-jar-system-classloader]]
|
||||
==== System ClassLoader
|
||||
Launched applications should use `Thread.getContextClassLoader()` when loading classes
|
||||
(most libraries and frameworks will do this by default). Trying to load nested jar
|
||||
classes via `ClassLoader.getSystemClassLoader()` will fail. Please be aware that
|
||||
`java.util.Logging` always uses the system classloader, for this reason you should
|
||||
consider a different logging implementation.
|
||||
|
||||
|
||||
|
||||
[[executable-jar-alternatives]]
|
||||
=== Alternative single jar solutions
|
||||
If the above restrictions mean that you cannot use Spring Boot Loader the following
|
||||
alternatives could be considered:
|
||||
|
||||
* http://maven.apache.org/plugins/maven-shade-plugin/[Maven Shade Plugin]
|
||||
* http://www.jdotsoft.com/JarClassLoader.php[JarClassLoader]
|
||||
* http://one-jar.sourceforge.net[OneJar]
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[appendix]
|
||||
[[test-auto-configuration]]
|
||||
== Test auto-configuration annotations
|
||||
Here is a table of the various `@…Test` annotations that can be used to test
|
||||
slices of your application and the auto-configuration that they import by default:
|
||||
|
||||
include::../../../target/generated-resources/test-slice-auto-configuration.adoc[]
|
||||
@@ -0,0 +1,9 @@
|
||||
[[appendix]]
|
||||
= Appendices
|
||||
|
||||
include::appendix-application-properties.adoc[]
|
||||
include::appendix-configuration-metadata.adoc[]
|
||||
include::appendix-auto-configuration-classes.adoc[]
|
||||
include::appendix-test-auto-configuration.adoc[]
|
||||
include::appendix-executable-jar-format.adoc[]
|
||||
include::appendix-dependency-versions.adoc[]
|
||||
@@ -0,0 +1,393 @@
|
||||
[[build-tool-plugins]]
|
||||
= Build tool plugins
|
||||
|
||||
[partintro]
|
||||
--
|
||||
Spring Boot provides build tool plugins for Maven and Gradle. The plugins offer a
|
||||
variety of features, including the packaging of executable jars. This section provides
|
||||
more details on both plugins, as well as some help should you need to extend an
|
||||
unsupported build system. If you are just getting started, you might want to read
|
||||
"`<<using-spring-boot.adoc#using-boot-build-systems>>`" from the
|
||||
<<using-spring-boot.adoc#using-boot>> section first.
|
||||
--
|
||||
|
||||
|
||||
|
||||
[[build-tool-plugins-maven-plugin]]
|
||||
== Spring Boot Maven plugin
|
||||
The {spring-boot-maven-plugin-site}/[Spring Boot Maven Plugin] provides Spring Boot
|
||||
support in Maven, allowing you to package executable jar or war archives and run an
|
||||
application "`in-place`". To use it you must be using Maven 3.2 (or better).
|
||||
|
||||
NOTE: Refer to the {spring-boot-maven-plugin-site}/[Spring Boot Maven Plugin Site]
|
||||
for complete plugin documentation.
|
||||
|
||||
|
||||
|
||||
[[build-tool-plugins-include-maven-plugin]]
|
||||
=== Including the plugin
|
||||
To use the Spring Boot Maven Plugin simply include the appropriate XML in the `plugins`
|
||||
section of your `pom.xml`
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,attributes"]
|
||||
----
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<!-- ... -->
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>{spring-boot-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
----
|
||||
|
||||
This configuration will repackage a jar or war that is built during the `package` phase of
|
||||
the Maven lifecycle. The following example shows both the repackaged jar, as well as the
|
||||
original jar, in the `target` directory:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ mvn package
|
||||
$ ls target/*.jar
|
||||
target/myproject-1.0.0.jar target/myproject-1.0.0.jar.original
|
||||
----
|
||||
|
||||
|
||||
If you don't include the `<execution/>` configuration as above, you can run the plugin on
|
||||
its own (but only if the package goal is used as well). For example:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ mvn package spring-boot:repackage
|
||||
$ ls target/*.jar
|
||||
target/myproject-1.0.0.jar target/myproject-1.0.0.jar.original
|
||||
----
|
||||
|
||||
If you are using a milestone or snapshot release you will also need to add appropriate
|
||||
`pluginRepository` elements:
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,attributes"]
|
||||
----
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>spring-snapshots</id>
|
||||
<url>http://repo.spring.io/snapshot</url>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>spring-milestones</id>
|
||||
<url>http://repo.spring.io/milestone</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[build-tool-plugins-maven-packaging]]
|
||||
=== Packaging executable jar and war files
|
||||
Once `spring-boot-maven-plugin` has been included in your `pom.xml` it will automatically
|
||||
attempt to rewrite archives to make them executable using the `spring-boot:repackage`
|
||||
goal. You should configure your project to build a jar or war (as appropriate) using the
|
||||
usual `packaging` element:
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,attributes"]
|
||||
----
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<!-- ... -->
|
||||
<packaging>jar</packaging>
|
||||
<!-- ... -->
|
||||
</project>
|
||||
----
|
||||
|
||||
Your existing archive will be enhanced by Spring Boot during the `package` phase. The
|
||||
main class that you want to launch can either be specified using a configuration option,
|
||||
or by adding a `Main-Class` attribute to the manifest in the usual way. If you don't
|
||||
specify a main class the plugin will search for a class with a
|
||||
`public static void main(String[] args)` method.
|
||||
|
||||
To build and run a project artifact, you can type the following:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ mvn package
|
||||
$ java -jar target/mymodule-0.0.1-SNAPSHOT.jar
|
||||
----
|
||||
|
||||
To build a war file that is both executable and deployable into an external container you
|
||||
need to mark the embedded container dependencies as "`provided`", e.g:
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,attributes"]
|
||||
----
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<!-- ... -->
|
||||
<packaging>war</packaging>
|
||||
<!-- ... -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- ... -->
|
||||
</dependencies>
|
||||
</project>
|
||||
----
|
||||
|
||||
TIP: See the "`<<howto-create-a-deployable-war-file>>`" section for more details on
|
||||
how to create a deployable war file.
|
||||
|
||||
Advanced configuration options and examples are available in the
|
||||
{spring-boot-maven-plugin-site}/[plugin info page].
|
||||
|
||||
|
||||
|
||||
[[build-tool-plugins-gradle-plugin]]
|
||||
== Spring Boot Gradle plugin
|
||||
The Spring Boot Gradle Plugin provides Spring Boot support in Gradle, allowing you to
|
||||
package executable jar or war archives, run Spring Boot applications and use the
|
||||
dependency management provided by `spring-boot-dependencies`. It requires Gradle 4.0 or
|
||||
later. Please refer to the plugin's documentation to learn more:
|
||||
|
||||
* Reference ({spring-boot-gradle-plugin}/reference/html[HTML] and
|
||||
{spring-boot-gradle-plugin}/reference/pdf/spring-boot-gradle-plugin-reference.pdf[PDF])
|
||||
* {spring-boot-gradle-plugin}/api[API]
|
||||
|
||||
|
||||
|
||||
[[build-tool-plugins-antlib]]
|
||||
== Spring Boot AntLib module
|
||||
The Spring Boot AntLib module provides basic Spring Boot support for Apache Ant. You can
|
||||
use the module to create executable jars. To use the module you need to declare an
|
||||
additional `spring-boot` namespace in your `build.xml`:
|
||||
|
||||
[source,xml,indent=0]
|
||||
----
|
||||
<project xmlns:ivy="antlib:org.apache.ivy.ant"
|
||||
xmlns:spring-boot="antlib:org.springframework.boot.ant"
|
||||
name="myapp" default="build">
|
||||
...
|
||||
</project>
|
||||
----
|
||||
|
||||
You'll need to remember to start Ant using the `-lib` option, for example:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ ant -lib <folder containing spring-boot-antlib-{spring-boot-version}.jar>
|
||||
----
|
||||
|
||||
TIP: The "`Using Spring Boot`" section includes a more complete example of
|
||||
<<using-spring-boot.adoc#using-boot-ant, using Apache Ant with `spring-boot-antlib`>>
|
||||
|
||||
|
||||
=== Spring Boot Ant tasks
|
||||
Once the `spring-boot-antlib` namespace has been declared, the following additional
|
||||
tasks are available.
|
||||
|
||||
|
||||
|
||||
==== spring-boot:exejar
|
||||
The `exejar` task can be used to creates a Spring Boot executable jar. The following
|
||||
attributes are supported by the task:
|
||||
|
||||
[cols="1,2,2"]
|
||||
|====
|
||||
|Attribute |Description |Required
|
||||
|
||||
|`destfile`
|
||||
|The destination jar file to create
|
||||
|Yes
|
||||
|
||||
|`classes`
|
||||
|The root directory of Java class files
|
||||
|Yes
|
||||
|
||||
|`start-class`
|
||||
|The main application class to run
|
||||
|No _(default is first class found declaring a `main` method)_
|
||||
|====
|
||||
|
||||
The following nested elements can be used with the task:
|
||||
|
||||
[cols="1,4"]
|
||||
|====
|
||||
|Element |Description
|
||||
|
||||
|`resources`
|
||||
|One or more {ant-manual}/Types/resources.html#collection[Resource Collections]
|
||||
describing a set of {ant-manual}/Types/resources.html[Resources] that should be added to
|
||||
the content of the created +jar+ file.
|
||||
|
||||
|`lib`
|
||||
|One or more {ant-manual}/Types/resources.html#collection[Resource Collections]
|
||||
that should be added to the set of jar libraries that make up the runtime dependency
|
||||
classpath of the application.
|
||||
|====
|
||||
|
||||
|
||||
|
||||
==== Examples
|
||||
.Specify +start-class+
|
||||
[source,xml,indent=0]
|
||||
----
|
||||
<spring-boot:exejar destfile="target/my-application.jar"
|
||||
classes="target/classes" start-class="com.foo.MyApplication">
|
||||
<resources>
|
||||
<fileset dir="src/main/resources" />
|
||||
</resources>
|
||||
<lib>
|
||||
<fileset dir="lib" />
|
||||
</lib>
|
||||
</spring-boot:exejar>
|
||||
----
|
||||
|
||||
.Detect +start-class+
|
||||
[source,xml,indent=0]
|
||||
----
|
||||
<exejar destfile="target/my-application.jar" classes="target/classes">
|
||||
<lib>
|
||||
<fileset dir="lib" />
|
||||
</lib>
|
||||
</exejar>
|
||||
----
|
||||
|
||||
|
||||
|
||||
=== spring-boot:findmainclass
|
||||
The `findmainclass` task is used internally by `exejar` to locate a class declaring a
|
||||
`main`. You can also use this task directly in your build if needed. The following
|
||||
attributes are supported
|
||||
|
||||
[cols="1,2,2"]
|
||||
|====
|
||||
|Attribute |Description |Required
|
||||
|
||||
|`classesroot`
|
||||
|The root directory of Java class files
|
||||
|Yes _(unless `mainclass` is specified)_
|
||||
|
||||
|`mainclass`
|
||||
|Can be used to short-circuit the `main` class search
|
||||
|No
|
||||
|
||||
|`property`
|
||||
|The Ant property that should be set with the result
|
||||
|No _(result will be logged if unspecified)_
|
||||
|====
|
||||
|
||||
|
||||
|
||||
==== Examples
|
||||
.Find and log
|
||||
[source,xml,indent=0]
|
||||
----
|
||||
<findmainclass classesroot="target/classes" />
|
||||
----
|
||||
|
||||
.Find and set
|
||||
[source,xml,indent=0]
|
||||
----
|
||||
<findmainclass classesroot="target/classes" property="main-class" />
|
||||
----
|
||||
|
||||
.Override and set
|
||||
[source,xml,indent=0]
|
||||
----
|
||||
<findmainclass mainclass="com.foo.MainClass" property="main-class" />
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[build-tool-plugins-other-build-systems]]
|
||||
== Supporting other build systems
|
||||
If you want to use a build tool other than Maven, Gradle or Ant, you will likely need to
|
||||
develop your own plugin. Executable jars need to follow a specific format and certain
|
||||
entries need to be written in an uncompressed form (see the
|
||||
_<<appendix-executable-jar-format.adoc#executable-jar, executable jar format>>_ section
|
||||
in the appendix for details).
|
||||
|
||||
The Spring Boot Maven and Gradle plugins both make use of `spring-boot-loader-tools` to
|
||||
actually generate jars. You are also free to use this library directly yourself if you
|
||||
need to.
|
||||
|
||||
|
||||
|
||||
[[build-tool-plugins-repackaging-archives]]
|
||||
=== Repackaging archives
|
||||
To repackage an existing archive so that it becomes a self-contained executable archive
|
||||
use `org.springframework.boot.loader.tools.Repackager`. The `Repackager` class takes a
|
||||
single constructor argument that refers to an existing jar or war archive. Use one of the
|
||||
two available `repackage()` methods to either replace the original file or write to a new
|
||||
destination. Various settings can also be configured on the repackager before it is
|
||||
run.
|
||||
|
||||
|
||||
|
||||
[[build-tool-plugins-nested-libraries]]
|
||||
=== Nested libraries
|
||||
When repackaging an archive you can include references to dependency files using the
|
||||
`org.springframework.boot.loader.tools.Libraries` interface. We don't provide any
|
||||
concrete implementations of `Libraries` here as they are usually build system specific.
|
||||
|
||||
If your archive already includes libraries you can use `Libraries.NONE`.
|
||||
|
||||
|
||||
|
||||
[[build-tool-plugins-find-a-main-class]]
|
||||
=== Finding a main class
|
||||
If you don't use `Repackager.setMainClass()` to specify a main class, the repackager will
|
||||
use http://asm.ow2.org/[ASM] to read class files and attempt to find a suitable class
|
||||
with a `public static void main(String[] args)` method. An exception is thrown if more
|
||||
than one candidate is found.
|
||||
|
||||
|
||||
|
||||
[[build-tool-plugins-repackage-implementation]]
|
||||
=== Example repackage implementation
|
||||
Here is a typical example repackage:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
Repackager repackager = new Repackager(sourceJarFile);
|
||||
repackager.setBackupSource(false);
|
||||
repackager.repackage(new Libraries() {
|
||||
@Override
|
||||
public void doWithLibraries(LibraryCallback callback) throws IOException {
|
||||
// Build system specific implementation, callback for each dependency
|
||||
// callback.library(new Library(nestedFile, LibraryScope.COMPILE));
|
||||
}
|
||||
});
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[build-tool-plugins-whats-next]]
|
||||
== What to read next
|
||||
If you're interested in how the build tool plugins work you can
|
||||
look at the {github-code}/spring-boot-tools[`spring-boot-tools`] module on GitHub. More
|
||||
technical details of the <<appendix-executable-jar-format.adoc#executable-jar, executable
|
||||
jar format>> are covered in the appendix.
|
||||
|
||||
If you have specific build-related questions you can check out the
|
||||
"`<<howto.adoc#howto, how-to>>`" guides.
|
||||
@@ -0,0 +1,903 @@
|
||||
[[deployment]]
|
||||
= Deploying Spring Boot applications
|
||||
|
||||
[partintro]
|
||||
--
|
||||
Spring Boot's flexible packaging options provide a great deal of choice when it comes to
|
||||
deploying your application. You can easily deploy Spring Boot applications to a variety
|
||||
of cloud platforms, to a container images (such as Docker) or to virtual/real machines.
|
||||
|
||||
This section covers some of the more common deployment scenarios.
|
||||
--
|
||||
|
||||
|
||||
|
||||
[[cloud-deployment]]
|
||||
== Deploying to the cloud
|
||||
Spring Boot's executable jars are ready-made for most popular cloud PaaS
|
||||
(platform-as-a-service) providers. These providers tend to require that you
|
||||
"`bring your own container`"; they manage application processes (not Java applications
|
||||
specifically), so they need some intermediary layer that adapts _your_ application to the
|
||||
_cloud's_ notion of a running process.
|
||||
|
||||
Two popular cloud providers, Heroku and Cloud Foundry, employ a "`buildpack`" approach.
|
||||
The buildpack wraps your deployed code in whatever is needed to _start_ your
|
||||
application: it might be a JDK and a call to `java`, it might be an embedded web server,
|
||||
or it might be a full-fledged application server. A buildpack is pluggable, but ideally
|
||||
you should be able to get by with as few customizations to it as possible.
|
||||
This reduces the footprint of functionality that is not under your control. It minimizes
|
||||
divergence between development and production environments.
|
||||
|
||||
Ideally, your application, like a Spring Boot executable jar, has everything that it needs
|
||||
to run packaged within it.
|
||||
|
||||
In this section we'll look at what it takes to get the
|
||||
<<getting-started.adoc#getting-started-first-application, simple application that we
|
||||
developed>> in the "`Getting Started`" section up and running in the Cloud.
|
||||
|
||||
|
||||
|
||||
[[cloud-deployment-cloud-foundry]]
|
||||
=== Cloud Foundry
|
||||
Cloud Foundry provides default buildpacks that come into play if no other buildpack is
|
||||
specified. The Cloud Foundry https://github.com/cloudfoundry/java-buildpack[Java buildpack]
|
||||
has excellent support for Spring applications, including Spring Boot. You can deploy
|
||||
stand-alone executable jar applications, as well as traditional `.war` packaged
|
||||
applications.
|
||||
|
||||
Once you've built your application (using, for example, `mvn clean package`) and
|
||||
http://docs.cloudfoundry.org/devguide/installcf/install-go-cli.html[installed the `cf`
|
||||
command line tool], simply deploy your application using the `cf push` command as follows,
|
||||
substituting the path to your compiled `.jar`. Be sure to have
|
||||
http://docs.cloudfoundry.org/devguide/installcf/whats-new-v6.html#login[logged in with your
|
||||
`cf` command line client] before pushing an application.
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ cf push acloudyspringtime -p target/demo-0.0.1-SNAPSHOT.jar
|
||||
----
|
||||
|
||||
See the http://docs.cloudfoundry.org/devguide/installcf/whats-new-v6.html#push[`cf push`
|
||||
documentation] for more options. If there is a Cloud Foundry
|
||||
http://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html[`manifest.yml`]
|
||||
file present in the same directory, it will be consulted.
|
||||
|
||||
NOTE: Here we are substituting `acloudyspringtime` for whatever value you give `cf`
|
||||
as the name of your application.
|
||||
|
||||
At this point `cf` will start uploading your application:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
Uploading acloudyspringtime... *OK*
|
||||
Preparing to start acloudyspringtime... *OK*
|
||||
-----> Downloaded app package (*8.9M*)
|
||||
-----> Java Buildpack Version: v3.12 (offline) | https://github.com/cloudfoundry/java-buildpack.git#6f25b7e
|
||||
-----> Downloading Open Jdk JRE 1.8.0_121 from https://java-buildpack.cloudfoundry.org/openjdk/trusty/x86_64/openjdk-1.8.0_121.tar.gz (found in cache)
|
||||
Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.6s)
|
||||
-----> Downloading Open JDK Like Memory Calculator 2.0.2_RELEASE from https://java-buildpack.cloudfoundry.org/memory-calculator/trusty/x86_64/memory-calculator-2.0.2_RELEASE.tar.gz (found in cache)
|
||||
Memory Settings: -Xss349K -Xmx681574K -XX:MaxMetaspaceSize=104857K -Xms681574K -XX:MetaspaceSize=104857K
|
||||
-----> Downloading Container Certificate Trust Store 1.0.0_RELEASE from https://java-buildpack.cloudfoundry.org/container-certificate-trust-store/container-certificate-trust-store-1.0.0_RELEASE.jar (found in cache)
|
||||
Adding certificates to .java-buildpack/container_certificate_trust_store/truststore.jks (0.6s)
|
||||
-----> Downloading Spring Auto Reconfiguration 1.10.0_RELEASE from https://java-buildpack.cloudfoundry.org/auto-reconfiguration/auto-reconfiguration-1.10.0_RELEASE.jar (found in cache)
|
||||
Checking status of app 'acloudyspringtime'...
|
||||
0 of 1 instances running (1 starting)
|
||||
...
|
||||
0 of 1 instances running (1 starting)
|
||||
...
|
||||
0 of 1 instances running (1 starting)
|
||||
...
|
||||
1 of 1 instances running (1 running)
|
||||
|
||||
App started
|
||||
----
|
||||
|
||||
Congratulations! The application is now live!
|
||||
|
||||
It's easy to then verify the status of the deployed application:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ cf apps
|
||||
Getting applications in ...
|
||||
OK
|
||||
|
||||
name requested state instances memory disk urls
|
||||
...
|
||||
acloudyspringtime started 1/1 512M 1G acloudyspringtime.cfapps.io
|
||||
...
|
||||
----
|
||||
|
||||
Once Cloud Foundry acknowledges that your application has been deployed, you should be
|
||||
able to hit the application at the URI given, in this case
|
||||
`\http://acloudyspringtime.cfapps.io/`.
|
||||
|
||||
|
||||
|
||||
[[cloud-deployment-cloud-foundry-services]]
|
||||
==== Binding to services
|
||||
By default, metadata about the running application as well as service connection
|
||||
information is exposed to the application as environment variables (for example:
|
||||
`$VCAP_SERVICES`). This architecture decision is due to Cloud Foundry's polyglot
|
||||
(any language and platform can be supported as a buildpack) nature; process-scoped
|
||||
environment variables are language agnostic.
|
||||
|
||||
Environment variables don't always make for the easiest API so Spring Boot automatically
|
||||
extracts them and flattens the data into properties that can be accessed through
|
||||
Spring's `Environment` abstraction:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Component
|
||||
class MyBean implements EnvironmentAware {
|
||||
|
||||
private String instanceId;
|
||||
|
||||
@Override
|
||||
public void setEnvironment(Environment environment) {
|
||||
this.instanceId = environment.getProperty("vcap.application.instance_id");
|
||||
}
|
||||
|
||||
// ...
|
||||
|
||||
}
|
||||
----
|
||||
|
||||
All Cloud Foundry properties are prefixed with `vcap`. You can use vcap properties to
|
||||
access application information (such as the public URL of the application) and service
|
||||
information (such as database credentials). See `CloudFoundryVcapEnvironmentPostProcessor`
|
||||
Javadoc for complete details.
|
||||
|
||||
TIP: The http://cloud.spring.io/spring-cloud-connectors/[Spring Cloud Connectors] project
|
||||
is a better fit for tasks such as configuring a DataSource. Spring Boot includes
|
||||
auto-configuration support and a `spring-boot-starter-cloud-connectors` starter.
|
||||
|
||||
|
||||
|
||||
[[cloud-deployment-heroku]]
|
||||
=== Heroku
|
||||
Heroku is another popular PaaS platform. To customize Heroku builds, you provide a
|
||||
`Procfile`, which provides the incantation required to deploy an application. Heroku
|
||||
assigns a `port` for the Java application to use and then ensures that routing to the
|
||||
external URI works.
|
||||
|
||||
You must configure your application to listen on the correct port. Here's the `Procfile`
|
||||
for our starter REST application:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
web: java -Dserver.port=$PORT -jar target/demo-0.0.1-SNAPSHOT.jar
|
||||
----
|
||||
|
||||
Spring Boot makes `-D` arguments available as properties accessible from a Spring
|
||||
`Environment` instance. The `server.port` configuration property is fed to the embedded
|
||||
Tomcat, Jetty or Undertow instance which then uses it when it starts up. The `$PORT`
|
||||
environment variable is assigned to us by the Heroku PaaS.
|
||||
|
||||
This should be everything you need. The most common workflow for Heroku deployments is to
|
||||
`git push` the code to production.
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ git push heroku master
|
||||
|
||||
Initializing repository, *done*.
|
||||
Counting objects: 95, *done*.
|
||||
Delta compression using up to 8 threads.
|
||||
Compressing objects: 100% (78/78), *done*.
|
||||
Writing objects: 100% (95/95), 8.66 MiB | 606.00 KiB/s, *done*.
|
||||
Total 95 (delta 31), reused 0 (delta 0)
|
||||
|
||||
-----> Java app detected
|
||||
-----> Installing OpenJDK 1.8... *done*
|
||||
-----> Installing Maven 3.3.1... *done*
|
||||
-----> Installing settings.xml... *done*
|
||||
-----> Executing: mvn -B -DskipTests=true clean install
|
||||
|
||||
[INFO] Scanning for projects...
|
||||
Downloading: http://repo.spring.io/...
|
||||
Downloaded: http://repo.spring.io/... (818 B at 1.8 KB/sec)
|
||||
....
|
||||
Downloaded: http://s3pository.heroku.com/jvm/... (152 KB at 595.3 KB/sec)
|
||||
[INFO] Installing /tmp/build_0c35a5d2-a067-4abc-a232-14b1fb7a8229/target/...
|
||||
[INFO] Installing /tmp/build_0c35a5d2-a067-4abc-a232-14b1fb7a8229/pom.xml ...
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] *BUILD SUCCESS*
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] Total time: 59.358s
|
||||
[INFO] Finished at: Fri Mar 07 07:28:25 UTC 2014
|
||||
[INFO] Final Memory: 20M/493M
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
|
||||
-----> Discovering process types
|
||||
Procfile declares types -> *web*
|
||||
|
||||
-----> Compressing... *done*, 70.4MB
|
||||
-----> Launching... *done*, v6
|
||||
http://agile-sierra-1405.herokuapp.com/ *deployed to Heroku*
|
||||
|
||||
To git@heroku.com:agile-sierra-1405.git
|
||||
* [new branch] master -> master
|
||||
----
|
||||
|
||||
Your application should now be up and running on Heroku.
|
||||
|
||||
|
||||
|
||||
[[cloud-deployment-openshift]]
|
||||
=== OpenShift
|
||||
https://www.openshift.com/[OpenShift] is the RedHat public (and enterprise) PaaS solution.
|
||||
Like Heroku, it works by running scripts triggered by git commits, so you can script
|
||||
the launching of a Spring Boot application in pretty much any way you like as long as the
|
||||
Java runtime is available (which is a standard feature you can ask for at OpenShift).
|
||||
To do this you can use the
|
||||
https://www.openshift.com/developers/do-it-yourself[DIY Cartridge] and hooks in your
|
||||
repository under `.openshift/action_hooks`:
|
||||
|
||||
The basic model is to:
|
||||
|
||||
1. Ensure Java and your build tool are installed remotely, e.g. using a `pre_build` hook
|
||||
(Java and Maven are installed by default, Gradle is not)
|
||||
2. Use a `build` hook to build your jar (using Maven or Gradle), e.g.
|
||||
+
|
||||
[indent=0]
|
||||
----
|
||||
#!/bin/bash
|
||||
cd $OPENSHIFT_REPO_DIR
|
||||
mvn package -s .openshift/settings.xml -DskipTests=true
|
||||
----
|
||||
+
|
||||
3. Add a `start` hook that calls `java -jar ...`
|
||||
+
|
||||
[indent=0]
|
||||
----
|
||||
#!/bin/bash
|
||||
cd $OPENSHIFT_REPO_DIR
|
||||
nohup java -jar target/*.jar --server.port=${OPENSHIFT_DIY_PORT} --server.address=${OPENSHIFT_DIY_IP} &
|
||||
----
|
||||
+
|
||||
4. Use a `stop` hook (since the start is supposed to return cleanly), e.g.
|
||||
+
|
||||
[indent=0]
|
||||
----
|
||||
#!/bin/bash
|
||||
source $OPENSHIFT_CARTRIDGE_SDK_BASH
|
||||
PID=$(ps -ef | grep java.*\.jar | grep -v grep | awk '{ print $2 }')
|
||||
if [ -z "$PID" ]
|
||||
then
|
||||
client_result "Application is already stopped"
|
||||
else
|
||||
kill $PID
|
||||
fi
|
||||
----
|
||||
+
|
||||
5. Embed service bindings from environment variables provided by the platform
|
||||
in your `application.properties`, e.g.
|
||||
+
|
||||
[indent=0]
|
||||
----
|
||||
spring.datasource.url: jdbc:mysql://${OPENSHIFT_MYSQL_DB_HOST}:${OPENSHIFT_MYSQL_DB_PORT}/${OPENSHIFT_APP_NAME}
|
||||
spring.datasource.username: ${OPENSHIFT_MYSQL_DB_USERNAME}
|
||||
spring.datasource.password: ${OPENSHIFT_MYSQL_DB_PASSWORD}
|
||||
----
|
||||
|
||||
There's a blog on https://www.openshift.com/blogs/run-gradle-builds-on-openshift[running
|
||||
Gradle in OpenShift] on their website that will get you started with a gradle build to
|
||||
run the app.
|
||||
|
||||
|
||||
|
||||
[[cloud-deployment-aws]]
|
||||
=== Amazon Web Services (AWS)
|
||||
Amazon Web Services offers multiple ways to install Spring Boot based applications, either
|
||||
as traditional web applications (war) or as executable jar files with an embedded web
|
||||
server. Options include :
|
||||
|
||||
* AWS Elastic Beanstalk
|
||||
* AWS Code Deploy
|
||||
* AWS OPS Works
|
||||
* AWS Cloud Formation
|
||||
* AWS Container Registry
|
||||
|
||||
Each has different features and pricing model, here we will describe only the simplest
|
||||
option : AWS Elastic Beanstalk.
|
||||
|
||||
|
||||
|
||||
==== AWS Elastic Beanstalk
|
||||
As described in the official http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Java.html[Elastic
|
||||
Beanstalk Java guide], there are two main options to deploy a Java application; You can
|
||||
either use the "`Tomcat Platform`" or the "`Java SE platform`".
|
||||
|
||||
|
||||
|
||||
===== Using the Tomcat platform
|
||||
This option applies to Spring Boot projects producing a war file. There is no any special
|
||||
configuration required, just follow the official guide.
|
||||
|
||||
|
||||
|
||||
===== Using the Java SE platform
|
||||
This option applies to Spring Boot projects producing a jar file and running an embedded
|
||||
web container. Elastic Beanstalk environments run an nginx instance on port 80 to proxy
|
||||
the actual application, running on port 5000. To configure it, add the following to your
|
||||
`application.properties`:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
server.port=5000
|
||||
----
|
||||
|
||||
|
||||
|
||||
===== Best practices
|
||||
|
||||
====== Uploading binaries instead of sources
|
||||
By default Elastic Beanstalk uploads sources and compiles them in AWS. To upload the
|
||||
binaries instead, add the following to your `.elasticbeanstalk/config.yml` file:
|
||||
|
||||
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
deploy:
|
||||
artifact: target/demo-0.0.1-SNAPSHOT.jar
|
||||
----
|
||||
|
||||
|
||||
|
||||
====== Reduce costs by setting the environment type
|
||||
By default an Elastic Beanstalk environment is load balanced. The load balancer has a cost
|
||||
perspective, to avoid it, set the environment type to "`Single instance`" as described
|
||||
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environments-create-wizard.html#environments-create-wizard-capacity[in the Amazon documentation].
|
||||
Single instance environments can be created using the CLI as well using the following
|
||||
command:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
eb create -s
|
||||
----
|
||||
|
||||
|
||||
|
||||
==== Summary
|
||||
This is one of the easiest ways to get to AWS, but there are more things
|
||||
to cover, e.g.: how to integrate Elastic Beanstalk into any CI / CD tool, using the
|
||||
Elastic Beanstalk maven plugin instead of the CLI, etc. There is a
|
||||
https://exampledriven.wordpress.com/2017/01/09/spring-boot-aws-elastic-beanstalk-example/[blog]
|
||||
covering these topics more in detail.
|
||||
|
||||
|
||||
|
||||
[[cloud-deployment-boxfuse]]
|
||||
=== Boxfuse and Amazon Web Services
|
||||
https://boxfuse.com/[Boxfuse] works by turning your Spring Boot executable jar or war
|
||||
into a minimal VM image that can be deployed unchanged either on VirtualBox or on AWS.
|
||||
Boxfuse comes with deep integration for Spring Boot and will use the information from your
|
||||
Spring Boot configuration file to automatically configure ports and health check URLs.
|
||||
Boxfuse leverages this information both for the images it produces as well as for all the
|
||||
resources it provisions (instances, security groups, elastic load balancers, etc).
|
||||
|
||||
Once you have created a https://console.boxfuse.com[Boxfuse account], connected it to your
|
||||
AWS account, and installed the latest version of the Boxfuse Client, you can deploy your
|
||||
Spring Boot application to AWS as follows (ensure the application has been built by
|
||||
Maven or Gradle first using, for example, `mvn clean package`):
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ boxfuse run myapp-1.0.jar -env=prod
|
||||
----
|
||||
|
||||
See the https://boxfuse.com/docs/commandline/run.html[`boxfuse run` documentation] for
|
||||
more options. If there is a https://boxfuse.com/docs/commandline/#configuration
|
||||
[`boxfuse.conf`] file present in the current directory, it will be consulted.
|
||||
|
||||
TIP: By default Boxfuse will activate a Spring profile named `boxfuse` on startup and if
|
||||
your executable jar or war contains an
|
||||
https://boxfuse.com/docs/payloads/springboot.html#configuration
|
||||
[`application-boxfuse.properties`]
|
||||
file, Boxfuse will base its configuration based on the properties it contains.
|
||||
|
||||
At this point `boxfuse` will create an image for your application, upload it,
|
||||
and then configure and start the necessary resources on AWS:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
Fusing Image for myapp-1.0.jar ...
|
||||
Image fused in 00:06.838s (53937 K) -> axelfontaine/myapp:1.0
|
||||
Creating axelfontaine/myapp ...
|
||||
Pushing axelfontaine/myapp:1.0 ...
|
||||
Verifying axelfontaine/myapp:1.0 ...
|
||||
Creating Elastic IP ...
|
||||
Mapping myapp-axelfontaine.boxfuse.io to 52.28.233.167 ...
|
||||
Waiting for AWS to create an AMI for axelfontaine/myapp:1.0 in eu-central-1 (this may take up to 50 seconds) ...
|
||||
AMI created in 00:23.557s -> ami-d23f38cf
|
||||
Creating security group boxfuse-sg_axelfontaine/myapp:1.0 ...
|
||||
Launching t2.micro instance of axelfontaine/myapp:1.0 (ami-d23f38cf) in eu-central-1 ...
|
||||
Instance launched in 00:30.306s -> i-92ef9f53
|
||||
Waiting for AWS to boot Instance i-92ef9f53 and Payload to start at http://52.28.235.61/ ...
|
||||
Payload started in 00:29.266s -> http://52.28.235.61/
|
||||
Remapping Elastic IP 52.28.233.167 to i-92ef9f53 ...
|
||||
Waiting 15s for AWS to complete Elastic IP Zero Downtime transition ...
|
||||
Deployment completed successfully. axelfontaine/myapp:1.0 is up and running at http://myapp-axelfontaine.boxfuse.io/
|
||||
----
|
||||
|
||||
Your application should now be up and running on AWS.
|
||||
|
||||
There's a blog on https://boxfuse.com/blog/spring-boot-ec2.html[deploying Spring Boot apps
|
||||
on EC2] as well as https://boxfuse.com/docs/payloads/springboot.html[documentation
|
||||
for the Boxfuse Spring Boot integration] on their website that will get you started with a
|
||||
Maven build to run the app.
|
||||
|
||||
|
||||
|
||||
[[cloud-deployment-gae]]
|
||||
=== Google Cloud
|
||||
Google Cloud has several options that could be used to launch Spring Boot applications.
|
||||
The easiest to get started with is probably App Engine, but you could also find ways to
|
||||
run Spring Boot in a container with Container Engine, or on a virtual machine using
|
||||
Compute Engine.
|
||||
|
||||
To run in App Engine you can create a project in the UI first, which sets up a unique
|
||||
identifier for you and also HTTP routes. Add a Java app to the project and leave it empty,
|
||||
then use the https://cloud.google.com/sdk/downloads[Google Cloud SDK] to push your
|
||||
Spring Boot app into that slot from the command line or CI build.
|
||||
|
||||
App Engine needs you to create an `app.yaml` file to describe the resources your app
|
||||
requires. Normally you put this in `src/main/appengine`, and it looks something like this:
|
||||
|
||||
[source,yaml,indent=0]
|
||||
----
|
||||
service: default
|
||||
|
||||
runtime: java
|
||||
env: flex
|
||||
|
||||
runtime_config:
|
||||
jdk: openjdk8
|
||||
|
||||
handlers:
|
||||
- url: /.*
|
||||
script: this field is required, but ignored
|
||||
|
||||
manual_scaling:
|
||||
instances: 1
|
||||
|
||||
health_check:
|
||||
enable_health_check: False
|
||||
|
||||
env_variables:
|
||||
ENCRYPT_KEY: your_encryption_key_here
|
||||
----
|
||||
|
||||
You can deploy the app, for example, with a Maven plugin by simply adding the project ID
|
||||
to the build configuration:
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
<plugin>
|
||||
<groupId>com.google.cloud.tools</groupId>
|
||||
<artifactId>appengine-maven-plugin</artifactId>
|
||||
<version>1.3.0</version>
|
||||
<configuration>
|
||||
<project>myproject</project>
|
||||
</configuration>
|
||||
</plugin>
|
||||
----
|
||||
|
||||
Then deploy with `mvn appengine:deploy` (if you need to authenticate first the build will
|
||||
fail).
|
||||
|
||||
NOTE: Google App Engine Classic is tied to the Servlet 2.5 API, so you can't deploy a
|
||||
Spring Application there without some modifications. See the
|
||||
<<howto.adoc#howto-servlet-2-5, Servlet 2.5 section>> of this guide.
|
||||
|
||||
|
||||
|
||||
[[deployment-install]]
|
||||
== Installing Spring Boot applications
|
||||
In additional to running Spring Boot applications using `java -jar` it is also possible
|
||||
to make fully executable applications for Unix systems. A fully executable jar can be
|
||||
executed like any other executable binary or it can be <<deployment-service,registered
|
||||
with `init.d` or `systemd`>>. This makes it very easy to install and manage Spring Boot
|
||||
applications in common production environments.
|
||||
|
||||
WARNING: Fully executable jars work by embedding an extra script at the front of the
|
||||
file. Currently, some tools do not accept this format so you may not always be able to
|
||||
use this technique. For example, `jar -xf` may silently fail to extract a jar or war that
|
||||
has been made fully-executable. It is recommended that you only make your jar or war
|
||||
fully executable if you intend to execute it directly, rather than running it with
|
||||
`java -jar` or deploying it to a servlet container.
|
||||
|
||||
To create a '`fully executable`' jar with Maven use the following plugin configuration:
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<executable>true</executable>
|
||||
</configuration>
|
||||
</plugin>
|
||||
----
|
||||
|
||||
With Gradle, the equivalent configuration is:
|
||||
|
||||
[source,groovy,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
bootJar {
|
||||
launchScript()
|
||||
}
|
||||
----
|
||||
|
||||
You can then run your application by typing `./my-application.jar` (where
|
||||
`my-application` is the name of your artifact). The directory containing the
|
||||
jar will be used as your application's working directory.
|
||||
|
||||
[[deployment-install-supported-operating-systems]]
|
||||
=== Supported operating systems
|
||||
The default script supports most Linux distributions and is tested on CentOS and
|
||||
Ubuntu. Other platforms, such as OS X and FreeBSD, will require the use of a custom
|
||||
`embeddedLaunchScript`.
|
||||
|
||||
|
||||
|
||||
[[deployment-service]]
|
||||
=== Unix/Linux services
|
||||
Spring Boot application can be easily started as Unix/Linux services using either `init.d`
|
||||
or `systemd`.
|
||||
|
||||
|
||||
[[deployment-initd-service]]
|
||||
==== Installation as an init.d service (System V)
|
||||
If you've configured Spring Boot's Maven or Gradle plugin to generate a
|
||||
<<deployment-install,fully executable jar>>, and you're not using a custom
|
||||
`embeddedLaunchScript`, then your application can be used as an `init.d` service. Simply
|
||||
symlink the jar to `init.d` to support the standard `start`, `stop`, `restart` and
|
||||
`status` commands.
|
||||
|
||||
The script supports the following features:
|
||||
|
||||
* Starts the services as the user that owns the jar file
|
||||
* Tracks application's PID using `/var/run/<appname>/<appname>.pid`
|
||||
* Writes console logs to `/var/log/<appname>.log`
|
||||
|
||||
Assuming that you have a Spring Boot application installed in `/var/myapp`, to install a
|
||||
Spring Boot application as an `init.d` service simply create a symlink:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ sudo ln -s /var/myapp/myapp.jar /etc/init.d/myapp
|
||||
----
|
||||
|
||||
Once installed, you can start and stop the service in the usual way. For example, on a
|
||||
Debian based system:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ service myapp start
|
||||
----
|
||||
|
||||
TIP: If your application fails to start, check the log file written to
|
||||
`/var/log/<appname>.log` for errors.
|
||||
|
||||
You can also flag the application to start automatically using your standard operating
|
||||
system tools. For example, on Debian:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ update-rc.d myapp defaults <priority>
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[deployment-initd-service-securing]]
|
||||
===== Securing an init.d service
|
||||
|
||||
NOTE: The following is a set of guidelines on how to secure a Spring Boot application
|
||||
that's being run as an init.d service. It is not intended to be an exhaustive list of
|
||||
everything that should be done to harden an application and the environment in which it
|
||||
runs.
|
||||
|
||||
When executed as root, as is the case when root is being used to start an init.d service,
|
||||
the default executable script will run the application as the user which owns the jar
|
||||
file. You should never run a Spring Boot application as `root` so your application's jar
|
||||
file should never be owned by root. Instead, create a specific user to run your
|
||||
application and use `chown` to make it the owner of the jar file. For example:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ chown bootapp:bootapp your-app.jar
|
||||
----
|
||||
|
||||
In this case, the default executable script will run the application as the `bootapp`
|
||||
user.
|
||||
|
||||
TIP: To reduce the chances of the application's user account being compromised, you should
|
||||
consider preventing it from using a login shell. Set the account's shell to
|
||||
`/usr/sbin/nologin`, for example.
|
||||
|
||||
You should also take steps to prevent the modification of your application's jar file.
|
||||
Firstly, configure its permissions so that it cannot be written and can only be read or
|
||||
executed by its owner:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ chmod 500 your-app.jar
|
||||
----
|
||||
|
||||
Secondly, you should also take steps to limit the damage if your application or the
|
||||
account that's running it is compromised. If an attacker does gain access, they could make
|
||||
the jar file writable and change its contents. One way to protect against this is to make
|
||||
it immutable using `chattr`:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ sudo chattr +i your-app.jar
|
||||
----
|
||||
|
||||
This will prevent any user, including root, from modifying the jar.
|
||||
|
||||
If root is used to control the application's service and you
|
||||
<<deployment-script-customization-conf-file, use a `.conf` file>> to customize its
|
||||
startup, the `.conf` file will be read and evaluated by the root user. It should be
|
||||
secured accordingly. Use `chmod` so that the file can only be read by the owner and use
|
||||
`chown` to make root the owner:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ chmod 400 your-app.conf
|
||||
$ sudo chown root:root your-app.conf
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[deployment-systemd-service]]
|
||||
==== Installation as a systemd service
|
||||
Systemd is the successor of the System V init system, and is now being used by many modern
|
||||
Linux distributions. Although you can continue to use `init.d` scripts with `systemd`, it
|
||||
is also possible to launch Spring Boot applications using `systemd` '`service`' scripts.
|
||||
|
||||
Assuming that you have a Spring Boot application installed in `/var/myapp`, to install a
|
||||
Spring Boot application as a `systemd` service create a script named `myapp.service` using
|
||||
the following example and place it in `/etc/systemd/system` directory:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
[Unit]
|
||||
Description=myapp
|
||||
After=syslog.target
|
||||
|
||||
[Service]
|
||||
User=myapp
|
||||
ExecStart=/var/myapp/myapp.jar
|
||||
SuccessExitStatus=143
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
----
|
||||
|
||||
TIP: Remember to change the `Description`, `User` and `ExecStart` fields for your
|
||||
application.
|
||||
|
||||
TIP: Note that `ExecStart` field does not declare the script action command, which means
|
||||
that `run` command is used by default.
|
||||
|
||||
Note that unlike when running as an `init.d` service, user that runs the application, PID
|
||||
file and console log file are managed by `systemd` itself and therefore must be configured
|
||||
using appropriate fields in '`service`' script. Consult the
|
||||
http://www.freedesktop.org/software/systemd/man/systemd.service.html[service unit
|
||||
configuration man page] for more details.
|
||||
|
||||
To flag the application to start automatically on system boot use the following command:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ systemctl enable myapp.service
|
||||
----
|
||||
|
||||
Refer to `man systemctl` for more details.
|
||||
|
||||
|
||||
|
||||
[[deployment-script-customization]]
|
||||
==== Customizing the startup script
|
||||
The default embedded startup script written by the Maven or Gradle plugin can be
|
||||
customized in a number of ways. For most people, using the default script along with
|
||||
a few customizations is usually enough. If you find you can't customize something that
|
||||
you need to, you can always use the `embeddedLaunchScript` option to write your own
|
||||
file entirely.
|
||||
|
||||
|
||||
|
||||
[[deployment-script-customization-when-it-written]]
|
||||
===== Customizing script when it's written
|
||||
It often makes sense to customize elements of the start script as it's written into the
|
||||
jar file. For example, init.d scripts can provide a "`description`" and, since you know
|
||||
this up front (and it won't change), you may as well provide it when the jar is generated.
|
||||
|
||||
To customize written elements, use the `embeddedLaunchScriptProperties` option of the
|
||||
Spring Boot Maven or Gradle plugins.
|
||||
|
||||
The following property substitutions are supported with the default script:
|
||||
|
||||
[cols="1,6"]
|
||||
|===
|
||||
|Name |Description
|
||||
|
||||
|`mode`
|
||||
|The script mode. Defaults to `auto`.
|
||||
|
||||
|`initInfoProvides`
|
||||
|The `Provides` section of "`INIT INFO`". Defaults to `spring-boot-application` for Gradle
|
||||
and to `${project.artifactId}` for Maven.
|
||||
|
||||
|`initInfoRequiredStart`
|
||||
|The `Required-Start` section of "`INIT INFO`". Defaults to `$remote_fs $syslog $network`.
|
||||
|
||||
|`initInfoRequiredStop`
|
||||
|The `Required-Stop` section of "`INIT INFO`". Defaults to `$remote_fs $syslog $network`.
|
||||
|
||||
|
||||
|`initInfoDefaultStart`
|
||||
|The `Default-Start` section of "`INIT INFO`". Defaults to `2 3 4 5`.
|
||||
|
||||
|`initInfoDefaultStop`
|
||||
|The `Default-Stop` section of "`INIT INFO`". Defaults to `0 1 6`.
|
||||
|
||||
|`initInfoShortDescription`
|
||||
|The `Short-Description` section of "`INIT INFO`". Defaults to `Spring Boot Application`
|
||||
for Gradle and to `${project.name}` for Maven.
|
||||
|
||||
|`initInfoDescription`
|
||||
|The `Description` section of "`INIT INFO`". Defaults to `Spring Boot Application` for
|
||||
Gradle and to `${project.description}` (falling back to `${project.name}`) for Maven.
|
||||
|
||||
|`initInfoChkconfig`
|
||||
|The `chkconfig` section of "`INIT INFO`". Defaults to `2345 99 01`.
|
||||
|
||||
|`confFolder`
|
||||
|The default value for `CONF_FOLDER`. Defaults to the folder containing the jar.
|
||||
|
||||
|`inlinedConfScript`
|
||||
|Reference to a file script that should be inlined in the default launch script.
|
||||
This can be used to set environmental variables such as `JAVA_OPTS` before
|
||||
any external config files are loaded.
|
||||
|
||||
|`logFolder`
|
||||
|The default value for `LOG_FOLDER`. Only valid for an `init.d` service.
|
||||
|
||||
|`logFilename`
|
||||
|The default value for `LOG_FILENAME`. Only valid for an `init.d` service.
|
||||
|
||||
|`pidFolder`
|
||||
|The default value for `PID_FOLDER`. Only valid for an `init.d` service.
|
||||
|
||||
|`pidFilename`
|
||||
|The default value for the name of the pid file in `PID_FOLDER`. Only valid for an
|
||||
`init.d` service.
|
||||
|
||||
|`useStartStopDaemon`
|
||||
|If the `start-stop-daemon` command, when it's available, should be used to control the
|
||||
process. Defaults to `true`.
|
||||
|
||||
|`stopWaitTime`
|
||||
|The default value for `STOP_WAIT_TIME`. Only valid for an `init.d` service.
|
||||
Defaults to 60 seconds.
|
||||
|===
|
||||
|
||||
|
||||
[[deployment-script-customization-when-it-runs]]
|
||||
===== Customizing script when it runs
|
||||
For items of the script that need to be customized _after_ the jar has been written you
|
||||
can use environment variables or a
|
||||
<<deployment-script-customization-conf-file, config file>>.
|
||||
|
||||
The following environment properties are supported with the default script:
|
||||
|
||||
[cols="1,6"]
|
||||
|===
|
||||
|Variable |Description
|
||||
|
||||
|`MODE`
|
||||
|The "`mode`" of operation. The default depends on the way the jar was built, but will
|
||||
usually be `auto` _(meaning it tries to guess if it is an init script by checking if it
|
||||
is a symlink in a directory called `init.d`)_. You can explicitly set it to `service` so
|
||||
that the `stop\|start\|status\|restart` commands work, or to `run` if you just want to
|
||||
run the script in the foreground.
|
||||
|
||||
|`USE_START_STOP_DAEMON`
|
||||
|If the `start-stop-daemon` command, when it's available, should be used to control the
|
||||
process. Defaults to `true`.
|
||||
|
||||
|`PID_FOLDER`
|
||||
|The root name of the pid folder (`/var/run` by default).
|
||||
|
||||
|`LOG_FOLDER`
|
||||
|The name of the folder to put log files in (`/var/log` by default).
|
||||
|
||||
|`CONF_FOLDER`
|
||||
|The name of the folder to read .conf files from (same folder as jar-file by default).
|
||||
|
||||
|`LOG_FILENAME`
|
||||
|The name of the log file in the `LOG_FOLDER` (`<appname>.log` by default).
|
||||
|
||||
|`APP_NAME`
|
||||
|The name of the app. If the jar is run from a symlink the script guesses the app name,
|
||||
but if it is not a symlink, or you want to explicitly set the app name this can be
|
||||
useful.
|
||||
|
||||
|`RUN_ARGS`
|
||||
|The arguments to pass to the program (the Spring Boot app).
|
||||
|
||||
|`JAVA_HOME`
|
||||
|The location of the `java` executable is discovered by using the `PATH` by default, but
|
||||
you can set it explicitly if there is an executable file at `$JAVA_HOME/bin/java`.
|
||||
|
||||
|`JAVA_OPTS`
|
||||
|Options that are passed to the JVM when it is launched.
|
||||
|
||||
|`JARFILE`
|
||||
|The explicit location of the jar file, in case the script is being used to launch a jar
|
||||
that it is not actually embedded in.
|
||||
|
||||
|`DEBUG`
|
||||
|if not empty will set the `-x` flag on the shell process, making it easy to see the logic
|
||||
in the script.
|
||||
|
||||
|`STOP_WAIT_TIME`
|
||||
|The time in seconds to wait when stopping the application before forcing a shutdown
|
||||
(`60` by default).
|
||||
|===
|
||||
|
||||
NOTE: The `PID_FOLDER`, `LOG_FOLDER` and `LOG_FILENAME` variables are only valid for an
|
||||
`init.d` service. With `systemd` the equivalent customizations are made using '`service`'
|
||||
script. Check the
|
||||
http://www.freedesktop.org/software/systemd/man/systemd.service.html[service unit
|
||||
configuration man page] for more details.
|
||||
|
||||
[[deployment-script-customization-conf-file]]
|
||||
With the exception of `JARFILE` and `APP_NAME`, the above settings can be configured using
|
||||
a `.conf` file. The file is expected next to the jar file and have the same name but
|
||||
suffixed with `.conf` rather than `.jar`. For example, a jar named `/var/myapp/myapp.jar`
|
||||
will use the configuration file named `/var/myapp/myapp.conf`.
|
||||
|
||||
.myapp.conf
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
JAVA_OPTS=-Xmx1024M
|
||||
LOG_FOLDER=/custom/log/folder
|
||||
----
|
||||
|
||||
TIP: You can use a `CONF_FOLDER` environment variable to customize the location of the
|
||||
config file if you don't like it living next to the jar.
|
||||
|
||||
To learn about securing this file appropriately, please refer to
|
||||
<<deployment-initd-service-securing,the guidelines for securing an init.d service>>.
|
||||
|
||||
|
||||
[[deployment-windows]]
|
||||
=== Microsoft Windows services
|
||||
Spring Boot application can be started as Windows service using
|
||||
https://github.com/kohsuke/winsw[`winsw`].
|
||||
|
||||
A sample https://github.com/snicoll-scratches/spring-boot-daemon[maintained separately]
|
||||
to the core of Spring Boot describes step-by-step how you can create a Windows service for
|
||||
your Spring Boot application.
|
||||
|
||||
|
||||
|
||||
[[deployment-whats-next]]
|
||||
== What to read next
|
||||
Check out the http://www.cloudfoundry.com/[Cloud Foundry],
|
||||
https://www.heroku.com/[Heroku], https://www.openshift.com[OpenShift] and
|
||||
https://boxfuse.com[Boxfuse] web sites for more information about the kinds of features
|
||||
that a PaaS can offer. These are just four of the most popular Java PaaS providers, since
|
||||
Spring Boot is so amenable to cloud-based deployment you're free to consider other
|
||||
providers as well.
|
||||
|
||||
The next section goes on to cover the _<<spring-boot-cli.adoc#cli, Spring Boot CLI>>_;
|
||||
or you can jump ahead to read about
|
||||
_<<build-tool-plugins.adoc#build-tool-plugins, build tool plugins>>_.
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
[[boot-documentation]]
|
||||
= Spring Boot Documentation
|
||||
|
||||
[partintro]
|
||||
--
|
||||
This section provides a brief overview of Spring Boot reference documentation. Think of
|
||||
it as map for the rest of the document. You can read this reference guide in a linear
|
||||
fashion, or you can skip sections if something doesn't interest you.
|
||||
--
|
||||
|
||||
|
||||
|
||||
[[boot-documentation-about]]
|
||||
== About the documentation
|
||||
The Spring Boot reference guide is available as {spring-boot-docs}/html[html],
|
||||
{spring-boot-docs}/pdf/spring-boot-reference.pdf[pdf]
|
||||
and {spring-boot-docs}/epub/spring-boot-reference.epub[epub] documents. The latest copy
|
||||
is available at {spring-boot-docs-current}.
|
||||
|
||||
Copies of this document may be made for your own use and for
|
||||
distribution to others, provided that you do not charge any fee for such copies and
|
||||
further provided that each copy contains this Copyright Notice, whether distributed in
|
||||
print or electronically.
|
||||
|
||||
|
||||
|
||||
[[boot-documentation-getting-help]]
|
||||
== Getting help
|
||||
Having trouble with Spring Boot, We'd like to help!
|
||||
|
||||
* Try the <<howto.adoc#howto, How-to's>> -- they provide solutions to the most common
|
||||
questions.
|
||||
* Learn the Spring basics -- Spring Boot builds on many other Spring projects, check
|
||||
the http://spring.io[spring.io] web-site for a wealth of reference documentation. If
|
||||
you are just starting out with Spring, try one of the http://spring.io/guides[guides].
|
||||
* Ask a question - we monitor http://stackoverflow.com[stackoverflow.com] for questions
|
||||
tagged with http://stackoverflow.com/tags/spring-boot[`spring-boot`].
|
||||
* Report bugs with Spring Boot at https://github.com/spring-projects/spring-boot/issues.
|
||||
|
||||
NOTE: All of Spring Boot is open source, including the documentation! If you find problems
|
||||
with the docs; or if you just want to improve them, please {github-code}[get involved].
|
||||
|
||||
|
||||
|
||||
[[boot-documentation-first-steps]]
|
||||
== First steps
|
||||
If you're just getting started with Spring Boot, or 'Spring' in general,
|
||||
<<getting-started.adoc#getting-started, this is the place to start!>>
|
||||
|
||||
* *From scratch:*
|
||||
<<getting-started.adoc#getting-started-introducing-spring-boot, Overview>> |
|
||||
<<getting-started.adoc#getting-started-system-requirements, Requirements>> |
|
||||
<<getting-started.adoc#getting-started-installing-spring-boot, Installation>>
|
||||
* *Tutorial:*
|
||||
<<getting-started.adoc#getting-started-first-application, Part 1>> |
|
||||
<<getting-started.adoc#getting-started-first-application-code, Part 2>>
|
||||
* *Running your example:*
|
||||
<<getting-started.adoc#getting-started-first-application-run, Part 1>> |
|
||||
<<getting-started.adoc#getting-started-first-application-executable-jar, Part 2>>
|
||||
|
||||
|
||||
|
||||
== Working with Spring Boot
|
||||
Ready to actually start using Spring Boot? <<using-spring-boot.adoc#using-boot, We've
|
||||
got you covered>>.
|
||||
|
||||
* *Build systems:*
|
||||
<<using-spring-boot.adoc#using-boot-maven, Maven>> |
|
||||
<<using-spring-boot.adoc#using-boot-gradle, Gradle>> |
|
||||
<<using-spring-boot.adoc#using-boot-ant, Ant>> |
|
||||
<<using-spring-boot.adoc#using-boot-starter, Starters>>
|
||||
* *Best practices:*
|
||||
<<using-spring-boot.adoc#using-boot-structuring-your-code, Code Structure>> |
|
||||
<<using-spring-boot.adoc#using-boot-configuration-classes, @Configuration>> |
|
||||
<<using-spring-boot.adoc#using-boot-auto-configuration, @EnableAutoConfiguration>> |
|
||||
<<using-spring-boot.adoc#using-boot-spring-beans-and-dependency-injection, Beans and Dependency Injection>>
|
||||
* *Running your code*
|
||||
<<using-spring-boot.adoc#using-boot-running-from-an-ide, IDE>> |
|
||||
<<using-spring-boot.adoc#using-boot-running-as-a-packaged-application, Packaged>> |
|
||||
<<using-spring-boot.adoc#using-boot-running-with-the-maven-plugin, Maven>> |
|
||||
<<using-spring-boot.adoc#using-boot-running-with-the-gradle-plugin, Gradle>>
|
||||
* *Packaging your app:*
|
||||
<<using-spring-boot.adoc#using-boot-packaging-for-production, Production jars>>
|
||||
* *Spring Boot CLI:*
|
||||
<<using-spring-boot-cli.adoc#cli, Using the CLI>>
|
||||
|
||||
|
||||
|
||||
== Learning about Spring Boot features
|
||||
Need more details about Spring Boot's core features?
|
||||
<<spring-boot-features.adoc#boot-features, This is for you>>!
|
||||
|
||||
* *Core Features:*
|
||||
<<spring-boot-features.adoc#boot-features-spring-application, SpringApplication>> |
|
||||
<<spring-boot-features.adoc#boot-features-external-config, External Configuration>> |
|
||||
<<spring-boot-features.adoc#boot-features-profiles, Profiles>> |
|
||||
<<spring-boot-features.adoc#boot-features-logging, Logging>>
|
||||
* *Web Applications:*
|
||||
<<spring-boot-features.adoc#boot-features-spring-mvc, MVC>> |
|
||||
<<spring-boot-features.adoc#boot-features-embedded-container, Embedded Containers>>
|
||||
* *Working with data:*
|
||||
<<spring-boot-features.adoc#boot-features-sql, SQL>> |
|
||||
<<spring-boot-features.adoc#boot-features-nosql, NO-SQL>>
|
||||
* *Messaging:*
|
||||
<<spring-boot-features.adoc#boot-features-messaging, Overview>> |
|
||||
<<spring-boot-features.adoc#boot-features-jms, JMS>>
|
||||
* *Testing:*
|
||||
<<spring-boot-features.adoc#boot-features-testing, Overview>> |
|
||||
<<spring-boot-features.adoc#boot-features-testing-spring-boot-applications, Boot Applications>> |
|
||||
<<spring-boot-features.adoc#boot-features-test-utilities, Utils>>
|
||||
* *Extending:*
|
||||
<<spring-boot-features.adoc#boot-features-developing-auto-configuration, Auto-configuration>> |
|
||||
<<spring-boot-features.adoc#boot-features-condition-annotations, @Conditions>>
|
||||
|
||||
|
||||
|
||||
== Moving to production
|
||||
When you're ready to push your Spring Boot application to production, we've got
|
||||
<<production-ready-features.adoc#production-ready, some tricks that you might like>>!
|
||||
|
||||
* *Management endpoints:*
|
||||
<<production-ready-features.adoc#production-ready-endpoints, Overview>> |
|
||||
<<production-ready-features.adoc#production-ready-customizing-endpoints, Customization>>
|
||||
* *Connection options:*
|
||||
<<production-ready-features.adoc#production-ready-monitoring, HTTP>> |
|
||||
<<production-ready-features.adoc#production-ready-jmx, JMX>> |
|
||||
* *Monitoring:*
|
||||
<<production-ready-features.adoc#production-ready-metrics, Metrics>> |
|
||||
<<production-ready-features.adoc#production-ready-auditing, Auditing>> |
|
||||
<<production-ready-features.adoc#production-ready-tracing, Tracing>> |
|
||||
<<production-ready-features.adoc#production-ready-process-monitoring, Process>>
|
||||
|
||||
|
||||
|
||||
== Advanced topics
|
||||
Lastly, we have a few topics for the more advanced user.
|
||||
|
||||
* *Deploy Spring Boot Applications:*
|
||||
<<deployment.adoc#cloud-deployment, Cloud Deployment>> |
|
||||
<<deployment.adoc#deployment-service, OS Service>>
|
||||
* *Build tool plugins:*
|
||||
<<build-tool-plugins.adoc#build-tool-plugins-maven-plugin, Maven>> |
|
||||
<<build-tool-plugins.adoc#build-tool-plugins-gradle-plugin, Gradle>>
|
||||
* *Appendix:*
|
||||
<<appendix-application-properties.adoc#common-application-properties, Application Properties>> |
|
||||
<<appendix-auto-configuration-classes.adoc#auto-configuration-classes, Auto-configuration classes>> |
|
||||
<<appendix-executable-jar-format.adoc#executable-jar, Executable Jars>>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,808 @@
|
||||
[[getting-started]]
|
||||
= Getting started
|
||||
|
||||
[partintro]
|
||||
--
|
||||
If you're just getting started with Spring Boot, or 'Spring' in general, this is the section
|
||||
for you! Here we answer the basic "`what?`", "`how?`" and "`why?`" questions. You'll
|
||||
find a gentle introduction to Spring Boot along with installation instructions.
|
||||
We'll then build our first Spring Boot application, discussing some core principles as
|
||||
we go.
|
||||
--
|
||||
|
||||
|
||||
[[getting-started-introducing-spring-boot]]
|
||||
== Introducing Spring Boot
|
||||
Spring Boot makes it easy to create stand-alone, production-grade Spring based
|
||||
Applications that you can "`just run`". We take an opinionated view of the Spring
|
||||
platform and third-party libraries so you can get started with minimum fuss. Most Spring
|
||||
Boot applications need very little Spring configuration.
|
||||
|
||||
You can use Spring Boot to create Java applications that can be started using `java -jar`
|
||||
or more traditional war deployments. We also provide a command line tool that runs
|
||||
"`spring scripts`".
|
||||
|
||||
Our primary goals are:
|
||||
|
||||
* Provide a radically faster and widely accessible getting started experience for all
|
||||
Spring development.
|
||||
* Be opinionated out of the box, but get out of the way quickly as requirements start to
|
||||
diverge from the defaults.
|
||||
* Provide a range of non-functional features that are common to large classes of projects
|
||||
(e.g. embedded servers, security, metrics, health checks, externalized configuration).
|
||||
* Absolutely no code generation and no requirement for XML configuration.
|
||||
|
||||
|
||||
|
||||
[[getting-started-system-requirements]]
|
||||
== System Requirements
|
||||
Spring Boot {spring-boot-version} requires http://www.java.com[Java 8] and Spring
|
||||
Framework {spring-version} or above. Explicit build support is provided for Maven
|
||||
(3.2+), and Gradle 4.
|
||||
|
||||
|
||||
[[getting-started-system-requirements-servlet-containers]]
|
||||
=== Servlet containers
|
||||
The following embedded servlet containers are supported out of the box:
|
||||
|
||||
|===
|
||||
|Name |Servlet Version
|
||||
|
||||
|Tomcat 8.5
|
||||
|3.1
|
||||
|
||||
|Jetty 9.4
|
||||
|3.1
|
||||
|
||||
|Undertow 1.3
|
||||
|3.1
|
||||
|===
|
||||
|
||||
You can also deploy Spring Boot applications to any Servlet 3.0+ compatible container.
|
||||
|
||||
|
||||
|
||||
[[getting-started-installing-spring-boot]]
|
||||
== Installing Spring Boot
|
||||
Spring Boot can be used with "`classic`" Java development tools or installed as a command
|
||||
line tool. Regardless, you will need http://www.java.com[Java SDK v1.8] or higher. You
|
||||
should check your current Java installation before you begin:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ java -version
|
||||
----
|
||||
|
||||
If you are new to Java development, or if you just want to experiment with Spring Boot
|
||||
you might want to try the <<getting-started-installing-the-cli, Spring Boot CLI>> first,
|
||||
otherwise, read on for "`classic`" installation instructions.
|
||||
|
||||
|
||||
|
||||
[[getting-started-installation-instructions-for-java]]
|
||||
=== Installation instructions for the Java developer
|
||||
You can use Spring Boot in the same way as any standard Java library. Simply include the
|
||||
appropriate `+spring-boot-*.jar+` files on your classpath. Spring Boot does not require
|
||||
any special tools integration, so you can use any IDE or text editor; and there is
|
||||
nothing special about a Spring Boot application, so you can run and debug as you would
|
||||
any other Java program.
|
||||
|
||||
Although you _could_ just copy Spring Boot jars, we generally recommend that you use a
|
||||
build tool that supports dependency management (such as Maven or Gradle).
|
||||
|
||||
|
||||
|
||||
[[getting-started-maven-installation]]
|
||||
==== Maven installation
|
||||
Spring Boot is compatible with Apache Maven 3.2 or above. If you don't already have Maven
|
||||
installed you can follow the instructions at http://maven.apache.org.
|
||||
|
||||
TIP: On many operating systems Maven can be installed via a package manager. If you're an
|
||||
OSX Homebrew user try `brew install maven`. Ubuntu users can run
|
||||
`sudo apt-get install maven`. Windows users with Chocolatey can run `choco install maven`
|
||||
from an elevated prompt.
|
||||
|
||||
Spring Boot dependencies use the `org.springframework.boot` `groupId`. Typically your
|
||||
Maven POM file will inherit from the `spring-boot-starter-parent` project and declare
|
||||
dependencies to one or more <<using-spring-boot.adoc#using-boot-starter,
|
||||
"`Starters`">>. Spring Boot also provides an optional
|
||||
<<build-tool-plugins.adoc#build-tool-plugins-maven-plugin, Maven plugin>> to create
|
||||
executable jars.
|
||||
|
||||
Here is a typical `pom.xml` file:
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>myproject</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
||||
<!-- Inherit defaults from Spring Boot -->
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>{spring-boot-version}</version>
|
||||
</parent>
|
||||
|
||||
<!-- Add typical dependencies for a web application -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- Package as an executable jar -->
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
ifeval::["{spring-boot-repo}" != "release"]
|
||||
<!-- Add Spring repositories -->
|
||||
<!-- (you don't need this if you are using a .RELEASE version) -->
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<url>http://repo.spring.io/snapshot</url>
|
||||
<snapshots><enabled>true</enabled></snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<url>http://repo.spring.io/milestone</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>spring-snapshots</id>
|
||||
<url>http://repo.spring.io/snapshot</url>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>spring-milestones</id>
|
||||
<url>http://repo.spring.io/milestone</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
endif::[]
|
||||
</project>
|
||||
----
|
||||
|
||||
TIP: The `spring-boot-starter-parent` is a great way to use Spring Boot, but it might
|
||||
not be suitable all of the time. Sometimes you may need to inherit from a different
|
||||
parent POM, or you might just not like our default settings. See
|
||||
<<using-boot-maven-without-a-parent>> for an alternative solution that uses an `import`
|
||||
scope.
|
||||
|
||||
|
||||
|
||||
[[getting-started-gradle-installation]]
|
||||
==== Gradle installation
|
||||
Spring Boot is compatible with Gradle 4. If you don't already have Gradle installed you
|
||||
can follow the instructions at http://www.gradle.org/.
|
||||
|
||||
Spring Boot dependencies can be declared using the `org.springframework.boot` `group`.
|
||||
Typically your project will declare dependencies to one or more
|
||||
<<using-spring-boot.adoc#using-boot-starter, "`Starters`">>. Spring Boot
|
||||
provides a useful <<build-tool-plugins.adoc#build-tool-plugins-gradle-plugin, Gradle plugin>>
|
||||
that can be used to simplify dependency declarations and to create executable jars.
|
||||
|
||||
.Gradle Wrapper
|
||||
****
|
||||
The Gradle Wrapper provides a nice way of "`obtaining`" Gradle when you need to build a
|
||||
project. It's a small script and library that you commit alongside your code to bootstrap
|
||||
the build process. See {gradle-user-guide}/gradle_wrapper.html for details.
|
||||
****
|
||||
|
||||
Here is a typical `build.gradle` file:
|
||||
|
||||
[source,groovy,indent=0,subs="verbatim,attributes"]
|
||||
----
|
||||
ifeval::["{spring-boot-repo}" == "release"]
|
||||
plugins {
|
||||
id 'org.springframework.boot' version '{spring-boot-version}'
|
||||
id 'java'
|
||||
}
|
||||
endif::[]
|
||||
ifeval::["{spring-boot-repo}" != "release"]
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven { url 'http://repo.spring.io/snapshot' }
|
||||
maven { url 'http://repo.spring.io/milestone' }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.springframework.boot:spring-boot-gradle-plugin:{spring-boot-version}'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'org.springframework.boot'
|
||||
apply plugin: 'io.spring.dependency-management'
|
||||
|
||||
endif::[]
|
||||
jar {
|
||||
baseName = 'myproject'
|
||||
version = '0.0.1-SNAPSHOT'
|
||||
}
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
ifeval::["{spring-boot-repo}" != "release"]
|
||||
maven { url "http://repo.spring.io/snapshot" }
|
||||
maven { url "http://repo.spring.io/milestone" }
|
||||
endif::[]
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile("org.springframework.boot:spring-boot-starter-web")
|
||||
testCompile("org.springframework.boot:spring-boot-starter-test")
|
||||
}
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[getting-started-installing-the-cli]]
|
||||
=== Installing the Spring Boot CLI
|
||||
The Spring Boot CLI is a command line tool that can be used if you want to quickly
|
||||
prototype with Spring. It allows you to run http://groovy.codehaus.org/[Groovy] scripts,
|
||||
which means that you have a familiar Java-like syntax, without so much boilerplate code.
|
||||
|
||||
You don't need to use the CLI to work with Spring Boot but it's definitely the quickest
|
||||
way to get a Spring application off the ground.
|
||||
|
||||
|
||||
|
||||
[[getting-started-manual-cli-installation]]
|
||||
==== Manual installation
|
||||
You can download the Spring CLI distribution from the Spring software repository:
|
||||
|
||||
* http://repo.spring.io/{spring-boot-repo}/org/springframework/boot/spring-boot-cli/{spring-boot-version}/spring-boot-cli-{spring-boot-version}-bin.zip[spring-boot-cli-{spring-boot-version}-bin.zip]
|
||||
* http://repo.spring.io/{spring-boot-repo}/org/springframework/boot/spring-boot-cli/{spring-boot-version}/spring-boot-cli-{spring-boot-version}-bin.tar.gz[spring-boot-cli-{spring-boot-version}-bin.tar.gz]
|
||||
|
||||
Cutting edge http://repo.spring.io/snapshot/org/springframework/boot/spring-boot-cli/[snapshot distributions]
|
||||
are also available.
|
||||
|
||||
Once downloaded, follow the {github-raw}/spring-boot-cli/src/main/content/INSTALL.txt[INSTALL.txt]
|
||||
instructions from the unpacked archive. In summary: there is a `spring` script
|
||||
(`spring.bat` for Windows) in a `bin/` directory in the `.zip` file, or alternatively you
|
||||
can use `java -jar` with the `.jar` file (the script helps you to be sure that the
|
||||
classpath is set correctly).
|
||||
|
||||
|
||||
|
||||
[[getting-started-sdkman-cli-installation]]
|
||||
==== Installation with SDKMAN!
|
||||
SDKMAN! (The Software Development Kit Manager) can be used for managing multiple versions of
|
||||
various binary SDKs, including Groovy and the Spring Boot CLI.
|
||||
Get SDKMAN! from http://sdkman.io and install Spring Boot with
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ sdk install springboot
|
||||
$ spring --version
|
||||
Spring Boot v{spring-boot-version}
|
||||
----
|
||||
|
||||
If you are developing features for the CLI and want easy access to the version you just
|
||||
built, follow these extra instructions.
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ sdk install springboot dev /path/to/spring-boot/spring-boot-cli/target/spring-boot-cli-{spring-boot-version}-bin/spring-{spring-boot-version}/
|
||||
$ sdk default springboot dev
|
||||
$ spring --version
|
||||
Spring CLI v{spring-boot-version}
|
||||
----
|
||||
|
||||
This will install a local instance of `spring` called the `dev` instance.
|
||||
It points at your target build location, so every time you rebuild Spring
|
||||
Boot, `spring` will be up-to-date.
|
||||
|
||||
You can see it by doing this:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ sdk ls springboot
|
||||
|
||||
================================================================================
|
||||
Available Springboot Versions
|
||||
================================================================================
|
||||
> + dev
|
||||
* {spring-boot-version}
|
||||
|
||||
================================================================================
|
||||
+ - local version
|
||||
* - installed
|
||||
> - currently in use
|
||||
================================================================================
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[getting-started-homebrew-cli-installation]]
|
||||
==== OSX Homebrew installation
|
||||
If you are on a Mac and using http://brew.sh/[Homebrew], all you need to do to install
|
||||
the Spring Boot CLI is:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ brew tap pivotal/tap
|
||||
$ brew install springboot
|
||||
----
|
||||
|
||||
Homebrew will install `spring` to `/usr/local/bin`.
|
||||
|
||||
NOTE: If you don't see the formula, your installation of brew might be out-of-date.
|
||||
Just execute `brew update` and try again.
|
||||
|
||||
|
||||
|
||||
[[getting-started-macports-cli-installation]]
|
||||
==== MacPorts installation
|
||||
If you are on a Mac and using http://www.macports.org/[MacPorts], all you need to do to
|
||||
install the Spring Boot CLI is:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ sudo port install spring-boot-cli
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[getting-started-cli-command-line-completion]]
|
||||
==== Command-line completion
|
||||
Spring Boot CLI ships with scripts that provide command completion for
|
||||
http://en.wikipedia.org/wiki/Bash_%28Unix_shell%29[BASH] and
|
||||
http://en.wikipedia.org/wiki/Zsh[zsh] shells. You can `source` the script (also named
|
||||
`spring`) in any shell, or put it in your personal or system-wide bash completion
|
||||
initialization. On a Debian system the system-wide scripts are in `/shell-completion/bash`
|
||||
and all scripts in that directory are executed when a new shell starts. To run the script
|
||||
manually, e.g. if you have installed using SDKMAN!
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ . ~/.sdkman/candidates/springboot/current/shell-completion/bash/spring
|
||||
$ spring <HIT TAB HERE>
|
||||
grab help jar run test version
|
||||
----
|
||||
|
||||
NOTE: If you install Spring Boot CLI using Homebrew or MacPorts, the command-line
|
||||
completion scripts are automatically registered with your shell.
|
||||
|
||||
|
||||
|
||||
[[getting-started-cli-example]]
|
||||
==== Quick start Spring CLI example
|
||||
Here's a really simple web application that you can use to test your installation. Create
|
||||
a file called `app.groovy`:
|
||||
|
||||
[source,groovy,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
@RestController
|
||||
class ThisWillActuallyRun {
|
||||
|
||||
@RequestMapping("/")
|
||||
String home() {
|
||||
"Hello World!"
|
||||
}
|
||||
|
||||
}
|
||||
----
|
||||
|
||||
Then simply run it from a shell:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ spring run app.groovy
|
||||
----
|
||||
|
||||
NOTE: It will take some time when you first run the application as dependencies are
|
||||
downloaded. Subsequent runs will be much quicker.
|
||||
|
||||
Open http://localhost:8080 in your favorite web browser and you should see the following
|
||||
output:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
Hello World!
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[getting-started-upgrading-from-an-earlier-version]]
|
||||
=== Upgrading from an earlier version of Spring Boot
|
||||
If you are upgrading from an earlier release of Spring Boot check the "`release notes`"
|
||||
hosted on the {github-wiki}[project wiki]. You'll find upgrade instructions along with
|
||||
a list of "`new and noteworthy`" features for each release.
|
||||
|
||||
To upgrade an existing CLI installation use the appropriate package manager command
|
||||
(for example `brew upgrade`) or, if you manually installed the CLI, follow the
|
||||
<<getting-started-manual-cli-installation, standard instructions>> remembering to
|
||||
update your `PATH` environment variable to remove any older references.
|
||||
|
||||
|
||||
|
||||
[[getting-started-first-application]]
|
||||
== Developing your first Spring Boot application
|
||||
Let's develop a simple "`Hello World!`" web application in Java that highlights some
|
||||
of Spring Boot's key features. We'll use Maven to build this project since most IDEs
|
||||
support it.
|
||||
|
||||
[TIP]
|
||||
====
|
||||
The http://spring.io[spring.io] web site contains many "`Getting Started`" guides
|
||||
that use Spring Boot. If you're looking to solve a specific problem; check there first.
|
||||
|
||||
You can shortcut the steps below by going to https://start.spring.io and choosing the
|
||||
`web` starter from the dependencies searcher. This will automatically generate a new
|
||||
project structure so that you can <<getting-started-first-application-code,start coding
|
||||
right away>>. Check the https://github.com/spring-io/initializr[documentation for
|
||||
more details].
|
||||
====
|
||||
|
||||
Before we begin, open a terminal to check that you have valid versions of Java and Maven
|
||||
installed.
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ java -version
|
||||
java version "1.8.0_102"
|
||||
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
|
||||
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
|
||||
----
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ mvn -v
|
||||
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
|
||||
Maven home: /usr/local/Cellar/maven/3.3.9/libexec
|
||||
Java version: 1.8.0_102, vendor: Oracle Corporation
|
||||
----
|
||||
|
||||
NOTE: This sample needs to be created in its own folder. Subsequent instructions assume
|
||||
that you have created a suitable folder and that it is your "`current directory`".
|
||||
|
||||
|
||||
|
||||
[[getting-started-first-application-pom]]
|
||||
=== Creating the POM
|
||||
We need to start by creating a Maven `pom.xml` file. The `pom.xml` is the recipe that
|
||||
will be used to build your project. Open your favorite text editor and add the following:
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>myproject</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>{spring-boot-version}</version>
|
||||
</parent>
|
||||
|
||||
<!-- Additional lines to be added here... -->
|
||||
|
||||
ifeval::["{spring-boot-repo}" != "release"]
|
||||
<!-- (you don't need this if you are using a .RELEASE version) -->
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<url>http://repo.spring.io/snapshot</url>
|
||||
<snapshots><enabled>true</enabled></snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<url>http://repo.spring.io/milestone</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>spring-snapshots</id>
|
||||
<url>http://repo.spring.io/snapshot</url>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>spring-milestones</id>
|
||||
<url>http://repo.spring.io/milestone</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
endif::[]
|
||||
</project>
|
||||
----
|
||||
|
||||
This should give you a working build, you can test it out by running `mvn package` (you
|
||||
can ignore the "`jar will be empty - no content was marked for inclusion!`" warning for
|
||||
now).
|
||||
|
||||
NOTE: At this point you could import the project into an IDE (most modern Java IDE's
|
||||
include built-in support for Maven). For simplicity, we will continue to use a plain
|
||||
text editor for this example.
|
||||
|
||||
|
||||
|
||||
[[getting-started-first-application-dependencies]]
|
||||
=== Adding classpath dependencies
|
||||
Spring Boot provides a number of "`Starters`" that make easy to add jars to your
|
||||
classpath. Our sample application has already used `spring-boot-starter-parent` in the
|
||||
`parent` section of the POM. The `spring-boot-starter-parent` is a special starter
|
||||
that provides useful Maven defaults. It also provides a
|
||||
<<using-spring-boot.adoc#using-boot-dependency-management,`dependency-management`>>
|
||||
section so that you can omit `version` tags for "`blessed`" dependencies.
|
||||
|
||||
Other "`Starters`" simply provide dependencies that you are likely to need when
|
||||
developing a specific type of application. Since we are developing a web application, we
|
||||
will add a `spring-boot-starter-web` dependency -- but before that, let's look at what we
|
||||
currently have.
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ mvn dependency:tree
|
||||
|
||||
[INFO] com.example:myproject:jar:0.0.1-SNAPSHOT
|
||||
----
|
||||
|
||||
The `mvn dependency:tree` command prints a tree representation of your project dependencies.
|
||||
You can see that `spring-boot-starter-parent` provides no
|
||||
dependencies by itself. Let's edit our `pom.xml` and add the `spring-boot-starter-web` dependency
|
||||
just below the `parent` section:
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
----
|
||||
|
||||
If you run `mvn dependency:tree` again, you will see that there are now a number of
|
||||
additional dependencies, including the Tomcat web server and Spring Boot itself.
|
||||
|
||||
|
||||
|
||||
[[getting-started-first-application-code]]
|
||||
=== Writing the code
|
||||
To finish our application we need to create a single Java file. Maven will compile sources
|
||||
from `src/main/java` by default so you need to create that folder structure, then add a
|
||||
file named `src/main/java/Example.java`:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
import org.springframework.boot.*;
|
||||
import org.springframework.boot.autoconfigure.*;
|
||||
import org.springframework.stereotype.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@EnableAutoConfiguration
|
||||
public class Example {
|
||||
|
||||
@RequestMapping("/")
|
||||
String home() {
|
||||
return "Hello World!";
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
SpringApplication.run(Example.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
----
|
||||
|
||||
Although there isn't much code here, quite a lot is going on. Let's step through the
|
||||
important parts.
|
||||
|
||||
|
||||
|
||||
[[getting-started-first-application-annotations]]
|
||||
==== The @RestController and @RequestMapping annotations
|
||||
The first annotation on our `Example` class is `@RestController`. This is known as a
|
||||
_stereotype_ annotation. It provides hints for people reading the code, and for Spring,
|
||||
that the class plays a specific role. In this case, our class is a web `@Controller` so
|
||||
Spring will consider it when handling incoming web requests.
|
||||
|
||||
The `@RequestMapping` annotation provides "`routing`" information. It is telling Spring
|
||||
that any HTTP request with the path "`/`" should be mapped to the `home` method. The
|
||||
`@RestController` annotation tells Spring to render the resulting string directly
|
||||
back to the caller.
|
||||
|
||||
TIP: The `@RestController` and `@RequestMapping` annotations are Spring MVC annotations
|
||||
(they are not specific to Spring Boot). See the {spring-reference}web.html#mvc[MVC section] in
|
||||
the Spring Reference Documentation for more details.
|
||||
|
||||
|
||||
|
||||
[[getting-started-first-application-auto-configuration]]
|
||||
==== The @EnableAutoConfiguration annotation
|
||||
The second class-level annotation is `@EnableAutoConfiguration`. This annotation tells
|
||||
Spring Boot to "`guess`" how you will want to configure Spring, based on the jar
|
||||
dependencies that you have added. Since `spring-boot-starter-web` added Tomcat and
|
||||
Spring MVC, the auto-configuration will assume that you are developing a web application
|
||||
and setup Spring accordingly.
|
||||
|
||||
.Starters and Auto-Configuration
|
||||
****
|
||||
Auto-configuration is designed to work well with "`Starters`", but the two concepts
|
||||
are not directly tied. You are free to pick-and-choose jar dependencies outside of the
|
||||
starters and Spring Boot will still do its best to auto-configure your application.
|
||||
****
|
||||
|
||||
|
||||
|
||||
[[getting-started-first-application-main-method]]
|
||||
==== The "`main`" method
|
||||
The final part of our application is the `main` method. This is just a standard method
|
||||
that follows the Java convention for an application entry point. Our main method delegates
|
||||
to Spring Boot's `SpringApplication` class by calling `run`. `SpringApplication` will
|
||||
bootstrap our application, starting Spring which will in turn start the auto-configured
|
||||
Tomcat web server. We need to pass `Example.class` as an argument to the `run` method to
|
||||
tell `SpringApplication` which is the primary Spring component. The `args` array is also
|
||||
passed through to expose any command-line arguments.
|
||||
|
||||
|
||||
|
||||
[[getting-started-first-application-run]]
|
||||
=== Running the example
|
||||
At this point our application should work. Since we have used the
|
||||
`spring-boot-starter-parent` POM we have a useful `run` goal that we can use to start
|
||||
the application. Type `mvn spring-boot:run` from the root project directory to start the
|
||||
application:
|
||||
|
||||
[indent=0,subs="attributes"]
|
||||
----
|
||||
$ mvn spring-boot:run
|
||||
|
||||
. ____ _ __ _ _
|
||||
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
|
||||
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
|
||||
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
|
||||
' |____| .__|_| |_|_| |_\__, | / / / /
|
||||
=========|_|==============|___/=/_/_/_/
|
||||
:: Spring Boot :: (v{spring-boot-version})
|
||||
....... . . .
|
||||
....... . . . (log output here)
|
||||
....... . . .
|
||||
........ Started Example in 2.222 seconds (JVM running for 6.514)
|
||||
----
|
||||
|
||||
If you open a web browser to http://localhost:8080 you should see the following output:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
Hello World!
|
||||
----
|
||||
|
||||
To gracefully exit the application hit `ctrl-c`.
|
||||
|
||||
|
||||
|
||||
[[getting-started-first-application-executable-jar]]
|
||||
=== Creating an executable jar
|
||||
Let's finish our example by creating a completely self-contained executable jar file that
|
||||
we could run in production. Executable jars (sometimes called "`fat jars`") are archives
|
||||
containing your compiled classes along with all of the jar dependencies that your code
|
||||
needs to run.
|
||||
|
||||
.Executable jars and Java
|
||||
****
|
||||
Java does not provide any standard way to load nested jar files (i.e. jar files that are
|
||||
themselves contained within a jar). This can be problematic if you are looking to
|
||||
distribute a self-contained application.
|
||||
|
||||
To solve this problem, many developers use "`uber`" jars. An uber jar simply packages
|
||||
all classes, from all jars, into a single archive. The problem with this approach is that
|
||||
it becomes hard to see which libraries you are actually using in your application. It can
|
||||
also be problematic if the same filename is used (but with different content) in
|
||||
multiple jars.
|
||||
|
||||
Spring Boot takes a <<appendix-executable-jar-format.adoc#executable-jar, different
|
||||
approach>> and allows you to actually nest jars directly.
|
||||
****
|
||||
|
||||
To create an executable jar we need to add the `spring-boot-maven-plugin` to our
|
||||
`pom.xml`. Insert the following lines just below the `dependencies` section:
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
----
|
||||
|
||||
NOTE: The `spring-boot-starter-parent` POM includes `<executions>` configuration to
|
||||
bind the `repackage` goal. If you are not using the parent POM you will need to declare
|
||||
this configuration yourself. See the {spring-boot-maven-plugin-site}/usage.html[plugin
|
||||
documentation] for details.
|
||||
|
||||
Save your `pom.xml` and run `mvn package` from the command line:
|
||||
|
||||
[indent=0,subs="attributes"]
|
||||
----
|
||||
$ mvn package
|
||||
|
||||
[INFO] Scanning for projects...
|
||||
[INFO]
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] Building myproject 0.0.1-SNAPSHOT
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] .... ..
|
||||
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ myproject ---
|
||||
[INFO] Building jar: /Users/developer/example/spring-boot-example/target/myproject-0.0.1-SNAPSHOT.jar
|
||||
[INFO]
|
||||
[INFO] --- spring-boot-maven-plugin:{spring-boot-version}:repackage (default) @ myproject ---
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] BUILD SUCCESS
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
----
|
||||
|
||||
If you look in the `target` directory you should see `myproject-0.0.1-SNAPSHOT.jar`. The
|
||||
file should be around 10 MB in size. If you want to peek inside, you can use `jar tvf`:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ jar tvf target/myproject-0.0.1-SNAPSHOT.jar
|
||||
----
|
||||
|
||||
You should also see a much smaller file named `myproject-0.0.1-SNAPSHOT.jar.original`
|
||||
in the `target` directory. This is the original jar file that Maven created before it was
|
||||
repackaged by Spring Boot.
|
||||
|
||||
To run that application, use the `java -jar` command:
|
||||
|
||||
[indent=0,subs="attributes"]
|
||||
----
|
||||
$ java -jar target/myproject-0.0.1-SNAPSHOT.jar
|
||||
|
||||
. ____ _ __ _ _
|
||||
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
|
||||
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
|
||||
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
|
||||
' |____| .__|_| |_|_| |_\__, | / / / /
|
||||
=========|_|==============|___/=/_/_/_/
|
||||
:: Spring Boot :: (v{spring-boot-version})
|
||||
....... . . .
|
||||
....... . . . (log output here)
|
||||
....... . . .
|
||||
........ Started Example in 2.536 seconds (JVM running for 2.864)
|
||||
----
|
||||
|
||||
As before, to gracefully exit the application hit `ctrl-c`.
|
||||
|
||||
|
||||
|
||||
[[getting-started-whats-next]]
|
||||
== What to read next
|
||||
Hopefully this section has provided you with some of the Spring Boot basics, and got you
|
||||
on your way to writing your own applications. If you're a task-oriented type of
|
||||
developer you might want to jump over to http://spring.io and check out some of the
|
||||
http://spring.io/guides/[getting started] guides that solve specific
|
||||
"`How do I do that with Spring`" problems; we also have Spring Boot-specific
|
||||
_<<howto.adoc#howto, How-to>>_ reference documentation.
|
||||
|
||||
The http://github.com/{github-repo}[Spring Boot repository] has also a
|
||||
{github-code}/spring-boot-samples[bunch of samples] you can run. The samples are
|
||||
independent of the rest of the code (that is you don't need to build the rest to run
|
||||
or use the samples).
|
||||
|
||||
Otherwise, the next logical step is to read _<<using-spring-boot.adoc#using-boot>>_. If
|
||||
you're really impatient, you could also jump ahead and read about
|
||||
_<<spring-boot-features.adoc#boot-features, Spring Boot features>>_.
|
||||
3071
spring-boot-project/spring-boot-docs/src/main/asciidoc/howto.adoc
Normal file
@@ -0,0 +1,13 @@
|
||||
<productname>Spring Boot</productname>
|
||||
<releaseinfo>{spring-boot-version}</releaseinfo>
|
||||
<copyright>
|
||||
<year>2012-2017</year>
|
||||
</copyright>
|
||||
<legalnotice>
|
||||
<para>
|
||||
Copies of this document may be made for your own use and for distribution to
|
||||
others, provided that you do not charge any fee for such copies and further
|
||||
provided that each copy contains this Copyright Notice, whether distributed in
|
||||
print or electronically.
|
||||
</para>
|
||||
</legalnotice>
|
||||
@@ -0,0 +1,72 @@
|
||||
= Spring Boot Reference Guide
|
||||
Phillip Webb; Dave Syer; Josh Long; Stéphane Nicoll; Rob Winch; Andy Wilkinson; Marcel Overdijk; Christian Dupuis; Sébastien Deleuze; Michael Simons; Vedran Pavić
|
||||
:doctype: book
|
||||
:toc:
|
||||
:toclevels: 4
|
||||
:source-highlighter: prettify
|
||||
:numbered:
|
||||
:icons: font
|
||||
:hide-uri-scheme:
|
||||
:spring-boot-repo: snapshot
|
||||
:github-tag: master
|
||||
:spring-boot-docs-version: current
|
||||
:spring-boot-docs: http://docs.spring.io/spring-boot/docs/{spring-boot-docs-version}/reference
|
||||
:spring-boot-docs-current: http://docs.spring.io/spring-boot/docs/current/reference
|
||||
:github-repo: spring-projects/spring-boot
|
||||
:github-raw: https://raw.github.com/{github-repo}/{github-tag}
|
||||
:github-code: https://github.com/{github-repo}/tree/{github-tag}
|
||||
:github-wiki: https://github.com/{github-repo}/wiki
|
||||
:github-master-code: https://github.com/{github-repo}/tree/master
|
||||
:sc-ext: java
|
||||
:sc-spring-boot: {github-code}/spring-boot/src/main/java/org/springframework/boot
|
||||
:sc-spring-boot-autoconfigure: {github-code}/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure
|
||||
:sc-spring-boot-actuator: {github-code}/spring-boot-actuator/src/main/java/org/springframework/boot/actuate
|
||||
:sc-spring-boot-actuator-autoconfigure: {github-code}/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure
|
||||
:sc-spring-boot-cli: {github-code}/spring-boot-cli/src/main/java/org/springframework/boot/cli
|
||||
:sc-spring-boot-devtools: {github-code}/spring-boot-devtools/src/main/java/org/springframework/boot/devtools
|
||||
:sc-spring-boot-test: {github-code}/spring-boot-test/src/main/java/org/springframework/boot/test
|
||||
:sc-spring-boot-test-autoconfigure: {github-code}/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure
|
||||
:dc-ext: html
|
||||
:dc-root: http://docs.spring.io/spring-boot/docs/{spring-boot-docs-version}/api
|
||||
:dc-spring-boot: {dc-root}/org/springframework/boot
|
||||
:dc-spring-boot-autoconfigure: {dc-root}/org/springframework/boot/autoconfigure
|
||||
:dc-spring-boot-actuator: {dc-root}/org/springframework/boot/actuate
|
||||
:dc-spring-boot-test: {dc-root}/org/springframework/boot/test
|
||||
:dc-spring-boot-test-autoconfigure: {dc-root}/org/springframework/boot/test/autoconfigure
|
||||
:dependency-management-plugin: https://github.com/spring-gradle-plugins/dependency-management-plugin
|
||||
:dependency-management-plugin-documentation: {dependency-management-plugin}/blob/master/README.md
|
||||
:spring-boot-maven-plugin-site: http://docs.spring.io/spring-boot/docs/{spring-boot-docs-version}/maven-plugin/
|
||||
:spring-boot-gradle-plugin: http://docs.spring.io/spring-boot/docs/{spring-boot-docs-version}/gradle-plugin/
|
||||
:spring-reference: http://docs.spring.io/spring/docs/{spring-docs-version}/spring-framework-reference/
|
||||
:spring-security-reference: http://docs.spring.io/spring-security/site/docs/{spring-security-docs-version}/reference/htmlsingle
|
||||
:spring-security-oauth2-reference: http://projects.spring.io/spring-security-oauth/docs/oauth2.html
|
||||
:spring-webservices-reference: http://docs.spring.io/spring-ws/docs/{spring-webservices-docs-version}/reference/htmlsingle
|
||||
:spring-javadoc: http://docs.spring.io/spring/docs/{spring-docs-version}/javadoc-api/org/springframework
|
||||
:spring-amqp-javadoc: http://docs.spring.io/spring-amqp/docs/current/api/org/springframework/amqp
|
||||
:spring-batch-javadoc: http://docs.spring.io/spring-batch/apidocs/org/springframework/batch
|
||||
:spring-data-javadoc: http://docs.spring.io/spring-data/jpa/docs/current/api/org/springframework/data/jpa
|
||||
:spring-data-commons-javadoc: http://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data
|
||||
:spring-data-mongo-javadoc: http://docs.spring.io/spring-data/mongodb/docs/current/api/org/springframework/data/mongodb
|
||||
:spring-data-rest-javadoc: http://docs.spring.io/spring-data/rest/docs/current/api/org/springframework/data/rest
|
||||
:gradle-userguide: http://www.gradle.org/docs/current/userguide
|
||||
:propdeps-plugin: https://github.com/spring-projects/gradle-plugins/tree/master/propdeps-plugin
|
||||
:ant-manual: http://ant.apache.org/manual
|
||||
:code-examples: ../java/org/springframework/boot
|
||||
:gradle-user-guide: https://docs.gradle.org/4.0.2/userguide
|
||||
:hibernate-documentation: http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html
|
||||
:jetty-documentation: https://www.eclipse.org/jetty/documentation/9.4.x
|
||||
:tomcat-documentation: https://tomcat.apache.org/tomcat-8.5-doc
|
||||
// ======================================================================================
|
||||
|
||||
include::documentation-overview.adoc[]
|
||||
include::getting-started.adoc[]
|
||||
include::using-spring-boot.adoc[]
|
||||
include::spring-boot-features.adoc[]
|
||||
include::production-ready-features.adoc[]
|
||||
include::deployment.adoc[]
|
||||
include::spring-boot-cli.adoc[]
|
||||
include::build-tool-plugins.adoc[]
|
||||
include::howto.adoc[]
|
||||
include::appendix.adoc[]
|
||||
|
||||
// ======================================================================================
|
||||
@@ -0,0 +1,481 @@
|
||||
[[cli]]
|
||||
= Spring Boot CLI
|
||||
|
||||
[partintro]
|
||||
--
|
||||
The Spring Boot CLI is a command line tool that can be used if you want to quickly
|
||||
develop with Spring. It allows you to run Groovy scripts, which means that you have a
|
||||
familiar Java-like syntax, without so much boilerplate code. You can also bootstrap
|
||||
a new project or write your own command for it.
|
||||
--
|
||||
|
||||
|
||||
|
||||
[[cli-installation]]
|
||||
== Installing the CLI
|
||||
The Spring Boot CLI can be installed manually; using SDKMAN! (the SDK Manager)
|
||||
or using Homebrew or MacPorts if you are an OSX user. See
|
||||
_<<getting-started.adoc#getting-started-installing-the-cli>>_
|
||||
in the "`Getting started`" section for comprehensive installation instructions.
|
||||
|
||||
|
||||
|
||||
[[cli-using-the-cli]]
|
||||
== Using the CLI
|
||||
Once you have installed the CLI you can run it by typing `spring`. If you run `spring`
|
||||
without any arguments, a simple help screen is displayed:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ spring
|
||||
usage: spring [--help] [--version]
|
||||
<command> [<args>]
|
||||
|
||||
Available commands are:
|
||||
|
||||
run [options] <files> [--] [args]
|
||||
Run a spring groovy script
|
||||
|
||||
_... more command help is shown here_
|
||||
----
|
||||
|
||||
You can use `help` to get more details about any of the supported commands. For example:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ spring help run
|
||||
spring run - Run a spring groovy script
|
||||
|
||||
usage: spring run [options] <files> [--] [args]
|
||||
|
||||
Option Description
|
||||
------ -----------
|
||||
--autoconfigure [Boolean] Add autoconfigure compiler
|
||||
transformations (default: true)
|
||||
--classpath, -cp Additional classpath entries
|
||||
-e, --edit Open the file with the default system
|
||||
editor
|
||||
--no-guess-dependencies Do not attempt to guess dependencies
|
||||
--no-guess-imports Do not attempt to guess imports
|
||||
-q, --quiet Quiet logging
|
||||
-v, --verbose Verbose logging of dependency
|
||||
resolution
|
||||
--watch Watch the specified file for changes
|
||||
----
|
||||
|
||||
The `version` command provides a quick way to check which version of Spring Boot you are
|
||||
using.
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ spring version
|
||||
Spring CLI v{spring-boot-version}
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[cli-run]]
|
||||
=== Running applications using the CLI
|
||||
You can compile and run Groovy source code using the `run` command. The Spring Boot CLI
|
||||
is completely self-contained so you don't need any external Groovy installation.
|
||||
|
||||
Here is an example "`hello world`" web application written in Groovy:
|
||||
|
||||
.hello.groovy
|
||||
[source,groovy,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
@RestController
|
||||
class WebApplication {
|
||||
|
||||
@RequestMapping("/")
|
||||
String home() {
|
||||
"Hello World!"
|
||||
}
|
||||
|
||||
}
|
||||
----
|
||||
|
||||
To compile and run the application type:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ spring run hello.groovy
|
||||
----
|
||||
|
||||
To pass command line arguments to the application, you need to use a `--` to separate
|
||||
them from the "`spring`" command arguments, e.g.
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ spring run hello.groovy -- --server.port=9000
|
||||
----
|
||||
|
||||
To set JVM command line arguments you can use the `JAVA_OPTS` environment variable, e.g.
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ JAVA_OPTS=-Xmx1024m spring run hello.groovy
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[cli-deduced-grab-annotations]]
|
||||
==== Deduced "`grab`" dependencies
|
||||
Standard Groovy includes a `@Grab` annotation which allows you to declare dependencies
|
||||
on a third-party libraries. This useful technique allows Groovy to download jars in the
|
||||
same way as Maven or Gradle would, but without requiring you to use a build tool.
|
||||
|
||||
Spring Boot extends this technique further, and will attempt to deduce which libraries
|
||||
to "`grab`" based on your code. For example, since the `WebApplication` code above uses
|
||||
`@RestController` annotations, "`Tomcat`" and "`Spring MVC`" will be grabbed.
|
||||
|
||||
The following items are used as "`grab hints`":
|
||||
|
||||
|===
|
||||
| Items | Grabs
|
||||
|
||||
|`JdbcTemplate`, `NamedParameterJdbcTemplate`, `DataSource`
|
||||
|JDBC Application.
|
||||
|
||||
|`@EnableJms`
|
||||
|JMS Application.
|
||||
|
||||
|`@EnableCaching`
|
||||
|Caching abstraction.
|
||||
|
||||
|`@Test`
|
||||
|JUnit.
|
||||
|
||||
|`@EnableRabbit`
|
||||
|RabbitMQ.
|
||||
|
||||
|`@EnableReactor`
|
||||
|Project Reactor.
|
||||
|
||||
|extends `Specification`
|
||||
|Spock test.
|
||||
|
||||
|`@EnableBatchProcessing`
|
||||
|Spring Batch.
|
||||
|
||||
|`@MessageEndpoint` `@EnableIntegrationPatterns`
|
||||
|Spring Integration.
|
||||
|
||||
|`@EnableDeviceResolver`
|
||||
|Spring Mobile.
|
||||
|
||||
|`@Controller` `@RestController` `@EnableWebMvc`
|
||||
|Spring MVC + Embedded Tomcat.
|
||||
|
||||
|`@EnableWebSecurity`
|
||||
|Spring Security.
|
||||
|
||||
|`@EnableTransactionManagement`
|
||||
|Spring Transaction Management.
|
||||
|===
|
||||
|
||||
TIP: See subclasses of
|
||||
{sc-spring-boot-cli}/compiler/CompilerAutoConfiguration.{sc-ext}[`CompilerAutoConfiguration`]
|
||||
in the Spring Boot CLI source code to understand exactly how customizations are applied.
|
||||
|
||||
|
||||
|
||||
[[cli-default-grab-deduced-coordinates]]
|
||||
==== Deduced "`grab`" coordinates
|
||||
Spring Boot extends Groovy's standard `@Grab` support by allowing you to specify a dependency
|
||||
without a group or version, for example `@Grab('freemarker')`. This will consult Spring Boot's
|
||||
default dependency metadata to deduce the artifact's group and version. Note that the default
|
||||
metadata is tied to the version of the CLI that you're using – it will only change when you move
|
||||
to a new version of the CLI, putting you in control of when the versions of your dependencies
|
||||
may change. A table showing the dependencies and their versions that are included in the default
|
||||
metadata can be found in the <<appendix-dependency-versions, appendix>>.
|
||||
|
||||
|
||||
|
||||
[[cli-default-import-statements]]
|
||||
==== Default import statements
|
||||
To help reduce the size of your Groovy code, several `import` statements are
|
||||
automatically included. Notice how the example above refers to `@Component`,
|
||||
`@RestController` and `@RequestMapping` without needing to use
|
||||
fully-qualified names or `import` statements.
|
||||
|
||||
TIP: Many Spring annotations will work without using `import` statements. Try running
|
||||
your application to see what fails before adding imports.
|
||||
|
||||
|
||||
|
||||
[[cli-automatic-main-method]]
|
||||
==== Automatic main method
|
||||
Unlike the equivalent Java application, you do not need to include a
|
||||
`public static void main(String[] args)` method with your `Groovy` scripts. A
|
||||
`SpringApplication` is automatically created, with your compiled code acting as the
|
||||
`source`.
|
||||
|
||||
|
||||
|
||||
[[cli-default-grab-deduced-coordinates-custom-dependency-management]]
|
||||
==== Custom dependency management
|
||||
By default, the CLI uses the dependency management declared in `spring-boot-dependencies`
|
||||
when resolving `@Grab` dependencies. Additional dependency management, that will override
|
||||
the default dependency management, can be configured using the `@DependencyManagementBom`
|
||||
annotation. The annotation's value should specify the coordinates
|
||||
(`groupId:artifactId:version`) of one or more Maven BOMs.
|
||||
|
||||
For example, the following declaration:
|
||||
|
||||
[source,groovy,indent=0]
|
||||
----
|
||||
@DependencyManagementBom("com.example.custom-bom:1.0.0")
|
||||
----
|
||||
|
||||
Will pick up `custom-bom-1.0.0.pom` in a Maven repository under
|
||||
`com/example/custom-versions/1.0.0/`.
|
||||
|
||||
When multiple BOMs are specified they are applied in the order that they're declared.
|
||||
For example:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@DependencyManagementBom(["com.example.custom-bom:1.0.0",
|
||||
"com.example.another-bom:1.0.0"])
|
||||
----
|
||||
|
||||
indicates that dependency management in `another-bom` will override the dependency
|
||||
management in `custom-bom`.
|
||||
|
||||
You can use `@DependencyManagementBom` anywhere that you can use `@Grab`, however, to
|
||||
ensure consistent ordering of the dependency management, you can only use
|
||||
`@DependencyManagementBom` at most once in your application. A useful source of
|
||||
dependency management (that is a superset of Spring Boot's dependency management) is the
|
||||
http://platform.spring.io/[Spring IO Platform], e.g.
|
||||
`@DependencyManagementBom('io.spring.platform:platform-bom:1.1.2.RELEASE')`.
|
||||
|
||||
|
||||
|
||||
[[cli-multiple-source-files]]
|
||||
=== Applications with multiple source files
|
||||
You can use "`shell globbing`" with all commands that accept file input. This allows you
|
||||
to easily use multiple files from a single directory, e.g.
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ spring run *.groovy
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[cli-jar]]
|
||||
=== Packaging your application
|
||||
You can use the `jar` command to package your application into a self-contained
|
||||
executable jar file. For example:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ spring jar my-app.jar *.groovy
|
||||
----
|
||||
|
||||
The resulting jar will contain the classes produced by compiling the application and all
|
||||
of the application's dependencies so that it can then be run using `java -jar`. The jar
|
||||
file will also contain entries from the application's classpath. You can add explicit
|
||||
paths to the jar using `--include` and `--exclude` (both are comma-separated, and both
|
||||
accept prefixes to the values "`+`" and "`-`" to signify that they should be removed from
|
||||
the defaults). The default includes are
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
public/**, resources/**, static/**, templates/**, META-INF/**, *
|
||||
----
|
||||
|
||||
and the default excludes are
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
.*, repository/**, build/**, target/**, **/*.jar, **/*.groovy
|
||||
----
|
||||
|
||||
See the output of `spring help jar` for more information.
|
||||
|
||||
|
||||
|
||||
[[cli-init]]
|
||||
=== Initialize a new project
|
||||
The `init` command allows you to create a new project using https://start.spring.io
|
||||
without leaving the shell. For example:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ spring init --dependencies=web,data-jpa my-project
|
||||
Using service at https://start.spring.io
|
||||
Project extracted to '/Users/developer/example/my-project'
|
||||
----
|
||||
|
||||
This creates a `my-project` directory with a Maven-based project using
|
||||
`spring-boot-starter-web` and `spring-boot-starter-data-jpa`. You can list the
|
||||
capabilities of the service using the `--list` flag
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ spring init --list
|
||||
=======================================
|
||||
Capabilities of https://start.spring.io
|
||||
=======================================
|
||||
|
||||
Available dependencies:
|
||||
-----------------------
|
||||
actuator - Actuator: Production ready features to help you monitor and manage your application
|
||||
...
|
||||
web - Web: Support for full-stack web development, including Tomcat and spring-webmvc
|
||||
websocket - Websocket: Support for WebSocket development
|
||||
ws - WS: Support for Spring Web Services
|
||||
|
||||
Available project types:
|
||||
------------------------
|
||||
gradle-build - Gradle Config [format:build, build:gradle]
|
||||
gradle-project - Gradle Project [format:project, build:gradle]
|
||||
maven-build - Maven POM [format:build, build:maven]
|
||||
maven-project - Maven Project [format:project, build:maven] (default)
|
||||
|
||||
...
|
||||
----
|
||||
|
||||
The `init` command supports many options, check the `help` output for more details. For
|
||||
instance, the following command creates a gradle project using Java 8 and `war` packaging:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ spring init --build=gradle --java-version=1.8 --dependencies=websocket --packaging=war sample-app.zip
|
||||
Using service at https://start.spring.io
|
||||
Content saved to 'sample-app.zip'
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[cli-shell]]
|
||||
=== Using the embedded shell
|
||||
Spring Boot includes command-line completion scripts for BASH and zsh shells. If you
|
||||
don't use either of these shells (perhaps you are a Windows user) then you can use the
|
||||
`shell` command to launch an integrated shell.
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ spring shell
|
||||
*Spring Boot* (v{spring-boot-version})
|
||||
Hit TAB to complete. Type \'help' and hit RETURN for help, and \'exit' to quit.
|
||||
----
|
||||
|
||||
From inside the embedded shell you can run other commands directly:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ version
|
||||
Spring CLI v{spring-boot-version}
|
||||
----
|
||||
|
||||
The embedded shell supports ANSI color output as well as `tab` completion. If you need
|
||||
to run a native command you can use the `!` prefix. Hitting `ctrl-c` will exit the
|
||||
embedded shell.
|
||||
|
||||
|
||||
|
||||
[[cli-install-uninstall]]
|
||||
=== Adding extensions to the CLI
|
||||
You can add extensions to the CLI using the `install` command. The command takes one
|
||||
or more sets of artifact coordinates in the format `group:artifact:version`. For example:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ spring install com.example:spring-boot-cli-extension:1.0.0.RELEASE
|
||||
----
|
||||
|
||||
In addition to installing the artifacts identified by the coordinates you supply, all of
|
||||
the artifacts' dependencies will also be installed.
|
||||
|
||||
To uninstall a dependency use the `uninstall` command. As with the `install` command, it
|
||||
takes one or more sets of artifact coordinates in the format `group:artifact:version`.
|
||||
For example:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ spring uninstall com.example:spring-boot-cli-extension:1.0.0.RELEASE
|
||||
----
|
||||
|
||||
It will uninstall the artifacts identified by the coordinates you supply and their
|
||||
dependencies.
|
||||
|
||||
To uninstall all additional dependencies you can use the `--all` option. For example:
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
$ spring uninstall --all
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[cli-groovy-beans-dsl]]
|
||||
== Developing application with the Groovy beans DSL
|
||||
Spring Framework 4.0 has native support for a `beans{}` "`DSL`" (borrowed from
|
||||
http://grails.org/[Grails]), and you can embed bean definitions in your Groovy
|
||||
application scripts using the same format. This is sometimes a good way to include
|
||||
external features like middleware declarations. For example:
|
||||
|
||||
[source,groovy,indent=0]
|
||||
----
|
||||
@Configuration
|
||||
class Application implements CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
SharedService service
|
||||
|
||||
@Override
|
||||
void run(String... args) {
|
||||
println service.message
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
import my.company.SharedService
|
||||
|
||||
beans {
|
||||
service(SharedService) {
|
||||
message = "Hello World"
|
||||
}
|
||||
}
|
||||
----
|
||||
|
||||
You can mix class declarations with `beans{}` in the same file as long as they stay at
|
||||
the top level, or you can put the beans DSL in a separate file if you prefer.
|
||||
|
||||
|
||||
|
||||
[[cli-maven-settings]]
|
||||
== Configuring the CLI with settings.xml
|
||||
The Spring Boot CLI uses Aether, Maven's dependency resolution engine, to resolve
|
||||
dependencies. The CLI makes use of the Maven configuration found in `~/.m2/settings.xml`
|
||||
to configure Aether. The following configuration settings are honored by the CLI:
|
||||
|
||||
* Offline
|
||||
* Mirrors
|
||||
* Servers
|
||||
* Proxies
|
||||
* Profiles
|
||||
** Activation
|
||||
** Repositories
|
||||
* Active profiles
|
||||
|
||||
Please refer to https://maven.apache.org/settings.html[Maven's settings documentation] for
|
||||
further information.
|
||||
|
||||
|
||||
|
||||
[[cli-whats-next]]
|
||||
== What to read next
|
||||
There are some {github-code}/spring-boot-cli/samples[sample groovy
|
||||
scripts] available from the GitHub repository that you can use to try out the
|
||||
Spring Boot CLI. There is also extensive Javadoc throughout the
|
||||
{sc-spring-boot-cli}[source code].
|
||||
|
||||
If you find that you reach the limit of the CLI tool, you will probably want to look
|
||||
at converting your application to full Gradle or Maven built "`groovy project`". The
|
||||
next section covers Spring Boot's
|
||||
_<<build-tool-plugins.adoc#build-tool-plugins, Build tool plugins>>_ that you can
|
||||
use with Gradle or Maven.
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
code highlight CSS resemblign the Eclipse IDE default color schema
|
||||
@author Costin Leau
|
||||
*/
|
||||
|
||||
.hl-keyword {
|
||||
color: #7F0055;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hl-comment {
|
||||
color: #3F5F5F;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hl-multiline-comment {
|
||||
color: #3F5FBF;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hl-tag {
|
||||
color: #3F7F7F;
|
||||
}
|
||||
|
||||
.hl-attribute {
|
||||
color: #7F007F;
|
||||
}
|
||||
|
||||
.hl-value {
|
||||
color: #2A00FF;
|
||||
}
|
||||
|
||||
.hl-string {
|
||||
color: #2A00FF;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
@IMPORT url("manual.css");
|
||||
|
||||
body.firstpage {
|
||||
background: url("../images/background.png") no-repeat center top;
|
||||
}
|
||||
|
||||
div.part h1 {
|
||||
border-top: none;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
@IMPORT url("manual.css");
|
||||
|
||||
body {
|
||||
background: url("../images/background.png") no-repeat center top;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,344 @@
|
||||
@IMPORT url("highlight.css");
|
||||
|
||||
html {
|
||||
padding: 0pt;
|
||||
margin: 0pt;
|
||||
}
|
||||
|
||||
body {
|
||||
color: #333333;
|
||||
margin: 15px 30px;
|
||||
font-family: Helvetica, Arial, Freesans, Clean, Sans-serif;
|
||||
line-height: 1.6;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
code {
|
||||
font-size: 16px;
|
||||
font-family: Consolas, "Liberation Mono", Courier, monospace;
|
||||
}
|
||||
|
||||
:not(a)>code {
|
||||
color: #6D180B;
|
||||
}
|
||||
|
||||
:not(pre)>code {
|
||||
background-color: #F2F2F2;
|
||||
border: 1px solid #CCCCCC;
|
||||
border-radius: 4px;
|
||||
padding: 1px 3px 0;
|
||||
text-shadow: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
body>*:first-child {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
|
||||
div {
|
||||
margin: 0pt;
|
||||
}
|
||||
|
||||
hr {
|
||||
border: 1px solid #CCCCCC;
|
||||
background: #CCCCCC;
|
||||
}
|
||||
|
||||
h1,h2,h3,h4,h5,h6 {
|
||||
color: #000000;
|
||||
cursor: text;
|
||||
font-weight: bold;
|
||||
margin: 30px 0 10px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h1,h2,h3 {
|
||||
margin: 40px 0 10px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 70px 0 30px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
div.part h1 {
|
||||
border-top: 1px dotted #CCCCCC;
|
||||
}
|
||||
|
||||
h1,h1 code {
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
h2,h2 code {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
h3,h3 code {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
h4,h1 code,h5,h5 code,h6,h6 code {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
div.book,div.chapter,div.appendix,div.part,div.preface {
|
||||
min-width: 300px;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
p.releaseinfo {
|
||||
font-weight: bold;
|
||||
margin-bottom: 40px;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
div.authorgroup {
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
p.copyright {
|
||||
line-height: 1;
|
||||
margin-bottom: -5px;
|
||||
}
|
||||
|
||||
.legalnotice p {
|
||||
font-style: italic;
|
||||
font-size: 14px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
div.titlepage+p,div.titlepage+p {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
pre {
|
||||
line-height: 1.0;
|
||||
color: black;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #4183C4;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 15px 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
ul,ol {
|
||||
padding-left: 30px;
|
||||
}
|
||||
|
||||
li p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.table {
|
||||
margin: 1em;
|
||||
padding: 0.5em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.table table,div.informaltable table {
|
||||
display: table;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div.table td {
|
||||
padding-left: 7px;
|
||||
padding-right: 7px;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
line-height: 1.4;
|
||||
padding: 0 20px;
|
||||
background-color: #F8F8F8;
|
||||
border: 1px solid #CCCCCC;
|
||||
border-radius: 3px 3px 3px 3px;
|
||||
}
|
||||
|
||||
.sidebar p.title {
|
||||
color: #6D180B;
|
||||
}
|
||||
|
||||
pre.programlisting,pre.screen {
|
||||
font-size: 15px;
|
||||
padding: 6px 10px;
|
||||
background-color: #F8F8F8;
|
||||
border: 1px solid #CCCCCC;
|
||||
border-radius: 3px 3px 3px 3px;
|
||||
clear: both;
|
||||
overflow: auto;
|
||||
line-height: 1.4;
|
||||
font-family: Consolas, "Liberation Mono", Courier, monospace;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
border: 1px solid #DDDDDD !important;
|
||||
border-radius: 4px !important;
|
||||
border-collapse: separate !important;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
table thead {
|
||||
background: #F5F5F5;
|
||||
}
|
||||
|
||||
table tr {
|
||||
border: none;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
table th {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table th,table td {
|
||||
border: none !important;
|
||||
padding: 6px 13px;
|
||||
}
|
||||
|
||||
table tr:nth-child(2n) {
|
||||
background-color: #F8F8F8;
|
||||
}
|
||||
|
||||
td p {
|
||||
margin: 0 0 15px 0;
|
||||
}
|
||||
|
||||
div.table-contents td p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.important *,div.note *,div.tip *,div.warning *,div.navheader *,div.navfooter *,div.calloutlist *
|
||||
{
|
||||
border: none !important;
|
||||
background: none !important;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.important p,div.note p,div.tip p,div.warning p {
|
||||
color: #6F6F6F;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
div.important code,div.note code,div.tip code,div.warning code {
|
||||
background-color: #F2F2F2 !important;
|
||||
border: 1px solid #CCCCCC !important;
|
||||
border-radius: 4px !important;
|
||||
padding: 1px 3px 0 !important;
|
||||
text-shadow: none !important;
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
|
||||
.note th,.tip th,.warning th {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.note tr:first-child td,.tip tr:first-child td,.warning tr:first-child td
|
||||
{
|
||||
border-right: 1px solid #CCCCCC !important;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
div.calloutlist p,div.calloutlist td {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.calloutlist>table>tbody>tr>td:first-child {
|
||||
padding-left: 10px;
|
||||
width: 30px !important;
|
||||
}
|
||||
|
||||
div.important,div.note,div.tip,div.warning {
|
||||
margin-left: 0px !important;
|
||||
margin-right: 20px !important;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
div.toc {
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
dl,dt {
|
||||
margin-top: 1px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
div.toc>dl>dt {
|
||||
font-size: 32px;
|
||||
font-weight: bold;
|
||||
margin: 30px 0 10px 0;
|
||||
display: block;
|
||||
}
|
||||
|
||||
div.toc>dl>dd>dl>dt {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
margin: 20px 0 10px 0;
|
||||
display: block;
|
||||
}
|
||||
|
||||
div.toc>dl>dd>dl>dd>dl>dt {
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
margin: 10px 0 0 0;
|
||||
}
|
||||
|
||||
tbody.footnotes * {
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
div.footnote p {
|
||||
margin: 0;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
div.footnote p sup {
|
||||
margin-right: 6px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
div.navheader {
|
||||
border-bottom: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
div.navfooter {
|
||||
border-top: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin-left: -1em;
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
.title>a {
|
||||
position: absolute;
|
||||
visibility: hidden;
|
||||
display: block;
|
||||
font-size: 0.85em;
|
||||
margin-top: 0.05em;
|
||||
margin-left: -1em;
|
||||
vertical-align: text-top;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.title>a:before {
|
||||
content: "\00A7";
|
||||
}
|
||||
|
||||
.title:hover>a,.title>a:hover,.title:hover>a:hover {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.title:focus>a,.title>a:focus,.title:focus>a:focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 931 B |
|
After Width: | Height: | Size: 2.1 KiB |
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xslthl="http://xslthl.sf.net"
|
||||
xmlns:d="http://docbook.org/ns/docbook"
|
||||
exclude-result-prefixes="xslthl d"
|
||||
version='1.0'>
|
||||
|
||||
<!-- Extensions -->
|
||||
<xsl:param name="use.extensions">1</xsl:param>
|
||||
<xsl:param name="tablecolumns.extension">0</xsl:param>
|
||||
<xsl:param name="callout.extensions">1</xsl:param>
|
||||
|
||||
<!-- Graphics -->
|
||||
<xsl:param name="admon.graphics" select="1"/>
|
||||
<xsl:param name="admon.graphics.path">images/</xsl:param>
|
||||
<xsl:param name="admon.graphics.extension">.png</xsl:param>
|
||||
|
||||
<!-- Table of Contents -->
|
||||
<xsl:param name="generate.toc">book toc,title</xsl:param>
|
||||
<xsl:param name="toc.section.depth">3</xsl:param>
|
||||
|
||||
<!-- Hide revhistory -->
|
||||
<xsl:template match="d:revhistory" mode="titlepage.mode"/>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xslthl="http://xslthl.sf.net"
|
||||
xmlns:d="http://docbook.org/ns/docbook"
|
||||
exclude-result-prefixes="xslthl d"
|
||||
version='1.0'>
|
||||
|
||||
<xsl:import href="urn:docbkx:stylesheet"/>
|
||||
<xsl:import href="common.xsl"/>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version='1.0'>
|
||||
|
||||
<xsl:import href="urn:docbkx:stylesheet"/>
|
||||
<xsl:import href="html.xsl"/>
|
||||
|
||||
<xsl:param name="html.stylesheet">css/manual-multipage.css</xsl:param>
|
||||
|
||||
<xsl:param name="chunk.section.depth">'5'</xsl:param>
|
||||
<xsl:param name="use.id.as.filename">'1'</xsl:param>
|
||||
|
||||
<!-- Replace chunk-element-content from chunk-common to add firstpage class to body -->
|
||||
<xsl:template name="chunk-element-content">
|
||||
<xsl:param name="prev"/>
|
||||
<xsl:param name="next"/>
|
||||
<xsl:param name="nav.context"/>
|
||||
<xsl:param name="content">
|
||||
<xsl:apply-imports/>
|
||||
</xsl:param>
|
||||
|
||||
<xsl:call-template name="user.preroot"/>
|
||||
|
||||
<html>
|
||||
<xsl:call-template name="html.head">
|
||||
<xsl:with-param name="prev" select="$prev"/>
|
||||
<xsl:with-param name="next" select="$next"/>
|
||||
</xsl:call-template>
|
||||
<body>
|
||||
<xsl:if test="count($prev) = 0">
|
||||
<xsl:attribute name="class">firstpage</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:call-template name="body.attributes"/>
|
||||
<xsl:call-template name="user.header.navigation"/>
|
||||
<xsl:call-template name="header.navigation">
|
||||
<xsl:with-param name="prev" select="$prev"/>
|
||||
<xsl:with-param name="next" select="$next"/>
|
||||
<xsl:with-param name="nav.context" select="$nav.context"/>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="user.header.content"/>
|
||||
<xsl:copy-of select="$content"/>
|
||||
<xsl:call-template name="user.footer.content"/>
|
||||
<xsl:call-template name="footer.navigation">
|
||||
<xsl:with-param name="prev" select="$prev"/>
|
||||
<xsl:with-param name="next" select="$next"/>
|
||||
<xsl:with-param name="nav.context" select="$nav.context"/>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="user.footer.navigation"/>
|
||||
</body>
|
||||
</html>
|
||||
<xsl:value-of select="$chunk.append"/>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version='1.0'>
|
||||
|
||||
<xsl:import href="urn:docbkx:stylesheet"/>
|
||||
<xsl:import href="html.xsl"/>
|
||||
|
||||
<xsl:param name="html.stylesheet">css/manual-singlepage.css</xsl:param>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xslthl="http://xslthl.sf.net"
|
||||
xmlns:d="http://docbook.org/ns/docbook"
|
||||
exclude-result-prefixes="xslthl"
|
||||
version='1.0'>
|
||||
|
||||
<xsl:import href="urn:docbkx:stylesheet/highlight.xsl"/>
|
||||
<xsl:import href="common.xsl"/>
|
||||
|
||||
<!-- Only use scaling in FO -->
|
||||
<xsl:param name="ignore.image.scaling">1</xsl:param>
|
||||
|
||||
<!-- Use code syntax highlighting -->
|
||||
<xsl:param name="highlight.source">1</xsl:param>
|
||||
|
||||
<!-- Activate Graphics -->
|
||||
<xsl:param name="callout.graphics" select="1" />
|
||||
<xsl:param name="callout.defaultcolumn">120</xsl:param>
|
||||
<xsl:param name="callout.graphics.path">images/callouts/</xsl:param>
|
||||
<xsl:param name="callout.graphics.extension">.png</xsl:param>
|
||||
|
||||
<xsl:param name="table.borders.with.css" select="1"/>
|
||||
<xsl:param name="html.stylesheet.type">text/css</xsl:param>
|
||||
|
||||
<xsl:param name="admonition.title.properties">text-align: left</xsl:param>
|
||||
|
||||
<!-- Leave image paths as relative when navigating XInclude -->
|
||||
<xsl:param name="keep.relative.image.uris" select="1"/>
|
||||
|
||||
<!-- Label Chapters and Sections (numbering) -->
|
||||
<xsl:param name="chapter.autolabel" select="1"/>
|
||||
<xsl:param name="section.autolabel" select="1"/>
|
||||
<xsl:param name="section.autolabel.max.depth" select="2"/>
|
||||
<xsl:param name="section.label.includes.component.label" select="1"/>
|
||||
<xsl:param name="table.footnote.number.format" select="'1'"/>
|
||||
|
||||
<!-- Remove "Chapter" from the Chapter titles... -->
|
||||
<xsl:param name="local.l10n.xml" select="document('')"/>
|
||||
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
|
||||
<l:l10n language="en">
|
||||
<l:context name="title-numbered">
|
||||
<l:template name="chapter" text="%n. %t"/>
|
||||
<l:template name="section" text="%n %t"/>
|
||||
</l:context>
|
||||
</l:l10n>
|
||||
</l:i18n>
|
||||
|
||||
<!-- Syntax Highlighting -->
|
||||
<xsl:template match='xslthl:keyword' mode="xslthl">
|
||||
<span class="hl-keyword"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:comment' mode="xslthl">
|
||||
<span class="hl-comment"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:oneline-comment' mode="xslthl">
|
||||
<span class="hl-comment"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:multiline-comment' mode="xslthl">
|
||||
<span class="hl-multiline-comment"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:tag' mode="xslthl">
|
||||
<span class="hl-tag"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:attribute' mode="xslthl">
|
||||
<span class="hl-attribute"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:value' mode="xslthl">
|
||||
<span class="hl-value"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:string' mode="xslthl">
|
||||
<span class="hl-string"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Custom Title Page -->
|
||||
<xsl:template match="d:author" mode="titlepage.mode">
|
||||
<xsl:if test="name(preceding-sibling::*[1]) = 'author'">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
<span class="{name(.)}">
|
||||
<xsl:call-template name="person.name"/>
|
||||
<xsl:apply-templates mode="titlepage.mode" select="./contrib"/>
|
||||
</span>
|
||||
</xsl:template>
|
||||
<xsl:template match="d:authorgroup" mode="titlepage.mode">
|
||||
<div class="{name(.)}">
|
||||
<h2>Authors</h2>
|
||||
<xsl:apply-templates mode="titlepage.mode"/>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Title Links -->
|
||||
<xsl:template name="anchor">
|
||||
<xsl:param name="node" select="."/>
|
||||
<xsl:param name="conditional" select="1"/>
|
||||
<xsl:variable name="id">
|
||||
<xsl:call-template name="object.id">
|
||||
<xsl:with-param name="object" select="$node"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:if test="$conditional = 0 or $node/@id or $node/@xml:id">
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="name">
|
||||
<xsl:value-of select="$id"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>#</xsl:text>
|
||||
<xsl:value-of select="$id"/>
|
||||
</xsl:attribute>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,582 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:d="http://docbook.org/ns/docbook"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
xmlns:xslthl="http://xslthl.sf.net"
|
||||
xmlns:xlink='http://www.w3.org/1999/xlink'
|
||||
xmlns:exsl="http://exslt.org/common"
|
||||
exclude-result-prefixes="exsl xslthl d xlink"
|
||||
version='1.0'>
|
||||
|
||||
<xsl:import href="urn:docbkx:stylesheet"/>
|
||||
<xsl:import href="urn:docbkx:stylesheet/highlight.xsl"/>
|
||||
<xsl:import href="common.xsl"/>
|
||||
|
||||
<!-- Extensions -->
|
||||
<xsl:param name="fop1.extensions" select="1"/>
|
||||
|
||||
<xsl:param name="paper.type" select="'A4'"/>
|
||||
<xsl:param name="page.margin.top" select="'1cm'"/>
|
||||
<xsl:param name="region.before.extent" select="'1cm'"/>
|
||||
<xsl:param name="body.margin.top" select="'1.5cm'"/>
|
||||
|
||||
<xsl:param name="body.margin.bottom" select="'1.5cm'"/>
|
||||
<xsl:param name="region.after.extent" select="'1cm'"/>
|
||||
<xsl:param name="page.margin.bottom" select="'1cm'"/>
|
||||
<xsl:param name="title.margin.left" select="'0cm'"/>
|
||||
|
||||
<!-- allow break across pages -->
|
||||
<xsl:attribute-set name="formal.object.properties">
|
||||
<xsl:attribute name="keep-together.within-column">auto</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- use color links and sensible rendering -->
|
||||
<xsl:attribute-set name="xref.properties">
|
||||
<xsl:attribute name="text-decoration">underline</xsl:attribute>
|
||||
<xsl:attribute name="color">#204060</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
<xsl:param name="ulink.show" select="0"></xsl:param>
|
||||
<xsl:param name="ulink.footnotes" select="0"></xsl:param>
|
||||
|
||||
<!-- TITLE PAGE -->
|
||||
|
||||
<xsl:template name="book.titlepage.recto">
|
||||
<fo:block>
|
||||
<fo:table table-layout="fixed" width="175mm">
|
||||
<fo:table-column column-width="175mm"/>
|
||||
<fo:table-body>
|
||||
<fo:table-row>
|
||||
<fo:table-cell text-align="center">
|
||||
<fo:block>
|
||||
<fo:external-graphic src="images/logo.png" width="240px"
|
||||
height="auto" content-width="scale-to-fit"
|
||||
content-height="scale-to-fit"
|
||||
content-type="content-type:image/png" text-align="center"
|
||||
/>
|
||||
</fo:block>
|
||||
<fo:block font-family="Helvetica" font-size="20pt" font-weight="bold" padding="10mm">
|
||||
<xsl:value-of select="d:info/d:title"/>
|
||||
</fo:block>
|
||||
<fo:block font-family="Helvetica" font-size="14pt" padding-before="2mm">
|
||||
<xsl:value-of select="d:info/d:subtitle"/>
|
||||
</fo:block>
|
||||
<fo:block font-family="Helvetica" font-size="14pt" padding="2mm">
|
||||
<xsl:value-of select="d:info/d:releaseinfo"/>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell text-align="center">
|
||||
<fo:block font-family="Helvetica" font-size="14pt" padding="5mm">
|
||||
<xsl:value-of select="d:info/d:pubdate"/>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell text-align="center">
|
||||
<fo:block font-family="Helvetica" font-size="10pt" padding="10mm">
|
||||
<xsl:for-each select="d:info/d:authorgroup/d:author">
|
||||
<xsl:if test="position() > 1">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:for-each>
|
||||
</fo:block>
|
||||
|
||||
<fo:block font-family="Helvetica" font-size="10pt" padding="5mm">
|
||||
<xsl:value-of select="d:info/d:pubdate"/>
|
||||
</fo:block>
|
||||
|
||||
<fo:block font-family="Helvetica" font-size="10pt" padding="5mm" padding-before="25em">
|
||||
<xsl:text>Copyright © </xsl:text><xsl:value-of select="d:info/d:copyright"/>
|
||||
</fo:block>
|
||||
|
||||
<fo:block font-family="Helvetica" font-size="8pt" padding="1mm">
|
||||
<xsl:value-of select="d:info/d:legalnotice"/>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Prevent blank pages in output -->
|
||||
<xsl:template name="book.titlepage.before.verso">
|
||||
</xsl:template>
|
||||
<xsl:template name="book.titlepage.verso">
|
||||
</xsl:template>
|
||||
<xsl:template name="book.titlepage.separator">
|
||||
</xsl:template>
|
||||
|
||||
<!-- HEADER -->
|
||||
|
||||
<!-- More space in the center header for long text -->
|
||||
<xsl:attribute-set name="header.content.properties">
|
||||
<xsl:attribute name="font-family">
|
||||
<xsl:value-of select="$body.font.family"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="margin-left">-5em</xsl:attribute>
|
||||
<xsl:attribute name="margin-right">-5em</xsl:attribute>
|
||||
<xsl:attribute name="font-size">8pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:template name="header.content">
|
||||
<xsl:param name="pageclass" select="''"/>
|
||||
<xsl:param name="sequence" select="''"/>
|
||||
<xsl:param name="position" select="''"/>
|
||||
<xsl:param name="gentext-key" select="''"/>
|
||||
|
||||
<xsl:variable name="Version">
|
||||
<xsl:choose>
|
||||
<xsl:when test="//d:title">
|
||||
<xsl:value-of select="//d:title"/><xsl:text> </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>please define title in your docbook file!</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$sequence='blank'">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$position='center'">
|
||||
<xsl:value-of select="$Version"/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$pageclass='titlepage'">
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$position='center'">
|
||||
<xsl:value-of select="$Version"/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- FOOTER-->
|
||||
<xsl:attribute-set name="footer.content.properties">
|
||||
<xsl:attribute name="font-family">
|
||||
<xsl:value-of select="$body.font.family"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="font-size">8pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:template name="footer.content">
|
||||
<xsl:param name="pageclass" select="''"/>
|
||||
<xsl:param name="sequence" select="''"/>
|
||||
<xsl:param name="position" select="''"/>
|
||||
<xsl:param name="gentext-key" select="''"/>
|
||||
|
||||
<xsl:variable name="Version">
|
||||
<xsl:choose>
|
||||
<xsl:when test="//d:releaseinfo">
|
||||
<xsl:value-of select="//d:releaseinfo"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="Title">
|
||||
<xsl:choose>
|
||||
<xsl:when test="//d:productname">
|
||||
<xsl:value-of select="//d:productname"/><xsl:text> </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>please define title in your docbook file!</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$sequence='blank'">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$double.sided != 0 and $position = 'left'">
|
||||
<xsl:value-of select="$Version"/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$double.sided = 0 and $position = 'center'">
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<fo:page-number/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$pageclass='titlepage'">
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$double.sided != 0 and $sequence = 'even' and $position='left'">
|
||||
<fo:page-number/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$double.sided != 0 and $sequence = 'odd' and $position='right'">
|
||||
<fo:page-number/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$double.sided = 0 and $position='right'">
|
||||
<fo:page-number/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$double.sided != 0 and $sequence = 'odd' and $position='left'">
|
||||
<xsl:value-of select="$Version"/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$double.sided != 0 and $sequence = 'even' and $position='right'">
|
||||
<xsl:value-of select="$Version"/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$double.sided = 0 and $position='left'">
|
||||
<xsl:value-of select="$Version"/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$position='center'">
|
||||
<xsl:value-of select="$Title"/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="processing-instruction('hard-pagebreak')">
|
||||
<fo:block break-before='page'/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- PAPER & PAGE SIZE -->
|
||||
|
||||
<!-- Paper type, no headers on blank pages, no double sided printing -->
|
||||
<xsl:param name="double.sided">0</xsl:param>
|
||||
<xsl:param name="headers.on.blank.pages">0</xsl:param>
|
||||
<xsl:param name="footers.on.blank.pages">0</xsl:param>
|
||||
|
||||
<!-- FONTS & STYLES -->
|
||||
|
||||
<xsl:param name="hyphenate">false</xsl:param>
|
||||
|
||||
<!-- Default Font size -->
|
||||
<xsl:param name="body.font.family">Helvetica</xsl:param>
|
||||
<xsl:param name="body.font.master">10</xsl:param>
|
||||
<xsl:param name="body.font.small">8</xsl:param>
|
||||
<xsl:param name="title.font.family">Helvetica</xsl:param>
|
||||
|
||||
<!-- Line height in body text -->
|
||||
<xsl:param name="line-height">1.4</xsl:param>
|
||||
|
||||
<!-- Chapter title size -->
|
||||
<xsl:attribute-set name="chapter.titlepage.recto.style">
|
||||
<xsl:attribute name="text-align">left</xsl:attribute>
|
||||
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master * 1.8"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Why is the font-size for chapters hardcoded in the XSL FO templates?
|
||||
Let's remove it, so this sucker can use our attribute-set only... -->
|
||||
<xsl:template match="d:title" mode="chapter.titlepage.recto.auto.mode">
|
||||
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
xsl:use-attribute-sets="chapter.titlepage.recto.style">
|
||||
<xsl:call-template name="component.title">
|
||||
<xsl:with-param name="node" select="ancestor-or-self::d:chapter[1]"/>
|
||||
</xsl:call-template>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Sections 1, 2 and 3 titles have a small bump factor and padding -->
|
||||
<xsl:attribute-set name="section.title.level1.properties">
|
||||
<xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0.6em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master * 1.5"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="section.title.level2.properties">
|
||||
<xsl:attribute name="space-before.optimum">0.4em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.4em</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master * 1.25"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="section.title.level3.properties">
|
||||
<xsl:attribute name="space-before.optimum">0.4em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.4em</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master * 1.0"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="section.title.level4.properties">
|
||||
<xsl:attribute name="space-before.optimum">0.3em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0.3em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.3em</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master * 0.9"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
|
||||
<!-- TABLES -->
|
||||
|
||||
<!-- Some padding inside tables -->
|
||||
<xsl:attribute-set name="table.cell.padding">
|
||||
<xsl:attribute name="padding-left">4pt</xsl:attribute>
|
||||
<xsl:attribute name="padding-right">4pt</xsl:attribute>
|
||||
<xsl:attribute name="padding-top">4pt</xsl:attribute>
|
||||
<xsl:attribute name="padding-bottom">4pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Only hairlines as frame and cell borders in tables -->
|
||||
<xsl:param name="table.frame.border.thickness">0.1pt</xsl:param>
|
||||
<xsl:param name="table.cell.border.thickness">0.1pt</xsl:param>
|
||||
|
||||
<!-- LABELS -->
|
||||
|
||||
<!-- Label Chapters and Sections (numbering) -->
|
||||
<xsl:param name="chapter.autolabel" select="1"/>
|
||||
<xsl:param name="section.autolabel" select="1"/>
|
||||
<xsl:param name="section.autolabel.max.depth" select="1"/>
|
||||
|
||||
<xsl:param name="section.label.includes.component.label" select="1"/>
|
||||
<xsl:param name="table.footnote.number.format" select="'1'"/>
|
||||
|
||||
<!-- PROGRAMLISTINGS -->
|
||||
|
||||
<!-- Verbatim text formatting (programlistings) -->
|
||||
<xsl:attribute-set name="monospace.verbatim.properties">
|
||||
<xsl:attribute name="font-size">7pt</xsl:attribute>
|
||||
<xsl:attribute name="wrap-option">wrap</xsl:attribute>
|
||||
<xsl:attribute name="keep-together.within-column">1</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="verbatim.properties">
|
||||
<xsl:attribute name="space-before.minimum">1em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.optimum">1em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
|
||||
<xsl:attribute name="border-color">#444444</xsl:attribute>
|
||||
<xsl:attribute name="border-style">solid</xsl:attribute>
|
||||
<xsl:attribute name="border-width">0.1pt</xsl:attribute>
|
||||
<xsl:attribute name="padding-top">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="padding-left">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="padding-right">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="padding-bottom">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="margin-left">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="margin-right">0.5em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Shade (background) programlistings -->
|
||||
<xsl:param name="shade.verbatim">1</xsl:param>
|
||||
<xsl:attribute-set name="shade.verbatim.style">
|
||||
<xsl:attribute name="background-color">#F0F0F0</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="list.block.spacing">
|
||||
<xsl:attribute name="space-before.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="example.properties">
|
||||
<xsl:attribute name="space-before.minimum">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.optimum">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="sidebar.properties">
|
||||
<xsl:attribute name="border-color">#444444</xsl:attribute>
|
||||
<xsl:attribute name="border-style">solid</xsl:attribute>
|
||||
<xsl:attribute name="border-width">0.1pt</xsl:attribute>
|
||||
<xsl:attribute name="background-color">#F0F0F0</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
|
||||
<!-- TITLE INFORMATION FOR FIGURES, EXAMPLES ETC. -->
|
||||
|
||||
<xsl:attribute-set name="formal.title.properties" use-attribute-sets="normal.para.spacing">
|
||||
<xsl:attribute name="font-weight">normal</xsl:attribute>
|
||||
<xsl:attribute name="font-style">italic</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="hyphenate">false</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- CALLOUTS -->
|
||||
|
||||
<!-- don't use images for callouts -->
|
||||
<xsl:param name="callout.graphics">0</xsl:param>
|
||||
<xsl:param name="callout.unicode">1</xsl:param>
|
||||
|
||||
<!-- Place callout marks at this column in annotated areas -->
|
||||
<xsl:param name="callout.defaultcolumn">90</xsl:param>
|
||||
|
||||
<!-- MISC -->
|
||||
|
||||
<!-- Placement of titles -->
|
||||
<xsl:param name="formal.title.placement">
|
||||
figure after
|
||||
example after
|
||||
equation before
|
||||
table before
|
||||
procedure before
|
||||
</xsl:param>
|
||||
|
||||
<!-- Format Variable Lists as Blocks (prevents horizontal overflow) -->
|
||||
<xsl:param name="variablelist.as.blocks">1</xsl:param>
|
||||
<xsl:param name="body.start.indent">0pt</xsl:param>
|
||||
|
||||
<!-- Remove "Chapter" from the Chapter titles... -->
|
||||
<xsl:param name="local.l10n.xml" select="document('')"/>
|
||||
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
|
||||
<l:l10n language="en">
|
||||
<l:context name="title-numbered">
|
||||
<l:template name="chapter" text="%n. %t"/>
|
||||
<l:template name="section" text="%n %t"/>
|
||||
</l:context>
|
||||
<l:context name="title">
|
||||
<l:template name="example" text="Example %n %t"/>
|
||||
</l:context>
|
||||
</l:l10n>
|
||||
</l:i18n>
|
||||
|
||||
<!-- admon -->
|
||||
<xsl:param name="admon.graphics" select="0"/>
|
||||
|
||||
<xsl:attribute-set name="nongraphical.admonition.properties">
|
||||
<xsl:attribute name="margin-left">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="margin-right">2em</xsl:attribute>
|
||||
<xsl:attribute name="border-left-width">.75pt</xsl:attribute>
|
||||
<xsl:attribute name="border-left-style">solid</xsl:attribute>
|
||||
<xsl:attribute name="border-left-color">#5c5c4f</xsl:attribute>
|
||||
<xsl:attribute name="padding-left">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.optimum">1.5em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">1.5em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">1.5em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">1.5em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">1.5em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">1.5em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="admonition.title.properties">
|
||||
<xsl:attribute name="font-size">10pt</xsl:attribute>
|
||||
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
||||
<xsl:attribute name="hyphenate">false</xsl:attribute>
|
||||
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
|
||||
<xsl:attribute name="margin-left">0</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="admonition.properties">
|
||||
<xsl:attribute name="space-before.optimum">0em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Asciidoc -->
|
||||
<xsl:template match="processing-instruction('asciidoc-br')">
|
||||
<fo:block/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="processing-instruction('asciidoc-hr')">
|
||||
<fo:block space-after="1em">
|
||||
<fo:leader leader-pattern="rule" rule-thickness="0.5pt" rule-style="solid" leader-length.minimum="100%"/>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="processing-instruction('asciidoc-pagebreak')">
|
||||
<fo:block break-after='page'/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- SYNTAX HIGHLIGHT -->
|
||||
|
||||
<xsl:template match='xslthl:keyword' mode="xslthl">
|
||||
<fo:inline font-weight="bold" color="#7F0055"><xsl:apply-templates mode="xslthl"/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:string' mode="xslthl">
|
||||
<fo:inline font-weight="bold" font-style="italic" color="#2A00FF"><xsl:apply-templates mode="xslthl"/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:comment' mode="xslthl">
|
||||
<fo:inline font-style="italic" color="#3F5FBF"><xsl:apply-templates mode="xslthl"/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:tag' mode="xslthl">
|
||||
<fo:inline font-weight="bold" color="#3F7F7F"><xsl:apply-templates mode="xslthl"/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:attribute' mode="xslthl">
|
||||
<fo:inline font-weight="bold" color="#7F007F"><xsl:apply-templates mode="xslthl"/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:value' mode="xslthl">
|
||||
<fo:inline font-weight="bold" color="#2A00FF"><xsl:apply-templates mode="xslthl"/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xslthl-config>
|
||||
<highlighter id="java" file="./xslthl/java-hl.xml" />
|
||||
<highlighter id="groovy" file="./xslthl/java-hl.xml" />
|
||||
<highlighter id="html" file="./xslthl/html-hl.xml" />
|
||||
<highlighter id="ini" file="./xslthl/ini-hl.xml" />
|
||||
<highlighter id="php" file="./xslthl/php-hl.xml" />
|
||||
<highlighter id="c" file="./xslthl/c-hl.xml" />
|
||||
<highlighter id="cpp" file="./xslthl/cpp-hl.xml" />
|
||||
<highlighter id="csharp" file="./xslthl/csharp-hl.xml" />
|
||||
<highlighter id="python" file="./xslthl/python-hl.xml" />
|
||||
<highlighter id="ruby" file="./xslthl/ruby-hl.xml" />
|
||||
<highlighter id="perl" file="./xslthl/perl-hl.xml" />
|
||||
<highlighter id="javascript" file="./xslthl/javascript-hl.xml" />
|
||||
<highlighter id="bash" file="./xslthl/bourne-hl.xml" />
|
||||
<highlighter id="css" file="./xslthl/css-hl.xml" />
|
||||
<highlighter id="sql" file="./xslthl/sql2003-hl.xml" />
|
||||
<highlighter id="asciidoc" file="./xslthl/asciidoc-hl.xml" />
|
||||
<highlighter id="properties" file="./xslthl/properties-hl.xml" />
|
||||
<highlighter id="json" file="./xslthl/json-hl.xml" />
|
||||
<highlighter id="yaml" file="./xslthl/yaml-hl.xml" />
|
||||
<namespace prefix="xslthl" uri="http://xslthl.sf.net" />
|
||||
</xslthl-config>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Syntax highlighting definition for AsciiDoc files
|
||||
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="multiline-comment">
|
||||
<start>////</start>
|
||||
<end>////</end>
|
||||
</highlighter>
|
||||
<highlighter type="oneline-comment">
|
||||
<start>//</start>
|
||||
<solitary/>
|
||||
</highlighter>
|
||||
<highlighter type="regex">
|
||||
<pattern>^(={1,6} .+)$</pattern>
|
||||
<style>heading</style>
|
||||
<flags>MULTILINE</flags>
|
||||
</highlighter>
|
||||
<highlighter type="regex">
|
||||
<pattern>^(\.[^\.\s].+)$</pattern>
|
||||
<style>title</style>
|
||||
<flags>MULTILINE</flags>
|
||||
</highlighter>
|
||||
<highlighter type="regex">
|
||||
<pattern>^(:!?\w.*?:)</pattern>
|
||||
<style>attribute</style>
|
||||
<flags>MULTILINE</flags>
|
||||
</highlighter>
|
||||
<highlighter type="regex">
|
||||
<pattern>^(-|\*{1,5}|\d*\.{1,5})(?= .+$)</pattern>
|
||||
<style>bullet</style>
|
||||
<flags>MULTILINE</flags>
|
||||
</highlighter>
|
||||
<highlighter type="regex">
|
||||
<pattern>^(\[.+\])$</pattern>
|
||||
<style>attribute</style>
|
||||
<flags>MULTILINE</flags>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
Syntax highlighting definition for SH
|
||||
|
||||
xslthl - XSLT Syntax Highlighting
|
||||
http://sourceforge.net/projects/xslthl/
|
||||
Copyright (C) 2010 Mathieu Malaterre
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="oneline-comment">#</highlighter>
|
||||
<highlighter type="heredoc">
|
||||
<start><<</start>
|
||||
<quote>'</quote>
|
||||
<quote>"</quote>
|
||||
<flag>-</flag>
|
||||
<noWhiteSpace />
|
||||
<looseTerminator />
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>"</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>'</string>
|
||||
<escape>\</escape>
|
||||
<spanNewLines />
|
||||
</highlighter>
|
||||
<highlighter type="hexnumber">
|
||||
<prefix>0x</prefix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="number">
|
||||
<point>.</point>
|
||||
<pointStarts />
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="keywords">
|
||||
<!-- reserved words -->
|
||||
<keyword>if</keyword>
|
||||
<keyword>then</keyword>
|
||||
<keyword>else</keyword>
|
||||
<keyword>elif</keyword>
|
||||
<keyword>fi</keyword>
|
||||
<keyword>case</keyword>
|
||||
<keyword>esac</keyword>
|
||||
<keyword>for</keyword>
|
||||
<keyword>while</keyword>
|
||||
<keyword>until</keyword>
|
||||
<keyword>do</keyword>
|
||||
<keyword>done</keyword>
|
||||
<!-- built-ins -->
|
||||
<keyword>exec</keyword>
|
||||
<keyword>shift</keyword>
|
||||
<keyword>exit</keyword>
|
||||
<keyword>times</keyword>
|
||||
<keyword>break</keyword>
|
||||
<keyword>export</keyword>
|
||||
<keyword>trap</keyword>
|
||||
<keyword>continue</keyword>
|
||||
<keyword>readonly</keyword>
|
||||
<keyword>wait</keyword>
|
||||
<keyword>eval</keyword>
|
||||
<keyword>return</keyword>
|
||||
<!-- other commands -->
|
||||
<keyword>cd</keyword>
|
||||
<keyword>echo</keyword>
|
||||
<keyword>hash</keyword>
|
||||
<keyword>pwd</keyword>
|
||||
<keyword>read</keyword>
|
||||
<keyword>set</keyword>
|
||||
<keyword>test</keyword>
|
||||
<keyword>type</keyword>
|
||||
<keyword>ulimit</keyword>
|
||||
<keyword>umask</keyword>
|
||||
<keyword>unset</keyword>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Syntax highlighting definition for C
|
||||
|
||||
xslthl - XSLT Syntax Highlighting
|
||||
http://sourceforge.net/projects/xslthl/
|
||||
Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Michal Molhanec <mol1111 at users.sourceforge.net>
|
||||
Jirka Kosek <kosek at users.sourceforge.net>
|
||||
Michiel Hendriks <elmuerte at users.sourceforge.net>
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="multiline-comment">
|
||||
<start>/**</start>
|
||||
<end>*/</end>
|
||||
<style>doccomment</style>
|
||||
</highlighter>
|
||||
<highlighter type="oneline-comment">
|
||||
<start><![CDATA[/// ]]></start>
|
||||
<style>doccomment</style>
|
||||
</highlighter>
|
||||
<highlighter type="multiline-comment">
|
||||
<start>/*</start>
|
||||
<end>*/</end>
|
||||
</highlighter>
|
||||
<highlighter type="oneline-comment">//</highlighter>
|
||||
<highlighter type="oneline-comment">
|
||||
<!-- use the online-comment highlighter to detect directives -->
|
||||
<start>#</start>
|
||||
<lineBreakEscape>\</lineBreakEscape>
|
||||
<style>directive</style>
|
||||
<solitary />
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>"</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>'</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="hexnumber">
|
||||
<prefix>0x</prefix>
|
||||
<suffix>ul</suffix>
|
||||
<suffix>lu</suffix>
|
||||
<suffix>u</suffix>
|
||||
<suffix>l</suffix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="number">
|
||||
<point>.</point>
|
||||
<pointStarts />
|
||||
<exponent>e</exponent>
|
||||
<suffix>ul</suffix>
|
||||
<suffix>lu</suffix>
|
||||
<suffix>u</suffix>
|
||||
<suffix>f</suffix>
|
||||
<suffix>l</suffix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="keywords">
|
||||
<keyword>auto</keyword>
|
||||
<keyword>_Bool</keyword>
|
||||
<keyword>break</keyword>
|
||||
<keyword>case</keyword>
|
||||
<keyword>char</keyword>
|
||||
<keyword>_Complex</keyword>
|
||||
<keyword>const</keyword>
|
||||
<keyword>continue</keyword>
|
||||
<keyword>default</keyword>
|
||||
<keyword>do</keyword>
|
||||
<keyword>double</keyword>
|
||||
<keyword>else</keyword>
|
||||
<keyword>enum</keyword>
|
||||
<keyword>extern</keyword>
|
||||
<keyword>float</keyword>
|
||||
<keyword>for</keyword>
|
||||
<keyword>goto</keyword>
|
||||
<keyword>if</keyword>
|
||||
<keyword>_Imaginary</keyword>
|
||||
<keyword>inline</keyword>
|
||||
<keyword>int</keyword>
|
||||
<keyword>long</keyword>
|
||||
<keyword>register</keyword>
|
||||
<keyword>restrict</keyword>
|
||||
<keyword>return</keyword>
|
||||
<keyword>short</keyword>
|
||||
<keyword>signed</keyword>
|
||||
<keyword>sizeof</keyword>
|
||||
<keyword>static</keyword>
|
||||
<keyword>struct</keyword>
|
||||
<keyword>switch</keyword>
|
||||
<keyword>typedef</keyword>
|
||||
<keyword>union</keyword>
|
||||
<keyword>unsigned</keyword>
|
||||
<keyword>void</keyword>
|
||||
<keyword>volatile</keyword>
|
||||
<keyword>while</keyword>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,151 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Syntax highlighting definition for C++
|
||||
|
||||
xslthl - XSLT Syntax Highlighting
|
||||
http://sourceforge.net/projects/xslthl/
|
||||
Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Michal Molhanec <mol1111 at users.sourceforge.net>
|
||||
Jirka Kosek <kosek at users.sourceforge.net>
|
||||
Michiel Hendriks <elmuerte at users.sourceforge.net>
|
||||
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="multiline-comment">
|
||||
<start>/**</start>
|
||||
<end>*/</end>
|
||||
<style>doccomment</style>
|
||||
</highlighter>
|
||||
<highlighter type="oneline-comment">
|
||||
<start><![CDATA[/// ]]></start>
|
||||
<style>doccomment</style>
|
||||
</highlighter>
|
||||
<highlighter type="multiline-comment">
|
||||
<start>/*</start>
|
||||
<end>*/</end>
|
||||
</highlighter>
|
||||
<highlighter type="oneline-comment">//</highlighter>
|
||||
<highlighter type="oneline-comment">
|
||||
<!-- use the online-comment highlighter to detect directives -->
|
||||
<start>#</start>
|
||||
<lineBreakEscape>\</lineBreakEscape>
|
||||
<style>directive</style>
|
||||
<solitary/>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>"</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>'</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="hexnumber">
|
||||
<prefix>0x</prefix>
|
||||
<suffix>ul</suffix>
|
||||
<suffix>lu</suffix>
|
||||
<suffix>u</suffix>
|
||||
<suffix>l</suffix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="number">
|
||||
<point>.</point>
|
||||
<pointStarts />
|
||||
<exponent>e</exponent>
|
||||
<suffix>ul</suffix>
|
||||
<suffix>lu</suffix>
|
||||
<suffix>u</suffix>
|
||||
<suffix>f</suffix>
|
||||
<suffix>l</suffix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="keywords">
|
||||
<!-- C keywords -->
|
||||
<keyword>auto</keyword>
|
||||
<keyword>_Bool</keyword>
|
||||
<keyword>break</keyword>
|
||||
<keyword>case</keyword>
|
||||
<keyword>char</keyword>
|
||||
<keyword>_Complex</keyword>
|
||||
<keyword>const</keyword>
|
||||
<keyword>continue</keyword>
|
||||
<keyword>default</keyword>
|
||||
<keyword>do</keyword>
|
||||
<keyword>double</keyword>
|
||||
<keyword>else</keyword>
|
||||
<keyword>enum</keyword>
|
||||
<keyword>extern</keyword>
|
||||
<keyword>float</keyword>
|
||||
<keyword>for</keyword>
|
||||
<keyword>goto</keyword>
|
||||
<keyword>if</keyword>
|
||||
<keyword>_Imaginary</keyword>
|
||||
<keyword>inline</keyword>
|
||||
<keyword>int</keyword>
|
||||
<keyword>long</keyword>
|
||||
<keyword>register</keyword>
|
||||
<keyword>restrict</keyword>
|
||||
<keyword>return</keyword>
|
||||
<keyword>short</keyword>
|
||||
<keyword>signed</keyword>
|
||||
<keyword>sizeof</keyword>
|
||||
<keyword>static</keyword>
|
||||
<keyword>struct</keyword>
|
||||
<keyword>switch</keyword>
|
||||
<keyword>typedef</keyword>
|
||||
<keyword>union</keyword>
|
||||
<keyword>unsigned</keyword>
|
||||
<keyword>void</keyword>
|
||||
<keyword>volatile</keyword>
|
||||
<keyword>while</keyword>
|
||||
<!-- C++ keywords -->
|
||||
<keyword>asm</keyword>
|
||||
<keyword>dynamic_cast</keyword>
|
||||
<keyword>namespace</keyword>
|
||||
<keyword>reinterpret_cast</keyword>
|
||||
<keyword>try</keyword>
|
||||
<keyword>bool</keyword>
|
||||
<keyword>explicit</keyword>
|
||||
<keyword>new</keyword>
|
||||
<keyword>static_cast</keyword>
|
||||
<keyword>typeid</keyword>
|
||||
<keyword>catch</keyword>
|
||||
<keyword>false</keyword>
|
||||
<keyword>operator</keyword>
|
||||
<keyword>template</keyword>
|
||||
<keyword>typename</keyword>
|
||||
<keyword>class</keyword>
|
||||
<keyword>friend</keyword>
|
||||
<keyword>private</keyword>
|
||||
<keyword>this</keyword>
|
||||
<keyword>using</keyword>
|
||||
<keyword>const_cast</keyword>
|
||||
<keyword>inline</keyword>
|
||||
<keyword>public</keyword>
|
||||
<keyword>throw</keyword>
|
||||
<keyword>virtual</keyword>
|
||||
<keyword>delete</keyword>
|
||||
<keyword>mutable</keyword>
|
||||
<keyword>protected</keyword>
|
||||
<keyword>true</keyword>
|
||||
<keyword>wchar_t</keyword>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,194 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Syntax highlighting definition for C#
|
||||
|
||||
xslthl - XSLT Syntax Highlighting
|
||||
http://sourceforge.net/projects/xslthl/
|
||||
Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Michal Molhanec <mol1111 at users.sourceforge.net>
|
||||
Jirka Kosek <kosek at users.sourceforge.net>
|
||||
Michiel Hendriks <elmuerte at users.sourceforge.net>
|
||||
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="multiline-comment">
|
||||
<start>/**</start>
|
||||
<end>*/</end>
|
||||
<style>doccomment</style>
|
||||
</highlighter>
|
||||
<highlighter type="oneline-comment">
|
||||
<start>///</start>
|
||||
<style>doccomment</style>
|
||||
</highlighter>
|
||||
<highlighter type="multiline-comment">
|
||||
<start>/*</start>
|
||||
<end>*/</end>
|
||||
</highlighter>
|
||||
<highlighter type="oneline-comment">//</highlighter>
|
||||
<highlighter type="annotation">
|
||||
<!-- annotations are called (custom) "attributes" in .NET -->
|
||||
<start>[</start>
|
||||
<end>]</end>
|
||||
<valueStart>(</valueStart>
|
||||
<valueEnd>)</valueEnd>
|
||||
</highlighter>
|
||||
<highlighter type="oneline-comment">
|
||||
<!-- C# supports a couple of directives -->
|
||||
<start>#</start>
|
||||
<lineBreakEscape>\</lineBreakEscape>
|
||||
<style>directive</style>
|
||||
<solitary/>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<!-- strings starting with an "@" can span multiple lines -->
|
||||
<string>@"</string>
|
||||
<endString>"</endString>
|
||||
<escape>\</escape>
|
||||
<spanNewLines />
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>"</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>'</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="hexnumber">
|
||||
<prefix>0x</prefix>
|
||||
<suffix>ul</suffix>
|
||||
<suffix>lu</suffix>
|
||||
<suffix>u</suffix>
|
||||
<suffix>l</suffix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="number">
|
||||
<point>.</point>
|
||||
<pointStarts />
|
||||
<exponent>e</exponent>
|
||||
<suffix>ul</suffix>
|
||||
<suffix>lu</suffix>
|
||||
<suffix>u</suffix>
|
||||
<suffix>f</suffix>
|
||||
<suffix>d</suffix>
|
||||
<suffix>m</suffix>
|
||||
<suffix>l</suffix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="keywords">
|
||||
<keyword>abstract</keyword>
|
||||
<keyword>as</keyword>
|
||||
<keyword>base</keyword>
|
||||
<keyword>bool</keyword>
|
||||
<keyword>break</keyword>
|
||||
<keyword>byte</keyword>
|
||||
<keyword>case</keyword>
|
||||
<keyword>catch</keyword>
|
||||
<keyword>char</keyword>
|
||||
<keyword>checked</keyword>
|
||||
<keyword>class</keyword>
|
||||
<keyword>const</keyword>
|
||||
<keyword>continue</keyword>
|
||||
<keyword>decimal</keyword>
|
||||
<keyword>default</keyword>
|
||||
<keyword>delegate</keyword>
|
||||
<keyword>do</keyword>
|
||||
<keyword>double</keyword>
|
||||
<keyword>else</keyword>
|
||||
<keyword>enum</keyword>
|
||||
<keyword>event</keyword>
|
||||
<keyword>explicit</keyword>
|
||||
<keyword>extern</keyword>
|
||||
<keyword>false</keyword>
|
||||
<keyword>finally</keyword>
|
||||
<keyword>fixed</keyword>
|
||||
<keyword>float</keyword>
|
||||
<keyword>for</keyword>
|
||||
<keyword>foreach</keyword>
|
||||
<keyword>goto</keyword>
|
||||
<keyword>if</keyword>
|
||||
<keyword>implicit</keyword>
|
||||
<keyword>in</keyword>
|
||||
<keyword>int</keyword>
|
||||
<keyword>interface</keyword>
|
||||
<keyword>internal</keyword>
|
||||
<keyword>is</keyword>
|
||||
<keyword>lock</keyword>
|
||||
<keyword>long</keyword>
|
||||
<keyword>namespace</keyword>
|
||||
<keyword>new</keyword>
|
||||
<keyword>null</keyword>
|
||||
<keyword>object</keyword>
|
||||
<keyword>operator</keyword>
|
||||
<keyword>out</keyword>
|
||||
<keyword>override</keyword>
|
||||
<keyword>params</keyword>
|
||||
<keyword>private</keyword>
|
||||
<keyword>protected</keyword>
|
||||
<keyword>public</keyword>
|
||||
<keyword>readonly</keyword>
|
||||
<keyword>ref</keyword>
|
||||
<keyword>return</keyword>
|
||||
<keyword>sbyte</keyword>
|
||||
<keyword>sealed</keyword>
|
||||
<keyword>short</keyword>
|
||||
<keyword>sizeof</keyword>
|
||||
<keyword>stackalloc</keyword>
|
||||
<keyword>static</keyword>
|
||||
<keyword>string</keyword>
|
||||
<keyword>struct</keyword>
|
||||
<keyword>switch</keyword>
|
||||
<keyword>this</keyword>
|
||||
<keyword>throw</keyword>
|
||||
<keyword>true</keyword>
|
||||
<keyword>try</keyword>
|
||||
<keyword>typeof</keyword>
|
||||
<keyword>uint</keyword>
|
||||
<keyword>ulong</keyword>
|
||||
<keyword>unchecked</keyword>
|
||||
<keyword>unsafe</keyword>
|
||||
<keyword>ushort</keyword>
|
||||
<keyword>using</keyword>
|
||||
<keyword>virtual</keyword>
|
||||
<keyword>void</keyword>
|
||||
<keyword>volatile</keyword>
|
||||
<keyword>while</keyword>
|
||||
</highlighter>
|
||||
<highlighter type="keywords">
|
||||
<!-- special words, not really keywords -->
|
||||
<keyword>add</keyword>
|
||||
<keyword>alias</keyword>
|
||||
<keyword>from</keyword>
|
||||
<keyword>get</keyword>
|
||||
<keyword>global</keyword>
|
||||
<keyword>group</keyword>
|
||||
<keyword>into</keyword>
|
||||
<keyword>join</keyword>
|
||||
<keyword>orderby</keyword>
|
||||
<keyword>partial</keyword>
|
||||
<keyword>remove</keyword>
|
||||
<keyword>select</keyword>
|
||||
<keyword>set</keyword>
|
||||
<keyword>value</keyword>
|
||||
<keyword>where</keyword>
|
||||
<keyword>yield</keyword>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,176 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Syntax highlighting definition for CSS files
|
||||
|
||||
xslthl - XSLT Syntax Highlighting
|
||||
http://sourceforge.net/projects/xslthl/
|
||||
Copyright (C) 2011-2012 Martin Hujer, Michiel Hendriks
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Martin Hujer <mhujer at users.sourceforge.net>
|
||||
Michiel Hendriks <elmuerte at users.sourceforge.net>
|
||||
|
||||
Reference: http://www.w3.org/TR/CSS21/propidx.html
|
||||
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="multiline-comment">
|
||||
<start>/*</start>
|
||||
<end>*/</end>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>"</string>
|
||||
<escape>\</escape>
|
||||
<spanNewLines/>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>'</string>
|
||||
<escape>\</escape>
|
||||
<spanNewLines/>
|
||||
</highlighter>
|
||||
<highlighter type="number">
|
||||
<point>.</point>
|
||||
<pointStarts />
|
||||
</highlighter>
|
||||
<highlighter type="word">
|
||||
<word>@charset</word>
|
||||
<word>@import</word>
|
||||
<word>@media</word>
|
||||
<word>@page</word>
|
||||
<style>directive</style>
|
||||
</highlighter>
|
||||
<highlighter type="keywords">
|
||||
<partChars>-</partChars>
|
||||
<keyword>azimuth</keyword>
|
||||
<keyword>background-attachment</keyword>
|
||||
<keyword>background-color</keyword>
|
||||
<keyword>background-image</keyword>
|
||||
<keyword>background-position</keyword>
|
||||
<keyword>background-repeat</keyword>
|
||||
<keyword>background</keyword>
|
||||
<keyword>border-collapse</keyword>
|
||||
<keyword>border-color</keyword>
|
||||
<keyword>border-spacing</keyword>
|
||||
<keyword>border-style</keyword>
|
||||
<keyword>border-top</keyword>
|
||||
<keyword>border-right</keyword>
|
||||
<keyword>border-bottom</keyword>
|
||||
<keyword>border-left</keyword>
|
||||
<keyword>border-top-color</keyword>
|
||||
<keyword>border-right-color</keyword>
|
||||
<keyword>border-bottom-color</keyword>
|
||||
<keyword>border-left-color</keyword>
|
||||
<keyword>border-top-style</keyword>
|
||||
<keyword>border-right-style</keyword>
|
||||
<keyword>border-bottom-style</keyword>
|
||||
<keyword>border-left-style</keyword>
|
||||
<keyword>border-top-width</keyword>
|
||||
<keyword>border-right-width</keyword>
|
||||
<keyword>border-bottom-width</keyword>
|
||||
<keyword>border-left-width</keyword>
|
||||
<keyword>border-width</keyword>
|
||||
<keyword>border</keyword>
|
||||
<keyword>bottom</keyword>
|
||||
<keyword>caption-side</keyword>
|
||||
<keyword>clear</keyword>
|
||||
<keyword>clip</keyword>
|
||||
<keyword>color</keyword>
|
||||
<keyword>content</keyword>
|
||||
<keyword>counter-increment</keyword>
|
||||
<keyword>counter-reset</keyword>
|
||||
<keyword>cue-after</keyword>
|
||||
<keyword>cue-before</keyword>
|
||||
<keyword>cue</keyword>
|
||||
<keyword>cursor</keyword>
|
||||
<keyword>direction</keyword>
|
||||
<keyword>display</keyword>
|
||||
<keyword>elevation</keyword>
|
||||
<keyword>empty-cells</keyword>
|
||||
<keyword>float</keyword>
|
||||
<keyword>font-family</keyword>
|
||||
<keyword>font-size</keyword>
|
||||
<keyword>font-style</keyword>
|
||||
<keyword>font-variant</keyword>
|
||||
<keyword>font-weight</keyword>
|
||||
<keyword>font</keyword>
|
||||
<keyword>height</keyword>
|
||||
<keyword>left</keyword>
|
||||
<keyword>letter-spacing</keyword>
|
||||
<keyword>line-height</keyword>
|
||||
<keyword>list-style-image</keyword>
|
||||
<keyword>list-style-position</keyword>
|
||||
<keyword>list-style-type</keyword>
|
||||
<keyword>list-style</keyword>
|
||||
<keyword>margin-right</keyword>
|
||||
<keyword>margin-left</keyword>
|
||||
<keyword>margin-top</keyword>
|
||||
<keyword>margin-bottom</keyword>
|
||||
<keyword>margin</keyword>
|
||||
<keyword>max-height</keyword>
|
||||
<keyword>max-width</keyword>
|
||||
<keyword>min-height</keyword>
|
||||
<keyword>min-width</keyword>
|
||||
<keyword>orphans</keyword>
|
||||
<keyword>outline-color</keyword>
|
||||
<keyword>outline-style</keyword>
|
||||
<keyword>outline-width</keyword>
|
||||
<keyword>outline</keyword>
|
||||
<keyword>overflow</keyword>
|
||||
<keyword>padding-top</keyword>
|
||||
<keyword>padding-right</keyword>
|
||||
<keyword>padding-bottom</keyword>
|
||||
<keyword>padding-left</keyword>
|
||||
<keyword>padding</keyword>
|
||||
<keyword>page-break-after</keyword>
|
||||
<keyword>page-break-before</keyword>
|
||||
<keyword>page-break-inside</keyword>
|
||||
<keyword>pause-after</keyword>
|
||||
<keyword>pause-before</keyword>
|
||||
<keyword>pause</keyword>
|
||||
<keyword>pitch-range</keyword>
|
||||
<keyword>pitch</keyword>
|
||||
<keyword>play-during</keyword>
|
||||
<keyword>position</keyword>
|
||||
<keyword>quotes</keyword>
|
||||
<keyword>richness</keyword>
|
||||
<keyword>right</keyword>
|
||||
<keyword>speak-header</keyword>
|
||||
<keyword>speak-numeral</keyword>
|
||||
<keyword>speak-punctuation</keyword>
|
||||
<keyword>speak</keyword>
|
||||
<keyword>speech-rate</keyword>
|
||||
<keyword>stress</keyword>
|
||||
<keyword>table-layout</keyword>
|
||||
<keyword>text-align</keyword>
|
||||
<keyword>text-decoration</keyword>
|
||||
<keyword>text-indent</keyword>
|
||||
<keyword>text-transform</keyword>
|
||||
<keyword>top</keyword>
|
||||
<keyword>unicode-bidi</keyword>
|
||||
<keyword>vertical-align</keyword>
|
||||
<keyword>visibility</keyword>
|
||||
<keyword>voice-family</keyword>
|
||||
<keyword>volume</keyword>
|
||||
<keyword>white-space</keyword>
|
||||
<keyword>widows</keyword>
|
||||
<keyword>width</keyword>
|
||||
<keyword>word-spacing</keyword>
|
||||
<keyword>z-index</keyword>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,122 @@
|
||||
<?xml version='1.0'?>
|
||||
<!--
|
||||
|
||||
Bakalarska prace: Zvyraznovani syntaxe v XSLT
|
||||
Michal Molhanec 2005
|
||||
|
||||
myxml-hl.xml - konfigurace zvyraznovace XML, ktera zvlast zvyrazni
|
||||
HTML elementy a XSL elementy
|
||||
|
||||
This file has been customized for the Asciidoctor project (http://asciidoctor.org).
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="xml">
|
||||
<elementSet>
|
||||
<style>htmltag</style>
|
||||
<element>a</element>
|
||||
<element>abbr</element>
|
||||
<element>address</element>
|
||||
<element>area</element>
|
||||
<element>article</element>
|
||||
<element>aside</element>
|
||||
<element>audio</element>
|
||||
<element>b</element>
|
||||
<element>base</element>
|
||||
<element>bdi</element>
|
||||
<element>blockquote</element>
|
||||
<element>body</element>
|
||||
<element>br</element>
|
||||
<element>button</element>
|
||||
<element>caption</element>
|
||||
<element>canvas</element>
|
||||
<element>cite</element>
|
||||
<element>code</element>
|
||||
<element>command</element>
|
||||
<element>col</element>
|
||||
<element>colgroup</element>
|
||||
<element>dd</element>
|
||||
<element>del</element>
|
||||
<element>dialog</element>
|
||||
<element>div</element>
|
||||
<element>dl</element>
|
||||
<element>dt</element>
|
||||
<element>em</element>
|
||||
<element>embed</element>
|
||||
<element>fieldset</element>
|
||||
<element>figcaption</element>
|
||||
<element>figure</element>
|
||||
<element>font</element>
|
||||
<element>form</element>
|
||||
<element>footer</element>
|
||||
<element>h1</element>
|
||||
<element>h2</element>
|
||||
<element>h3</element>
|
||||
<element>h4</element>
|
||||
<element>h5</element>
|
||||
<element>h6</element>
|
||||
<element>head</element>
|
||||
<element>header</element>
|
||||
<element>hr</element>
|
||||
<element>html</element>
|
||||
<element>i</element>
|
||||
<element>iframe</element>
|
||||
<element>img</element>
|
||||
<element>input</element>
|
||||
<element>ins</element>
|
||||
<element>kbd</element>
|
||||
<element>label</element>
|
||||
<element>legend</element>
|
||||
<element>li</element>
|
||||
<element>link</element>
|
||||
<element>map</element>
|
||||
<element>mark</element>
|
||||
<element>menu</element>
|
||||
<element>menu</element>
|
||||
<element>meta</element>
|
||||
<element>nav</element>
|
||||
<element>noscript</element>
|
||||
<element>object</element>
|
||||
<element>ol</element>
|
||||
<element>optgroup</element>
|
||||
<element>option</element>
|
||||
<element>p</element>
|
||||
<element>param</element>
|
||||
<element>pre</element>
|
||||
<element>q</element>
|
||||
<element>samp</element>
|
||||
<element>script</element>
|
||||
<element>section</element>
|
||||
<element>select</element>
|
||||
<element>small</element>
|
||||
<element>source</element>
|
||||
<element>span</element>
|
||||
<element>strong</element>
|
||||
<element>style</element>
|
||||
<element>sub</element>
|
||||
<element>summary</element>
|
||||
<element>sup</element>
|
||||
<element>table</element>
|
||||
<element>tbody</element>
|
||||
<element>td</element>
|
||||
<element>textarea</element>
|
||||
<element>tfoot</element>
|
||||
<element>th</element>
|
||||
<element>thead</element>
|
||||
<element>time</element>
|
||||
<element>title</element>
|
||||
<element>tr</element>
|
||||
<element>track</element>
|
||||
<element>u</element>
|
||||
<element>ul</element>
|
||||
<element>var</element>
|
||||
<element>video</element>
|
||||
<element>wbr</element>
|
||||
<element>xmp</element>
|
||||
<ignoreCase/>
|
||||
</elementSet>
|
||||
<elementPrefix>
|
||||
<style>namespace</style>
|
||||
<prefix>xsl:</prefix>
|
||||
</elementPrefix>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Syntax highlighting definition for ini files
|
||||
|
||||
xslthl - XSLT Syntax Highlighting
|
||||
http://sourceforge.net/projects/xslthl/
|
||||
Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Michal Molhanec <mol1111 at users.sourceforge.net>
|
||||
Jirka Kosek <kosek at users.sourceforge.net>
|
||||
Michiel Hendriks <elmuerte at users.sourceforge.net>
|
||||
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="oneline-comment">;</highlighter>
|
||||
<highlighter type="regex">
|
||||
<!-- ini sections -->
|
||||
<pattern>^(\[.+\]\s*)$</pattern>
|
||||
<style>keyword</style>
|
||||
<flags>MULTILINE</flags>
|
||||
</highlighter>
|
||||
<highlighter type="regex">
|
||||
<!-- the keys in an ini section -->
|
||||
<pattern>^(.+)(?==)</pattern>
|
||||
<style>attribute</style>
|
||||
<flags>MULTILINE</flags>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Syntax highlighting definition for Java
|
||||
|
||||
xslthl - XSLT Syntax Highlighting
|
||||
http://sourceforge.net/projects/xslthl/
|
||||
Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Michal Molhanec <mol1111 at users.sourceforge.net>
|
||||
Jirka Kosek <kosek at users.sourceforge.net>
|
||||
Michiel Hendriks <elmuerte at users.sourceforge.net>
|
||||
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="multiline-comment">
|
||||
<start>/**</start>
|
||||
<end>*/</end>
|
||||
<style>doccomment</style>
|
||||
</highlighter>
|
||||
<highlighter type="multiline-comment">
|
||||
<start>/*</start>
|
||||
<end>*/</end>
|
||||
</highlighter>
|
||||
<highlighter type="oneline-comment">//</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>"</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>'</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="annotation">
|
||||
<start>@</start>
|
||||
<valueStart>(</valueStart>
|
||||
<valueEnd>)</valueEnd>
|
||||
</highlighter>
|
||||
<highlighter type="hexnumber">
|
||||
<prefix>0x</prefix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="number">
|
||||
<point>.</point>
|
||||
<exponent>e</exponent>
|
||||
<suffix>f</suffix>
|
||||
<suffix>d</suffix>
|
||||
<suffix>l</suffix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="keywords">
|
||||
<keyword>abstract</keyword>
|
||||
<keyword>boolean</keyword>
|
||||
<keyword>break</keyword>
|
||||
<keyword>byte</keyword>
|
||||
<keyword>case</keyword>
|
||||
<keyword>catch</keyword>
|
||||
<keyword>char</keyword>
|
||||
<keyword>class</keyword>
|
||||
<keyword>const</keyword>
|
||||
<keyword>continue</keyword>
|
||||
<keyword>default</keyword>
|
||||
<keyword>do</keyword>
|
||||
<keyword>double</keyword>
|
||||
<keyword>else</keyword>
|
||||
<keyword>extends</keyword>
|
||||
<keyword>final</keyword>
|
||||
<keyword>finally</keyword>
|
||||
<keyword>float</keyword>
|
||||
<keyword>for</keyword>
|
||||
<keyword>goto</keyword>
|
||||
<keyword>if</keyword>
|
||||
<keyword>implements</keyword>
|
||||
<keyword>import</keyword>
|
||||
<keyword>instanceof</keyword>
|
||||
<keyword>int</keyword>
|
||||
<keyword>interface</keyword>
|
||||
<keyword>long</keyword>
|
||||
<keyword>native</keyword>
|
||||
<keyword>new</keyword>
|
||||
<keyword>package</keyword>
|
||||
<keyword>private</keyword>
|
||||
<keyword>protected</keyword>
|
||||
<keyword>public</keyword>
|
||||
<keyword>return</keyword>
|
||||
<keyword>short</keyword>
|
||||
<keyword>static</keyword>
|
||||
<keyword>strictfp</keyword>
|
||||
<keyword>super</keyword>
|
||||
<keyword>switch</keyword>
|
||||
<keyword>synchronized</keyword>
|
||||
<keyword>this</keyword>
|
||||
<keyword>throw</keyword>
|
||||
<keyword>throws</keyword>
|
||||
<keyword>transient</keyword>
|
||||
<keyword>try</keyword>
|
||||
<keyword>void</keyword>
|
||||
<keyword>volatile</keyword>
|
||||
<keyword>while</keyword>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Syntax highlighting definition for JavaScript
|
||||
|
||||
xslthl - XSLT Syntax Highlighting
|
||||
http://sourceforge.net/projects/xslthl/
|
||||
Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Michal Molhanec <mol1111 at users.sourceforge.net>
|
||||
Jirka Kosek <kosek at users.sourceforge.net>
|
||||
Michiel Hendriks <elmuerte at users.sourceforge.net>
|
||||
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="multiline-comment">
|
||||
<start>/*</start>
|
||||
<end>*/</end>
|
||||
</highlighter>
|
||||
<highlighter type="oneline-comment">//</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>"</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>'</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="hexnumber">
|
||||
<prefix>0x</prefix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="number">
|
||||
<point>.</point>
|
||||
<exponent>e</exponent>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="keywords">
|
||||
<keyword>break</keyword>
|
||||
<keyword>case</keyword>
|
||||
<keyword>catch</keyword>
|
||||
<keyword>continue</keyword>
|
||||
<keyword>default</keyword>
|
||||
<keyword>delete</keyword>
|
||||
<keyword>do</keyword>
|
||||
<keyword>else</keyword>
|
||||
<keyword>finally</keyword>
|
||||
<keyword>for</keyword>
|
||||
<keyword>function</keyword>
|
||||
<keyword>if</keyword>
|
||||
<keyword>in</keyword>
|
||||
<keyword>instanceof</keyword>
|
||||
<keyword>new</keyword>
|
||||
<keyword>return</keyword>
|
||||
<keyword>switch</keyword>
|
||||
<keyword>this</keyword>
|
||||
<keyword>throw</keyword>
|
||||
<keyword>try</keyword>
|
||||
<keyword>typeof</keyword>
|
||||
<keyword>var</keyword>
|
||||
<keyword>void</keyword>
|
||||
<keyword>while</keyword>
|
||||
<keyword>with</keyword>
|
||||
<!-- future keywords -->
|
||||
<keyword>abstract</keyword>
|
||||
<keyword>boolean</keyword>
|
||||
<keyword>byte</keyword>
|
||||
<keyword>char</keyword>
|
||||
<keyword>class</keyword>
|
||||
<keyword>const</keyword>
|
||||
<keyword>debugger</keyword>
|
||||
<keyword>double</keyword>
|
||||
<keyword>enum</keyword>
|
||||
<keyword>export</keyword>
|
||||
<keyword>extends</keyword>
|
||||
<keyword>final</keyword>
|
||||
<keyword>float</keyword>
|
||||
<keyword>goto</keyword>
|
||||
<keyword>implements</keyword>
|
||||
<keyword>import</keyword>
|
||||
<keyword>int</keyword>
|
||||
<keyword>interface</keyword>
|
||||
<keyword>long</keyword>
|
||||
<keyword>native</keyword>
|
||||
<keyword>package</keyword>
|
||||
<keyword>private</keyword>
|
||||
<keyword>protected</keyword>
|
||||
<keyword>public</keyword>
|
||||
<keyword>short</keyword>
|
||||
<keyword>static</keyword>
|
||||
<keyword>super</keyword>
|
||||
<keyword>synchronized</keyword>
|
||||
<keyword>throws</keyword>
|
||||
<keyword>transient</keyword>
|
||||
<keyword>volatile</keyword>
|
||||
</highlighter>
|
||||
<highlighter type="keywords">
|
||||
<keyword>prototype</keyword>
|
||||
<!-- Global Objects -->
|
||||
<keyword>Array</keyword>
|
||||
<keyword>Boolean</keyword>
|
||||
<keyword>Date</keyword>
|
||||
<keyword>Error</keyword>
|
||||
<keyword>EvalError</keyword>
|
||||
<keyword>Function</keyword>
|
||||
<keyword>Math</keyword>
|
||||
<keyword>Number</keyword>
|
||||
<keyword>Object</keyword>
|
||||
<keyword>RangeError</keyword>
|
||||
<keyword>ReferenceError</keyword>
|
||||
<keyword>RegExp</keyword>
|
||||
<keyword>String</keyword>
|
||||
<keyword>SyntaxError</keyword>
|
||||
<keyword>TypeError</keyword>
|
||||
<keyword>URIError</keyword>
|
||||
<!-- Global functions -->
|
||||
<keyword>decodeURI</keyword>
|
||||
<keyword>decodeURIComponent</keyword>
|
||||
<keyword>encodeURI</keyword>
|
||||
<keyword>encodeURIComponent</keyword>
|
||||
<keyword>eval</keyword>
|
||||
<keyword>isFinite</keyword>
|
||||
<keyword>isNaN</keyword>
|
||||
<keyword>parseFloat</keyword>
|
||||
<keyword>parseInt</keyword>
|
||||
<!-- Global properties -->
|
||||
<keyword>Infinity</keyword>
|
||||
<keyword>NaN</keyword>
|
||||
<keyword>undefined</keyword>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<highlighters>
|
||||
<highlighter type="oneline-comment">#</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>"</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>'</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="annotation">
|
||||
<start>@</start>
|
||||
<valueStart>(</valueStart>
|
||||
<valueEnd>)</valueEnd>
|
||||
</highlighter>
|
||||
<highlighter type="number">
|
||||
<point>.</point>
|
||||
<exponent>e</exponent>
|
||||
<suffix>f</suffix>
|
||||
<suffix>d</suffix>
|
||||
<suffix>l</suffix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="keywords">
|
||||
<keyword>true</keyword>
|
||||
<keyword>false</keyword>
|
||||
</highlighter>
|
||||
<highlighter type="word">
|
||||
<word>{</word>
|
||||
<word>}</word>
|
||||
<word>,</word>
|
||||
<word>[</word>
|
||||
<word>]</word>
|
||||
<style>keyword</style>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Syntax highlighting definition for Perl
|
||||
|
||||
xslthl - XSLT Syntax Highlighting
|
||||
http://sourceforge.net/projects/xslthl/
|
||||
Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Michal Molhanec <mol1111 at users.sourceforge.net>
|
||||
Jirka Kosek <kosek at users.sourceforge.net>
|
||||
Michiel Hendriks <elmuerte at users.sourceforge.net>
|
||||
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="oneline-comment">#</highlighter>
|
||||
<highlighter type="heredoc">
|
||||
<start><<</start>
|
||||
<quote>'</quote>
|
||||
<quote>"</quote>
|
||||
<noWhiteSpace/>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>"</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>'</string>
|
||||
<escape>\</escape>
|
||||
<spanNewLines/>
|
||||
</highlighter>
|
||||
<highlighter type="hexnumber">
|
||||
<prefix>0x</prefix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="number">
|
||||
<point>.</point>
|
||||
<pointStarts />
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="keywords">
|
||||
<keyword>if</keyword>
|
||||
<keyword>unless</keyword>
|
||||
<keyword>while</keyword>
|
||||
<keyword>until</keyword>
|
||||
<keyword>foreach</keyword>
|
||||
<keyword>else</keyword>
|
||||
<keyword>elsif</keyword>
|
||||
<keyword>for</keyword>
|
||||
<keyword>when</keyword>
|
||||
<keyword>default</keyword>
|
||||
<keyword>given</keyword>
|
||||
<!-- Keywords related to the control flow of your perl program -->
|
||||
<keyword>caller</keyword>
|
||||
<keyword>continue</keyword>
|
||||
<keyword>die</keyword>
|
||||
<keyword>do</keyword>
|
||||
<keyword>dump</keyword>
|
||||
<keyword>eval</keyword>
|
||||
<keyword>exit</keyword>
|
||||
<keyword>goto</keyword>
|
||||
<keyword>last</keyword>
|
||||
<keyword>next</keyword>
|
||||
<keyword>redo</keyword>
|
||||
<keyword>return</keyword>
|
||||
<keyword>sub</keyword>
|
||||
<keyword>wantarray</keyword>
|
||||
<!-- Keywords related to scoping -->
|
||||
<keyword>caller</keyword>
|
||||
<keyword>import</keyword>
|
||||
<keyword>local</keyword>
|
||||
<keyword>my</keyword>
|
||||
<keyword>package</keyword>
|
||||
<keyword>use</keyword>
|
||||
<!-- Keywords related to perl modules -->
|
||||
<keyword>do</keyword>
|
||||
<keyword>import</keyword>
|
||||
<keyword>no</keyword>
|
||||
<keyword>package</keyword>
|
||||
<keyword>require</keyword>
|
||||
<keyword>use</keyword>
|
||||
<!-- Keywords related to classes and object-orientedness -->
|
||||
<keyword>bless</keyword>
|
||||
<keyword>dbmclose</keyword>
|
||||
<keyword>dbmopen</keyword>
|
||||
<keyword>package</keyword>
|
||||
<keyword>ref</keyword>
|
||||
<keyword>tie</keyword>
|
||||
<keyword>tied</keyword>
|
||||
<keyword>untie</keyword>
|
||||
<keyword>use</keyword>
|
||||
<!-- operators -->
|
||||
<keyword>and</keyword>
|
||||
<keyword>or</keyword>
|
||||
<keyword>not</keyword>
|
||||
<keyword>eq</keyword>
|
||||
<keyword>ne</keyword>
|
||||
<keyword>lt</keyword>
|
||||
<keyword>gt</keyword>
|
||||
<keyword>le</keyword>
|
||||
<keyword>ge</keyword>
|
||||
<keyword>cmp</keyword>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Syntax highlighting definition for PHP
|
||||
|
||||
xslthl - XSLT Syntax Highlighting
|
||||
http://sourceforge.net/projects/xslthl/
|
||||
Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Michal Molhanec <mol1111 at users.sourceforge.net>
|
||||
Jirka Kosek <kosek at users.sourceforge.net>
|
||||
Michiel Hendriks <elmuerte at users.sourceforge.net>
|
||||
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="multiline-comment">
|
||||
<start>/**</start>
|
||||
<end>*/</end>
|
||||
<style>doccomment</style>
|
||||
</highlighter>
|
||||
<highlighter type="oneline-comment">
|
||||
<start><![CDATA[/// ]]></start>
|
||||
<style>doccomment</style>
|
||||
</highlighter>
|
||||
<highlighter type="multiline-comment">
|
||||
<start>/*</start>
|
||||
<end>*/</end>
|
||||
</highlighter>
|
||||
<highlighter type="oneline-comment">//</highlighter>
|
||||
<highlighter type="oneline-comment">#</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>"</string>
|
||||
<escape>\</escape>
|
||||
<spanNewLines />
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>'</string>
|
||||
<escape>\</escape>
|
||||
<spanNewLines />
|
||||
</highlighter>
|
||||
<highlighter type="heredoc">
|
||||
<start><<<</start>
|
||||
</highlighter>
|
||||
<highlighter type="hexnumber">
|
||||
<prefix>0x</prefix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="number">
|
||||
<point>.</point>
|
||||
<exponent>e</exponent>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="keywords">
|
||||
<keyword>and</keyword>
|
||||
<keyword>or</keyword>
|
||||
<keyword>xor</keyword>
|
||||
<keyword>__FILE__</keyword>
|
||||
<keyword>exception</keyword>
|
||||
<keyword>__LINE__</keyword>
|
||||
<keyword>array</keyword>
|
||||
<keyword>as</keyword>
|
||||
<keyword>break</keyword>
|
||||
<keyword>case</keyword>
|
||||
<keyword>class</keyword>
|
||||
<keyword>const</keyword>
|
||||
<keyword>continue</keyword>
|
||||
<keyword>declare</keyword>
|
||||
<keyword>default</keyword>
|
||||
<keyword>die</keyword>
|
||||
<keyword>do</keyword>
|
||||
<keyword>echo</keyword>
|
||||
<keyword>else</keyword>
|
||||
<keyword>elseif</keyword>
|
||||
<keyword>empty</keyword>
|
||||
<keyword>enddeclare</keyword>
|
||||
<keyword>endfor</keyword>
|
||||
<keyword>endforeach</keyword>
|
||||
<keyword>endif</keyword>
|
||||
<keyword>endswitch</keyword>
|
||||
<keyword>endwhile</keyword>
|
||||
<keyword>eval</keyword>
|
||||
<keyword>exit</keyword>
|
||||
<keyword>extends</keyword>
|
||||
<keyword>for</keyword>
|
||||
<keyword>foreach</keyword>
|
||||
<keyword>function</keyword>
|
||||
<keyword>global</keyword>
|
||||
<keyword>if</keyword>
|
||||
<keyword>include</keyword>
|
||||
<keyword>include_once</keyword>
|
||||
<keyword>isset</keyword>
|
||||
<keyword>list</keyword>
|
||||
<keyword>new</keyword>
|
||||
<keyword>print</keyword>
|
||||
<keyword>require</keyword>
|
||||
<keyword>require_once</keyword>
|
||||
<keyword>return</keyword>
|
||||
<keyword>static</keyword>
|
||||
<keyword>switch</keyword>
|
||||
<keyword>unset</keyword>
|
||||
<keyword>use</keyword>
|
||||
<keyword>var</keyword>
|
||||
<keyword>while</keyword>
|
||||
<keyword>__FUNCTION__</keyword>
|
||||
<keyword>__CLASS__</keyword>
|
||||
<keyword>__METHOD__</keyword>
|
||||
<keyword>final</keyword>
|
||||
<keyword>php_user_filter</keyword>
|
||||
<keyword>interface</keyword>
|
||||
<keyword>implements</keyword>
|
||||
<keyword>extends</keyword>
|
||||
<keyword>public</keyword>
|
||||
<keyword>private</keyword>
|
||||
<keyword>protected</keyword>
|
||||
<keyword>abstract</keyword>
|
||||
<keyword>clone</keyword>
|
||||
<keyword>try</keyword>
|
||||
<keyword>catch</keyword>
|
||||
<keyword>throw</keyword>
|
||||
<keyword>cfunction</keyword>
|
||||
<keyword>old_function</keyword>
|
||||
<keyword>true</keyword>
|
||||
<keyword>false</keyword>
|
||||
<!-- PHP 5.3 -->
|
||||
<keyword>namespace</keyword>
|
||||
<keyword>__NAMESPACE__</keyword>
|
||||
<keyword>goto</keyword>
|
||||
<keyword>__DIR__</keyword>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="word">
|
||||
<!-- highlight the php open and close tags as directives -->
|
||||
<word>?></word>
|
||||
<word><?php</word>
|
||||
<word><?=</word>
|
||||
<style>directive</style>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Syntax highlighting definition for Java
|
||||
|
||||
xslthl - XSLT Syntax Highlighting
|
||||
http://sourceforge.net/projects/xslthl/
|
||||
Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Michal Molhanec <mol1111 at users.sourceforge.net>
|
||||
Jirka Kosek <kosek at users.sourceforge.net>
|
||||
Michiel Hendriks <elmuerte at users.sourceforge.net>
|
||||
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="oneline-comment">#</highlighter>
|
||||
<highlighter type="regex">
|
||||
<pattern>^(.+?)(?==|:)</pattern>
|
||||
<style>attribute</style>
|
||||
<flags>MULTILINE</flags>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Syntax highlighting definition for Python
|
||||
|
||||
xslthl - XSLT Syntax Highlighting
|
||||
http://sourceforge.net/projects/xslthl/
|
||||
Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Michal Molhanec <mol1111 at users.sourceforge.net>
|
||||
Jirka Kosek <kosek at users.sourceforge.net>
|
||||
Michiel Hendriks <elmuerte at users.sourceforge.net>
|
||||
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="annotation">
|
||||
<!-- these are actually called decorators -->
|
||||
<start>@</start>
|
||||
<valueStart>(</valueStart>
|
||||
<valueEnd>)</valueEnd>
|
||||
</highlighter>
|
||||
<highlighter type="oneline-comment">#</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>"""</string>
|
||||
<spanNewLines />
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>'''</string>
|
||||
<spanNewLines />
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>"</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>'</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="hexnumber">
|
||||
<prefix>0x</prefix>
|
||||
<suffix>l</suffix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="number">
|
||||
<point>.</point>
|
||||
<pointStarts />
|
||||
<exponent>e</exponent>
|
||||
<suffix>l</suffix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="keywords">
|
||||
<keyword>and</keyword>
|
||||
<keyword>del</keyword>
|
||||
<keyword>from</keyword>
|
||||
<keyword>not</keyword>
|
||||
<keyword>while</keyword>
|
||||
<keyword>as</keyword>
|
||||
<keyword>elif</keyword>
|
||||
<keyword>global</keyword>
|
||||
<keyword>or</keyword>
|
||||
<keyword>with</keyword>
|
||||
<keyword>assert</keyword>
|
||||
<keyword>else</keyword>
|
||||
<keyword>if</keyword>
|
||||
<keyword>pass</keyword>
|
||||
<keyword>yield</keyword>
|
||||
<keyword>break</keyword>
|
||||
<keyword>except</keyword>
|
||||
<keyword>import</keyword>
|
||||
<keyword>print</keyword>
|
||||
<keyword>class</keyword>
|
||||
<keyword>exec</keyword>
|
||||
<keyword>in</keyword>
|
||||
<keyword>raise</keyword>
|
||||
<keyword>continue</keyword>
|
||||
<keyword>finally</keyword>
|
||||
<keyword>is</keyword>
|
||||
<keyword>return</keyword>
|
||||
<keyword>def</keyword>
|
||||
<keyword>for</keyword>
|
||||
<keyword>lambda</keyword>
|
||||
<keyword>try</keyword>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Syntax highlighting definition for Ruby
|
||||
|
||||
xslthl - XSLT Syntax Highlighting
|
||||
http://sourceforge.net/projects/xslthl/
|
||||
Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Michal Molhanec <mol1111 at users.sourceforge.net>
|
||||
Jirka Kosek <kosek at users.sourceforge.net>
|
||||
Michiel Hendriks <elmuerte at users.sourceforge.net>
|
||||
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="oneline-comment">#</highlighter>
|
||||
<highlighter type="heredoc">
|
||||
<start><<</start>
|
||||
<noWhiteSpace/>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>"</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>%Q{</string>
|
||||
<endString>}</endString>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>%/</string>
|
||||
<endString>/</endString>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>'</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>%q{</string>
|
||||
<endString>}</endString>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="hexnumber">
|
||||
<prefix>0x</prefix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="number">
|
||||
<point>.</point>
|
||||
<exponent>e</exponent>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="keywords">
|
||||
<keyword>alias</keyword>
|
||||
<keyword>and</keyword>
|
||||
<keyword>BEGIN</keyword>
|
||||
<keyword>begin</keyword>
|
||||
<keyword>break</keyword>
|
||||
<keyword>case</keyword>
|
||||
<keyword>class</keyword>
|
||||
<keyword>def</keyword>
|
||||
<keyword>defined</keyword>
|
||||
<keyword>do</keyword>
|
||||
<keyword>else</keyword>
|
||||
<keyword>elsif</keyword>
|
||||
<keyword>END</keyword>
|
||||
<keyword>end</keyword>
|
||||
<keyword>ensure</keyword>
|
||||
<keyword>false</keyword>
|
||||
<keyword>for</keyword>
|
||||
<keyword>if</keyword>
|
||||
<keyword>in</keyword>
|
||||
<keyword>module</keyword>
|
||||
<keyword>next</keyword>
|
||||
<keyword>nil</keyword>
|
||||
<keyword>not</keyword>
|
||||
<keyword>or</keyword>
|
||||
<keyword>redo</keyword>
|
||||
<keyword>rescue</keyword>
|
||||
<keyword>retry</keyword>
|
||||
<keyword>return</keyword>
|
||||
<keyword>self</keyword>
|
||||
<keyword>super</keyword>
|
||||
<keyword>then</keyword>
|
||||
<keyword>true</keyword>
|
||||
<keyword>undef</keyword>
|
||||
<keyword>unless</keyword>
|
||||
<keyword>until</keyword>
|
||||
<keyword>when</keyword>
|
||||
<keyword>while</keyword>
|
||||
<keyword>yield</keyword>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,565 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
Syntax highlighting definition for SQL:1999
|
||||
|
||||
xslthl - XSLT Syntax Highlighting
|
||||
http://sourceforge.net/projects/xslthl/
|
||||
Copyright (C) 2012 Michiel Hendriks, Martin Hujer, k42b3
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="oneline-comment">--</highlighter>
|
||||
<highlighter type="multiline-comment">
|
||||
<start>/*</start>
|
||||
<end>*/</end>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>'</string>
|
||||
<doubleEscapes />
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>U'</string>
|
||||
<endString>'</endString>
|
||||
<doubleEscapes />
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>B'</string>
|
||||
<endString>'</endString>
|
||||
<doubleEscapes />
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>N'</string>
|
||||
<endString>'</endString>
|
||||
<doubleEscapes />
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>X'</string>
|
||||
<endString>'</endString>
|
||||
<doubleEscapes />
|
||||
</highlighter>
|
||||
<highlighter type="number">
|
||||
<point>.</point>
|
||||
<pointStarts />
|
||||
<exponent>e</exponent>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="keywords">
|
||||
<ignoreCase />
|
||||
<!-- reserved -->
|
||||
<keyword>A</keyword>
|
||||
<keyword>ABS</keyword>
|
||||
<keyword>ABSOLUTE</keyword>
|
||||
<keyword>ACTION</keyword>
|
||||
<keyword>ADA</keyword>
|
||||
<keyword>ADMIN</keyword>
|
||||
<keyword>AFTER</keyword>
|
||||
<keyword>ALWAYS</keyword>
|
||||
<keyword>ASC</keyword>
|
||||
<keyword>ASSERTION</keyword>
|
||||
<keyword>ASSIGNMENT</keyword>
|
||||
<keyword>ATTRIBUTE</keyword>
|
||||
<keyword>ATTRIBUTES</keyword>
|
||||
<keyword>AVG</keyword>
|
||||
<keyword>BEFORE</keyword>
|
||||
<keyword>BERNOULLI</keyword>
|
||||
<keyword>BREADTH</keyword>
|
||||
<keyword>C</keyword>
|
||||
<keyword>CARDINALITY</keyword>
|
||||
<keyword>CASCADE</keyword>
|
||||
<keyword>CATALOG_NAME</keyword>
|
||||
<keyword>CATALOG</keyword>
|
||||
<keyword>CEIL</keyword>
|
||||
<keyword>CEILING</keyword>
|
||||
<keyword>CHAIN</keyword>
|
||||
<keyword>CHAR_LENGTH</keyword>
|
||||
<keyword>CHARACTER_LENGTH</keyword>
|
||||
<keyword>CHARACTER_SET_CATALOG</keyword>
|
||||
<keyword>CHARACTER_SET_NAME</keyword>
|
||||
<keyword>CHARACTER_SET_SCHEMA</keyword>
|
||||
<keyword>CHARACTERISTICS</keyword>
|
||||
<keyword>CHARACTERS</keyword>
|
||||
<keyword>CHECKED</keyword>
|
||||
<keyword>CLASS_ORIGIN</keyword>
|
||||
<keyword>COALESCE</keyword>
|
||||
<keyword>COBOL</keyword>
|
||||
<keyword>CODE_UNITS</keyword>
|
||||
<keyword>COLLATION_CATALOG</keyword>
|
||||
<keyword>COLLATION_NAME</keyword>
|
||||
<keyword>COLLATION_SCHEMA</keyword>
|
||||
<keyword>COLLATION</keyword>
|
||||
<keyword>COLLECT</keyword>
|
||||
<keyword>COLUMN_NAME</keyword>
|
||||
<keyword>COMMAND_FUNCTION_CODE</keyword>
|
||||
<keyword>COMMAND_FUNCTION</keyword>
|
||||
<keyword>COMMITTED</keyword>
|
||||
<keyword>CONDITION_NUMBER</keyword>
|
||||
<keyword>CONDITION</keyword>
|
||||
<keyword>CONNECTION_NAME</keyword>
|
||||
<keyword>CONSTRAINT_CATALOG</keyword>
|
||||
<keyword>CONSTRAINT_NAME</keyword>
|
||||
<keyword>CONSTRAINT_SCHEMA</keyword>
|
||||
<keyword>CONSTRAINTS</keyword>
|
||||
<keyword>CONSTRUCTORS</keyword>
|
||||
<keyword>CONTAINS</keyword>
|
||||
<keyword>CONVERT</keyword>
|
||||
<keyword>CORR</keyword>
|
||||
<keyword>COUNT</keyword>
|
||||
<keyword>COVAR_POP</keyword>
|
||||
<keyword>COVAR_SAMP</keyword>
|
||||
<keyword>CUME_DIST</keyword>
|
||||
<keyword>CURRENT_COLLATION</keyword>
|
||||
<keyword>CURSOR_NAME</keyword>
|
||||
<keyword>DATA</keyword>
|
||||
<keyword>DATETIME_INTERVAL_CODE</keyword>
|
||||
<keyword>DATETIME_INTERVAL_PRECISION</keyword>
|
||||
<keyword>DEFAULTS</keyword>
|
||||
<keyword>DEFERRABLE</keyword>
|
||||
<keyword>DEFERRED</keyword>
|
||||
<keyword>DEFINED</keyword>
|
||||
<keyword>DEFINER</keyword>
|
||||
<keyword>DEGREE</keyword>
|
||||
<keyword>DENSE_RANK</keyword>
|
||||
<keyword>DEPTH</keyword>
|
||||
<keyword>DERIVED</keyword>
|
||||
<keyword>DESC</keyword>
|
||||
<keyword>DESCRIPTOR</keyword>
|
||||
<keyword>DIAGNOSTICS</keyword>
|
||||
<keyword>DISPATCH</keyword>
|
||||
<keyword>DOMAIN</keyword>
|
||||
<keyword>DYNAMIC_FUNCTION_CODE</keyword>
|
||||
<keyword>DYNAMIC_FUNCTION</keyword>
|
||||
<keyword>EQUALS</keyword>
|
||||
<keyword>EVERY</keyword>
|
||||
<keyword>EXCEPTION</keyword>
|
||||
<keyword>EXCLUDE</keyword>
|
||||
<keyword>EXCLUDING</keyword>
|
||||
<keyword>EXP</keyword>
|
||||
<keyword>EXTRACT</keyword>
|
||||
<keyword>FINAL</keyword>
|
||||
<keyword>FIRST</keyword>
|
||||
<keyword>FLOOR</keyword>
|
||||
<keyword>FOLLOWING</keyword>
|
||||
<keyword>FORTRAN</keyword>
|
||||
<keyword>FOUND</keyword>
|
||||
<keyword>FUSION</keyword>
|
||||
<keyword>G</keyword>
|
||||
<keyword>GENERAL</keyword>
|
||||
<keyword>GO</keyword>
|
||||
<keyword>GOTO</keyword>
|
||||
<keyword>GRANTED</keyword>
|
||||
<keyword>HIERARCHY</keyword>
|
||||
<keyword>IMPLEMENTATION</keyword>
|
||||
<keyword>INCLUDING</keyword>
|
||||
<keyword>INCREMENT</keyword>
|
||||
<keyword>INITIALLY</keyword>
|
||||
<keyword>INSTANCE</keyword>
|
||||
<keyword>INSTANTIABLE</keyword>
|
||||
<keyword>INTERSECTION</keyword>
|
||||
<keyword>INVOKER</keyword>
|
||||
<keyword>ISOLATION</keyword>
|
||||
<keyword>K</keyword>
|
||||
<keyword>KEY_MEMBER</keyword>
|
||||
<keyword>KEY_TYPE</keyword>
|
||||
<keyword>KEY</keyword>
|
||||
<keyword>LAST</keyword>
|
||||
<keyword>LENGTH</keyword>
|
||||
<keyword>LEVEL</keyword>
|
||||
<keyword>LN</keyword>
|
||||
<keyword>LOCATOR</keyword>
|
||||
<keyword>LOWER</keyword>
|
||||
<keyword>M</keyword>
|
||||
<keyword>MAP</keyword>
|
||||
<keyword>MATCHED</keyword>
|
||||
<keyword>MAX</keyword>
|
||||
<keyword>MAXVALUE</keyword>
|
||||
<keyword>MESSAGE_LENGTH</keyword>
|
||||
<keyword>MESSAGE_OCTET_LENGTH</keyword>
|
||||
<keyword>MESSAGE_TEXT</keyword>
|
||||
<keyword>MIN</keyword>
|
||||
<keyword>MINVALUE</keyword>
|
||||
<keyword>MOD</keyword>
|
||||
<keyword>MORE</keyword>
|
||||
<keyword>MUMPS</keyword>
|
||||
<keyword>NAME</keyword>
|
||||
<keyword>NAMES</keyword>
|
||||
<keyword>NESTING</keyword>
|
||||
<keyword>NEXT</keyword>
|
||||
<keyword>NORMALIZE</keyword>
|
||||
<keyword>NORMALIZED</keyword>
|
||||
<keyword>NULLABLE</keyword>
|
||||
<keyword>NULLIF</keyword>
|
||||
<keyword>NULLS</keyword>
|
||||
<keyword>NUMBER</keyword>
|
||||
<keyword>OBJECT</keyword>
|
||||
<keyword>OCTET_LENGTH</keyword>
|
||||
<keyword>OCTETS</keyword>
|
||||
<keyword>OPTION</keyword>
|
||||
<keyword>OPTIONS</keyword>
|
||||
<keyword>ORDERING</keyword>
|
||||
<keyword>ORDINALITY</keyword>
|
||||
<keyword>OTHERS</keyword>
|
||||
<keyword>OVERLAY</keyword>
|
||||
<keyword>OVERRIDING</keyword>
|
||||
<keyword>PAD</keyword>
|
||||
<keyword>PARAMETER_MODE</keyword>
|
||||
<keyword>PARAMETER_NAME</keyword>
|
||||
<keyword>PARAMETER_ORDINAL_POSITION</keyword>
|
||||
<keyword>PARAMETER_SPECIFIC_CATALOG</keyword>
|
||||
<keyword>PARAMETER_SPECIFIC_NAME</keyword>
|
||||
<keyword>PARAMETER_SPECIFIC_SCHEMA</keyword>
|
||||
<keyword>PARTIAL</keyword>
|
||||
<keyword>PASCAL</keyword>
|
||||
<keyword>PATH</keyword>
|
||||
<keyword>PERCENT_RANK</keyword>
|
||||
<keyword>PERCENTILE_CONT</keyword>
|
||||
<keyword>PERCENTILE_DISC</keyword>
|
||||
<keyword>PLACING</keyword>
|
||||
<keyword>PLI</keyword>
|
||||
<keyword>POSITION</keyword>
|
||||
<keyword>POWER</keyword>
|
||||
<keyword>PRECEDING</keyword>
|
||||
<keyword>PRESERVE</keyword>
|
||||
<keyword>PRIOR</keyword>
|
||||
<keyword>PRIVILEGES</keyword>
|
||||
<keyword>PUBLIC</keyword>
|
||||
<keyword>RANK</keyword>
|
||||
<keyword>READ</keyword>
|
||||
<keyword>RELATIVE</keyword>
|
||||
<keyword>REPEATABLE</keyword>
|
||||
<keyword>RESTART</keyword>
|
||||
<keyword>RETURNED_CARDINALITY</keyword>
|
||||
<keyword>RETURNED_LENGTH</keyword>
|
||||
<keyword>RETURNED_OCTET_LENGTH</keyword>
|
||||
<keyword>RETURNED_SQLSTATE</keyword>
|
||||
<keyword>ROLE</keyword>
|
||||
<keyword>ROUTINE_CATALOG</keyword>
|
||||
<keyword>ROUTINE_NAME</keyword>
|
||||
<keyword>ROUTINE_SCHEMA</keyword>
|
||||
<keyword>ROUTINE</keyword>
|
||||
<keyword>ROW_COUNT</keyword>
|
||||
<keyword>ROW_NUMBER</keyword>
|
||||
<keyword>SCALE</keyword>
|
||||
<keyword>SCHEMA_NAME</keyword>
|
||||
<keyword>SCHEMA</keyword>
|
||||
<keyword>SCOPE_CATALOG</keyword>
|
||||
<keyword>SCOPE_NAME</keyword>
|
||||
<keyword>SCOPE_SCHEMA</keyword>
|
||||
<keyword>SECTION</keyword>
|
||||
<keyword>SECURITY</keyword>
|
||||
<keyword>SELF</keyword>
|
||||
<keyword>SEQUENCE</keyword>
|
||||
<keyword>SERIALIZABLE</keyword>
|
||||
<keyword>SERVER_NAME</keyword>
|
||||
<keyword>SESSION</keyword>
|
||||
<keyword>SETS</keyword>
|
||||
<keyword>SIMPLE</keyword>
|
||||
<keyword>SIZE</keyword>
|
||||
<keyword>SOURCE</keyword>
|
||||
<keyword>SPACE</keyword>
|
||||
<keyword>SPECIFIC_NAME</keyword>
|
||||
<keyword>SQRT</keyword>
|
||||
<keyword>STATE</keyword>
|
||||
<keyword>STATEMENT</keyword>
|
||||
<keyword>STDDEV_POP</keyword>
|
||||
<keyword>STDDEV_SAMP</keyword>
|
||||
<keyword>STRUCTURE</keyword>
|
||||
<keyword>STYLE</keyword>
|
||||
<keyword>SUBCLASS_ORIGIN</keyword>
|
||||
<keyword>SUBSTRING</keyword>
|
||||
<keyword>SUM</keyword>
|
||||
<keyword>TABLE_NAME</keyword>
|
||||
<keyword>TABLESAMPLE</keyword>
|
||||
<keyword>TEMPORARY</keyword>
|
||||
<keyword>TIES</keyword>
|
||||
<keyword>TOP_LEVEL_COUNT</keyword>
|
||||
<keyword>TRANSACTION_ACTIVE</keyword>
|
||||
<keyword>TRANSACTION</keyword>
|
||||
<keyword>TRANSACTIONS_COMMITTED</keyword>
|
||||
<keyword>TRANSACTIONS_ROLLED_BACK</keyword>
|
||||
<keyword>TRANSFORM</keyword>
|
||||
<keyword>TRANSFORMS</keyword>
|
||||
<keyword>TRANSLATE</keyword>
|
||||
<keyword>TRIGGER_CATALOG</keyword>
|
||||
<keyword>TRIGGER_NAME</keyword>
|
||||
<keyword>TRIGGER_SCHEMA</keyword>
|
||||
<keyword>TRIM</keyword>
|
||||
<keyword>TYPE</keyword>
|
||||
<keyword>UNBOUNDED</keyword>
|
||||
<keyword>UNCOMMITTED</keyword>
|
||||
<keyword>UNDER</keyword>
|
||||
<keyword>UNNAMED</keyword>
|
||||
<keyword>USAGE</keyword>
|
||||
<keyword>USER_DEFINED_TYPE_CATALOG</keyword>
|
||||
<keyword>USER_DEFINED_TYPE_CODE</keyword>
|
||||
<keyword>USER_DEFINED_TYPE_NAME</keyword>
|
||||
<keyword>USER_DEFINED_TYPE_SCHEMA</keyword>
|
||||
<keyword>VIEW</keyword>
|
||||
<keyword>WORK</keyword>
|
||||
<keyword>WRITE</keyword>
|
||||
<keyword>ZONE</keyword>
|
||||
<!-- non reserved -->
|
||||
<keyword>ADD</keyword>
|
||||
<keyword>ALL</keyword>
|
||||
<keyword>ALLOCATE</keyword>
|
||||
<keyword>ALTER</keyword>
|
||||
<keyword>AND</keyword>
|
||||
<keyword>ANY</keyword>
|
||||
<keyword>ARE</keyword>
|
||||
<keyword>ARRAY</keyword>
|
||||
<keyword>AS</keyword>
|
||||
<keyword>ASENSITIVE</keyword>
|
||||
<keyword>ASYMMETRIC</keyword>
|
||||
<keyword>AT</keyword>
|
||||
<keyword>ATOMIC</keyword>
|
||||
<keyword>AUTHORIZATION</keyword>
|
||||
<keyword>BEGIN</keyword>
|
||||
<keyword>BETWEEN</keyword>
|
||||
<keyword>BIGINT</keyword>
|
||||
<keyword>BINARY</keyword>
|
||||
<keyword>BLOB</keyword>
|
||||
<keyword>BOOLEAN</keyword>
|
||||
<keyword>BOTH</keyword>
|
||||
<keyword>BY</keyword>
|
||||
<keyword>CALL</keyword>
|
||||
<keyword>CALLED</keyword>
|
||||
<keyword>CASCADED</keyword>
|
||||
<keyword>CASE</keyword>
|
||||
<keyword>CAST</keyword>
|
||||
<keyword>CHAR</keyword>
|
||||
<keyword>CHARACTER</keyword>
|
||||
<keyword>CHECK</keyword>
|
||||
<keyword>CLOB</keyword>
|
||||
<keyword>CLOSE</keyword>
|
||||
<keyword>COLLATE</keyword>
|
||||
<keyword>COLUMN</keyword>
|
||||
<keyword>COMMIT</keyword>
|
||||
<keyword>CONNECT</keyword>
|
||||
<keyword>CONSTRAINT</keyword>
|
||||
<keyword>CONTINUE</keyword>
|
||||
<keyword>CORRESPONDING</keyword>
|
||||
<keyword>CREATE</keyword>
|
||||
<keyword>CROSS</keyword>
|
||||
<keyword>CUBE</keyword>
|
||||
<keyword>CURRENT_DATE</keyword>
|
||||
<keyword>CURRENT_DEFAULT_TRANSFORM_GROUP</keyword>
|
||||
<keyword>CURRENT_PATH</keyword>
|
||||
<keyword>CURRENT_ROLE</keyword>
|
||||
<keyword>CURRENT_TIME</keyword>
|
||||
<keyword>CURRENT_TIMESTAMP</keyword>
|
||||
<keyword>CURRENT_TRANSFORM_GROUP_FOR_TYPE</keyword>
|
||||
<keyword>CURRENT_USER</keyword>
|
||||
<keyword>CURRENT</keyword>
|
||||
<keyword>CURSOR</keyword>
|
||||
<keyword>CYCLE</keyword>
|
||||
<keyword>DATE</keyword>
|
||||
<keyword>DAY</keyword>
|
||||
<keyword>DEALLOCATE</keyword>
|
||||
<keyword>DEC</keyword>
|
||||
<keyword>DECIMAL</keyword>
|
||||
<keyword>DECLARE</keyword>
|
||||
<keyword>DEFAULT</keyword>
|
||||
<keyword>DELETE</keyword>
|
||||
<keyword>DEREF</keyword>
|
||||
<keyword>DESCRIBE</keyword>
|
||||
<keyword>DETERMINISTIC</keyword>
|
||||
<keyword>DISCONNECT</keyword>
|
||||
<keyword>DISTINCT</keyword>
|
||||
<keyword>DOUBLE</keyword>
|
||||
<keyword>DROP</keyword>
|
||||
<keyword>DYNAMIC</keyword>
|
||||
<keyword>EACH</keyword>
|
||||
<keyword>ELEMENT</keyword>
|
||||
<keyword>ELSE</keyword>
|
||||
<keyword>END</keyword>
|
||||
<keyword>END-EXEC</keyword>
|
||||
<keyword>ESCAPE</keyword>
|
||||
<keyword>EXCEPT</keyword>
|
||||
<keyword>EXEC</keyword>
|
||||
<keyword>EXECUTE</keyword>
|
||||
<keyword>EXISTS</keyword>
|
||||
<keyword>EXTERNAL</keyword>
|
||||
<keyword>FALSE</keyword>
|
||||
<keyword>FETCH</keyword>
|
||||
<keyword>FILTER</keyword>
|
||||
<keyword>FLOAT</keyword>
|
||||
<keyword>FOR</keyword>
|
||||
<keyword>FOREIGN</keyword>
|
||||
<keyword>FREE</keyword>
|
||||
<keyword>FROM</keyword>
|
||||
<keyword>FULL</keyword>
|
||||
<keyword>FUNCTION</keyword>
|
||||
<keyword>GET</keyword>
|
||||
<keyword>GLOBAL</keyword>
|
||||
<keyword>GRANT</keyword>
|
||||
<keyword>GROUP</keyword>
|
||||
<keyword>GROUPING</keyword>
|
||||
<keyword>HAVING</keyword>
|
||||
<keyword>HOLD</keyword>
|
||||
<keyword>HOUR</keyword>
|
||||
<keyword>IDENTITY</keyword>
|
||||
<keyword>IMMEDIATE</keyword>
|
||||
<keyword>IN</keyword>
|
||||
<keyword>INDICATOR</keyword>
|
||||
<keyword>INNER</keyword>
|
||||
<keyword>INOUT</keyword>
|
||||
<keyword>INPUT</keyword>
|
||||
<keyword>INSENSITIVE</keyword>
|
||||
<keyword>INSERT</keyword>
|
||||
<keyword>INT</keyword>
|
||||
<keyword>INTEGER</keyword>
|
||||
<keyword>INTERSECT</keyword>
|
||||
<keyword>INTERVAL</keyword>
|
||||
<keyword>INTO</keyword>
|
||||
<keyword>IS</keyword>
|
||||
<keyword>ISOLATION</keyword>
|
||||
<keyword>JOIN</keyword>
|
||||
<keyword>LANGUAGE</keyword>
|
||||
<keyword>LARGE</keyword>
|
||||
<keyword>LATERAL</keyword>
|
||||
<keyword>LEADING</keyword>
|
||||
<keyword>LEFT</keyword>
|
||||
<keyword>LIKE</keyword>
|
||||
<keyword>LOCAL</keyword>
|
||||
<keyword>LOCALTIME</keyword>
|
||||
<keyword>LOCALTIMESTAMP</keyword>
|
||||
<keyword>MATCH</keyword>
|
||||
<keyword>MEMBER</keyword>
|
||||
<keyword>MERGE</keyword>
|
||||
<keyword>METHOD</keyword>
|
||||
<keyword>MINUTE</keyword>
|
||||
<keyword>MODIFIES</keyword>
|
||||
<keyword>MODULE</keyword>
|
||||
<keyword>MONTH</keyword>
|
||||
<keyword>MULTISET</keyword>
|
||||
<keyword>NATIONAL</keyword>
|
||||
<keyword>NATURAL</keyword>
|
||||
<keyword>NCHAR</keyword>
|
||||
<keyword>NCLOB</keyword>
|
||||
<keyword>NEW</keyword>
|
||||
<keyword>NO</keyword>
|
||||
<keyword>NONE</keyword>
|
||||
<keyword>NOT</keyword>
|
||||
<keyword>NULL</keyword>
|
||||
<keyword>NUMERIC</keyword>
|
||||
<keyword>OF</keyword>
|
||||
<keyword>OLD</keyword>
|
||||
<keyword>ON</keyword>
|
||||
<keyword>ONLY</keyword>
|
||||
<keyword>OPEN</keyword>
|
||||
<keyword>OR</keyword>
|
||||
<keyword>ORDER</keyword>
|
||||
<keyword>OUT</keyword>
|
||||
<keyword>OUTER</keyword>
|
||||
<keyword>OUTPUT</keyword>
|
||||
<keyword>OVER</keyword>
|
||||
<keyword>OVERLAPS</keyword>
|
||||
<keyword>PARAMETER</keyword>
|
||||
<keyword>PARTITION</keyword>
|
||||
<keyword>PRECISION</keyword>
|
||||
<keyword>PREPARE</keyword>
|
||||
<keyword>PRIMARY</keyword>
|
||||
<keyword>PROCEDURE</keyword>
|
||||
<keyword>RANGE</keyword>
|
||||
<keyword>READS</keyword>
|
||||
<keyword>REAL</keyword>
|
||||
<keyword>RECURSIVE</keyword>
|
||||
<keyword>REF</keyword>
|
||||
<keyword>REFERENCES</keyword>
|
||||
<keyword>REFERENCING</keyword>
|
||||
<keyword>REGR_AVGX</keyword>
|
||||
<keyword>REGR_AVGY</keyword>
|
||||
<keyword>REGR_COUNT</keyword>
|
||||
<keyword>REGR_INTERCEPT</keyword>
|
||||
<keyword>REGR_R2</keyword>
|
||||
<keyword>REGR_SLOPE</keyword>
|
||||
<keyword>REGR_SXX</keyword>
|
||||
<keyword>REGR_SXY</keyword>
|
||||
<keyword>REGR_SYY</keyword>
|
||||
<keyword>RELEASE</keyword>
|
||||
<keyword>RESULT</keyword>
|
||||
<keyword>RETURN</keyword>
|
||||
<keyword>RETURNS</keyword>
|
||||
<keyword>REVOKE</keyword>
|
||||
<keyword>RIGHT</keyword>
|
||||
<keyword>ROLLBACK</keyword>
|
||||
<keyword>ROLLUP</keyword>
|
||||
<keyword>ROW</keyword>
|
||||
<keyword>ROWS</keyword>
|
||||
<keyword>SAVEPOINT</keyword>
|
||||
<keyword>SCROLL</keyword>
|
||||
<keyword>SEARCH</keyword>
|
||||
<keyword>SECOND</keyword>
|
||||
<keyword>SELECT</keyword>
|
||||
<keyword>SENSITIVE</keyword>
|
||||
<keyword>SESSION_USER</keyword>
|
||||
<keyword>SET</keyword>
|
||||
<keyword>SIMILAR</keyword>
|
||||
<keyword>SMALLINT</keyword>
|
||||
<keyword>SOME</keyword>
|
||||
<keyword>SPECIFIC</keyword>
|
||||
<keyword>SPECIFICTYPE</keyword>
|
||||
<keyword>SQL</keyword>
|
||||
<keyword>SQLEXCEPTION</keyword>
|
||||
<keyword>SQLSTATE</keyword>
|
||||
<keyword>SQLWARNING</keyword>
|
||||
<keyword>START</keyword>
|
||||
<keyword>STATIC</keyword>
|
||||
<keyword>SUBMULTISET</keyword>
|
||||
<keyword>SYMMETRIC</keyword>
|
||||
<keyword>SYSTEM_USER</keyword>
|
||||
<keyword>SYSTEM</keyword>
|
||||
<keyword>TABLE</keyword>
|
||||
<keyword>THEN</keyword>
|
||||
<keyword>TIME</keyword>
|
||||
<keyword>TIMESTAMP</keyword>
|
||||
<keyword>TIMEZONE_HOUR</keyword>
|
||||
<keyword>TIMEZONE_MINUTE</keyword>
|
||||
<keyword>TO</keyword>
|
||||
<keyword>TRAILING</keyword>
|
||||
<keyword>TRANSLATION</keyword>
|
||||
<keyword>TREAT</keyword>
|
||||
<keyword>TRIGGER</keyword>
|
||||
<keyword>TRUE</keyword>
|
||||
<keyword>UESCAPE</keyword>
|
||||
<keyword>UNION</keyword>
|
||||
<keyword>UNIQUE</keyword>
|
||||
<keyword>UNKNOWN</keyword>
|
||||
<keyword>UNNEST</keyword>
|
||||
<keyword>UPDATE</keyword>
|
||||
<keyword>UPPER</keyword>
|
||||
<keyword>USER</keyword>
|
||||
<keyword>USING</keyword>
|
||||
<keyword>VALUE</keyword>
|
||||
<keyword>VALUES</keyword>
|
||||
<keyword>VAR_POP</keyword>
|
||||
<keyword>VAR_SAMP</keyword>
|
||||
<keyword>VARCHAR</keyword>
|
||||
<keyword>VARYING</keyword>
|
||||
<keyword>WHEN</keyword>
|
||||
<keyword>WHENEVER</keyword>
|
||||
<keyword>WHERE</keyword>
|
||||
<keyword>WIDTH_BUCKET</keyword>
|
||||
<keyword>WINDOW</keyword>
|
||||
<keyword>WITH</keyword>
|
||||
<keyword>WITHIN</keyword>
|
||||
<keyword>WITHOUT</keyword>
|
||||
<keyword>YEAR</keyword>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<highlighters>
|
||||
<highlighter type="oneline-comment">#</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>"</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="string">
|
||||
<string>'</string>
|
||||
<escape>\</escape>
|
||||
</highlighter>
|
||||
<highlighter type="annotation">
|
||||
<start>@</start>
|
||||
<valueStart>(</valueStart>
|
||||
<valueEnd>)</valueEnd>
|
||||
</highlighter>
|
||||
<highlighter type="number">
|
||||
<point>.</point>
|
||||
<exponent>e</exponent>
|
||||
<suffix>f</suffix>
|
||||
<suffix>d</suffix>
|
||||
<suffix>l</suffix>
|
||||
<ignoreCase />
|
||||
</highlighter>
|
||||
<highlighter type="keywords">
|
||||
<keyword>true</keyword>
|
||||
<keyword>false</keyword>
|
||||
</highlighter>
|
||||
<highlighter type="word">
|
||||
<word>{</word>
|
||||
<word>}</word>
|
||||
<word>,</word>
|
||||
<word>[</word>
|
||||
<word>]</word>
|
||||
<style>keyword</style>
|
||||
</highlighter>
|
||||
<highlighter type="regex">
|
||||
<pattern>^(---)$</pattern>
|
||||
<style>comment</style>
|
||||
<flags>MULTILINE</flags>
|
||||
</highlighter>
|
||||
<highlighter type="regex">
|
||||
<pattern>^(.+?)(?==|:)</pattern>
|
||||
<style>attribute</style>
|
||||
<flags>MULTILINE</flags>
|
||||
</highlighter>
|
||||
</highlighters>
|
||||
@@ -0,0 +1,41 @@
|
||||
def processModule(File moduleDir, File generatedResourcesDir) {
|
||||
def moduleName = moduleDir.name
|
||||
def factoriesFile = new File(moduleDir, 'META-INF/spring.factories')
|
||||
new File(generatedResourcesDir, "auto-configuration-classes-${moduleName}.adoc")
|
||||
.withPrintWriter {
|
||||
generateAutoConfigurationClassTable(moduleName, factoriesFile, it)
|
||||
}
|
||||
}
|
||||
|
||||
def generateAutoConfigurationClassTable(String module, File factories, PrintWriter writer) {
|
||||
writer.println '[cols="4,1"]'
|
||||
writer.println '|==='
|
||||
writer.println '| Configuration Class | Links'
|
||||
|
||||
getAutoConfigurationClasses(factories).each {
|
||||
writer.println ''
|
||||
writer.println "| {github-code}/$module/src/main/java/$it.path.{sc-ext}[`$it.name`]"
|
||||
writer.println "| {dc-root}/$it.path.{dc-ext}[javadoc]"
|
||||
}
|
||||
|
||||
writer.println '|==='
|
||||
}
|
||||
|
||||
def getAutoConfigurationClasses(File factories) {
|
||||
factories.withInputStream {
|
||||
def properties = new Properties()
|
||||
properties.load(it)
|
||||
properties.get('org.springframework.boot.autoconfigure.EnableAutoConfiguration')
|
||||
.split(',')
|
||||
.collect {
|
||||
def path = it.replace('.', '/')
|
||||
def name = it.substring(it.lastIndexOf('.') + 1)
|
||||
[ 'path': path, 'name': name]
|
||||
}
|
||||
.sort {a, b -> a.name.compareTo(b.name)}
|
||||
}
|
||||
}
|
||||
|
||||
def autoConfigDir = new File(project.build.directory, 'auto-config')
|
||||
def generatedResourcesDir = new File(project.build.directory, 'generated-resources')
|
||||
autoConfigDir.eachDir { processModule(it, generatedResourcesDir) }
|
||||
@@ -0,0 +1,76 @@
|
||||
import groovy.util.XmlSlurper
|
||||
|
||||
def getStarters(File dir) {
|
||||
def starters = []
|
||||
new File(project.build.directory, 'external-resources/starter-poms').eachDir { starterDir ->
|
||||
def pom = new XmlSlurper().parse(new File(starterDir, 'pom.xml'))
|
||||
def dependencies = getDependencies(pom)
|
||||
if (isStarter(dependencies)) {
|
||||
def name = pom.artifactId.text()
|
||||
starters << [
|
||||
'name': name,
|
||||
'description': postProcessDescription(pom.description.text()),
|
||||
'dependencies': dependencies,
|
||||
'pomUrl': "{github-code}/spring-boot-starters/$name/pom.xml"
|
||||
]
|
||||
}
|
||||
}
|
||||
return starters.sort { it.name }
|
||||
}
|
||||
|
||||
boolean isApplicationStarter(def starter) {
|
||||
!isTechnicalStarter(starter) && !isProductionStarter(starter)
|
||||
}
|
||||
|
||||
boolean isTechnicalStarter(def starter) {
|
||||
starter.name != 'spring-boot-starter-test' && !isProductionStarter(starter) &&
|
||||
starter.dependencies.find {
|
||||
it.startsWith('org.springframework.boot:spring-boot-starter') } == null
|
||||
}
|
||||
|
||||
boolean isProductionStarter(def starter) {
|
||||
starter.name in ['spring-boot-starter-actuator']
|
||||
}
|
||||
|
||||
boolean isStarter(def dependencies) {
|
||||
!dependencies.empty
|
||||
}
|
||||
|
||||
def postProcessDescription(String description) {
|
||||
addStarterCrossLinks(removeExtraWhitespace(description))
|
||||
}
|
||||
|
||||
def removeExtraWhitespace(String input) {
|
||||
input.replaceAll('\\s+', ' ')
|
||||
}
|
||||
|
||||
def addStarterCrossLinks(String input) {
|
||||
input.replaceAll('(spring-boot-starter[A-Za-z-]*)', '<<$1,`$1`>>')
|
||||
}
|
||||
|
||||
def getDependencies(def pom) {
|
||||
dependencies = []
|
||||
pom.dependencies.dependency.each { dependency ->
|
||||
dependencies << "${dependency.groupId.text()}:${dependency.artifactId.text()}"
|
||||
}
|
||||
dependencies
|
||||
}
|
||||
|
||||
def writeTable(String name, def starters) {
|
||||
new File(project.build.directory, "generated-resources/${name}.adoc").withPrintWriter { writer ->
|
||||
writer.println '|==='
|
||||
writer.println '| Name | Description | Pom'
|
||||
starters.each { starter ->
|
||||
writer.println ''
|
||||
writer.println "| [[${starter.name}]]`${starter.name}`"
|
||||
writer.println "| ${starter.description}"
|
||||
writer.println "| ${starter.pomUrl}[Pom]"
|
||||
}
|
||||
writer.println '|==='
|
||||
}
|
||||
}
|
||||
|
||||
def starters = getStarters(new File(project.build.directory, 'external-resources/starter-poms'))
|
||||
writeTable('application-starters', starters.findAll { isApplicationStarter(it) })
|
||||
writeTable('production-starters', starters.findAll { isProductionStarter(it) })
|
||||
writeTable('technical-starters', starters.findAll { isTechnicalStarter(it) })
|
||||
@@ -0,0 +1,117 @@
|
||||
import groovy.io.FileType
|
||||
|
||||
import java.util.Properties
|
||||
|
||||
import org.springframework.core.io.InputStreamResource
|
||||
import org.springframework.core.type.AnnotationMetadata
|
||||
import org.springframework.core.type.ClassMetadata
|
||||
import org.springframework.core.type.classreading.MetadataReader
|
||||
import org.springframework.core.type.classreading.MetadataReaderFactory
|
||||
import org.springframework.core.type.classreading.SimpleMetadataReaderFactory
|
||||
import org.springframework.util.ClassUtils
|
||||
import org.springframework.util.StringUtils
|
||||
|
||||
class Project {
|
||||
|
||||
final List<File> classFiles
|
||||
|
||||
final Properties springFactories
|
||||
|
||||
Project(File rootDirectory) {
|
||||
this.springFactories = loadSpringFactories(rootDirectory)
|
||||
this.classFiles = []
|
||||
rootDirectory.eachFileRecurse (FileType.FILES) { file ->
|
||||
if (file.name.endsWith('.class')) {
|
||||
classFiles << file
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Properties loadSpringFactories(File rootDirectory) {
|
||||
Properties springFactories = new Properties()
|
||||
new File(rootDirectory, 'META-INF/spring.factories').withInputStream { inputStream ->
|
||||
springFactories.load(inputStream)
|
||||
}
|
||||
return springFactories
|
||||
}
|
||||
}
|
||||
|
||||
class TestSlice {
|
||||
|
||||
final String name
|
||||
|
||||
final SortedSet<String> importedAutoConfiguration
|
||||
|
||||
TestSlice(String annotationName, Collection<String> importedAutoConfiguration) {
|
||||
this.name = ClassUtils.getShortName(annotationName)
|
||||
this.importedAutoConfiguration = new TreeSet<String>(importedAutoConfiguration)
|
||||
}
|
||||
}
|
||||
|
||||
List<TestSlice> createTestSlices(Project project) {
|
||||
MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory()
|
||||
project.classFiles
|
||||
.findAll { classFile ->
|
||||
classFile.name.endsWith('Test.class')
|
||||
}.collect { classFile ->
|
||||
createMetadataReader(metadataReaderFactory, classFile)
|
||||
}.findAll { metadataReader ->
|
||||
metadataReader.classMetadata.annotation
|
||||
}.collect { metadataReader ->
|
||||
createTestSlice(project.springFactories, metadataReader.classMetadata, metadataReader.annotationMetadata)
|
||||
}.sort {
|
||||
a, b -> a.name.compareTo b.name
|
||||
}
|
||||
}
|
||||
|
||||
MetadataReader createMetadataReader(MetadataReaderFactory factory, File classFile) {
|
||||
classFile.withInputStream { inputStream ->
|
||||
factory.getMetadataReader(new InputStreamResource(inputStream))
|
||||
}
|
||||
}
|
||||
|
||||
TestSlice createTestSlice(Properties springFactories, ClassMetadata classMetadata, AnnotationMetadata annotationMetadata) {
|
||||
new TestSlice(classMetadata.className, getImportedAutoConfiguration(springFactories, annotationMetadata))
|
||||
}
|
||||
|
||||
Set<String> getImportedAutoConfiguration(Properties springFactories, AnnotationMetadata annotationMetadata) {
|
||||
Set<String> importers = findMetaImporters(annotationMetadata)
|
||||
if (annotationMetadata.isAnnotated('org.springframework.boot.autoconfigure.ImportAutoConfiguration')) {
|
||||
importers.add(annotationMetadata.className)
|
||||
}
|
||||
importers
|
||||
.collect { autoConfigurationImporter ->
|
||||
StringUtils.commaDelimitedListToSet(springFactories.get(autoConfigurationImporter))
|
||||
}.flatten()
|
||||
}
|
||||
|
||||
Set<String> findMetaImporters(AnnotationMetadata annotationMetadata) {
|
||||
annotationMetadata.annotationTypes
|
||||
.findAll { annotationType ->
|
||||
isAutoConfigurationImporter(annotationType, annotationMetadata)
|
||||
}
|
||||
}
|
||||
|
||||
boolean isAutoConfigurationImporter(String annotationType, AnnotationMetadata metadata) {
|
||||
metadata.getMetaAnnotationTypes(annotationType).contains('org.springframework.boot.autoconfigure.ImportAutoConfiguration')
|
||||
}
|
||||
|
||||
void writeTestSlicesTable(List<TestSlice> testSlices) {
|
||||
new File(project.build.directory, "generated-resources/test-slice-auto-configuration.adoc").withPrintWriter { writer ->
|
||||
writer.println '[cols="d,a"]'
|
||||
writer.println '|==='
|
||||
writer.println '| Test slice | Imported auto-configuration'
|
||||
testSlices.each { testSlice ->
|
||||
writer.println ''
|
||||
writer.println "| `@${testSlice.name}`"
|
||||
writer.print '| '
|
||||
testSlice.importedAutoConfiguration.each {
|
||||
writer.println "`${it}`"
|
||||
}
|
||||
}
|
||||
writer.println '|==='
|
||||
}
|
||||
}
|
||||
|
||||
List<TestSlice> testSlices = createTestSlices(new Project(new File(project.build.directory, 'test-auto-config')))
|
||||
writeTestSlicesTable(testSlices)
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot;
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
/**
|
||||
* Example configuration that illustrates the use of {@link ExitCodeGenerator}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
// tag::example[]
|
||||
@SpringBootApplication
|
||||
public class ExitCodeApplication {
|
||||
|
||||
@Bean
|
||||
public ExitCodeGenerator exitCodeGenerator() {
|
||||
return () -> 42;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.exit(SpringApplication
|
||||
.exit(SpringApplication.run(ExitCodeApplication.class, args)));
|
||||
}
|
||||
|
||||
}
|
||||
// end::example[]
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.builder;
|
||||
|
||||
import org.springframework.boot.Banner;
|
||||
|
||||
/**
|
||||
* Examples of using {@link SpringApplicationBuilder}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class SpringApplicationBuilderExample {
|
||||
|
||||
public void hierarchyWithDisabledBanner(String[] args) {
|
||||
// @formatter:off
|
||||
// tag::hierarchy[]
|
||||
new SpringApplicationBuilder()
|
||||
.sources(Parent.class)
|
||||
.child(Application.class)
|
||||
.bannerMode(Banner.Mode.OFF)
|
||||
.run(args);
|
||||
// end::hierarchy[]
|
||||
// @formatter:on
|
||||
}
|
||||
|
||||
/**
|
||||
* Parent application configuration.
|
||||
*/
|
||||
static class Parent {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Application configuration.
|
||||
*/
|
||||
static class Application {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.cloudfoundry;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
|
||||
/**
|
||||
* Example for custom Cloud Foundry actuator ignored paths.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
public class CloudFoundryIgnorePathsExample {
|
||||
|
||||
@Configuration
|
||||
static class CustomSecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
|
||||
// @formatter:off
|
||||
// tag::security[]
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.authorizeRequests()
|
||||
.mvcMatchers("/cloudfoundryapplication/**")
|
||||
.permitAll()
|
||||
.mvcMatchers("/mypath")
|
||||
.hasAnyRole("SUPERUSER")
|
||||
.anyRequest()
|
||||
.authenticated().and()
|
||||
.httpBasic();
|
||||
}
|
||||
// end::security[]
|
||||
// @formatter:on
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.context;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.env.EnvironmentPostProcessor;
|
||||
import org.springframework.boot.env.YamlPropertySourceLoader;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
/**
|
||||
* An {@link EnvironmentPostProcessor} example that loads a YAML file.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
// tag::example[]
|
||||
public class EnvironmentPostProcessorExample implements EnvironmentPostProcessor {
|
||||
|
||||
private final YamlPropertySourceLoader loader = new YamlPropertySourceLoader();
|
||||
|
||||
@Override
|
||||
public void postProcessEnvironment(ConfigurableEnvironment environment,
|
||||
SpringApplication application) {
|
||||
Resource path = new ClassPathResource("com/example/myapp/config.yml");
|
||||
PropertySource<?> propertySource = loadYaml(path);
|
||||
environment.getPropertySources().addLast(propertySource);
|
||||
}
|
||||
|
||||
private PropertySource<?> loadYaml(Resource path) {
|
||||
if (!path.exists()) {
|
||||
throw new IllegalArgumentException("Resource " + path + " does not exist");
|
||||
}
|
||||
try {
|
||||
return this.loader.load("custom-resource", path, null);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new IllegalStateException(
|
||||
"Failed to load yaml configuration from " + path, ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// end::example[]
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.context.embedded;
|
||||
|
||||
import org.apache.tomcat.util.http.LegacyCookieProcessor;
|
||||
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Example configuration for configuring Tomcat with to use {@link LegacyCookieProcessor}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class TomcatLegacyCookieProcessorExample {
|
||||
|
||||
/**
|
||||
* Configuration class that declares the required {@link WebServerFactoryCustomizer}.
|
||||
*/
|
||||
@Configuration
|
||||
static class LegacyCookieProcessorConfiguration {
|
||||
|
||||
// tag::customizer[]
|
||||
@Bean
|
||||
public WebServerFactoryCustomizer<TomcatServletWebServerFactory> cookieProcessorCustomizer() {
|
||||
return (serverFactory) -> serverFactory.addContextCustomizers(
|
||||
(context) -> context.setCookieProcessor(new LegacyCookieProcessor()));
|
||||
}
|
||||
// end::customizer[]
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.elasticsearch;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
|
||||
import org.springframework.boot.autoconfigure.data.jpa.EntityManagerFactoryDependsOnPostProcessor;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Example configuration for configuring Hibernate to depend on Elasticsearch so that
|
||||
* Hibernate Search can use Elasticsearch as its index manager.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class HibernateSearchElasticsearchExample {
|
||||
|
||||
// tag::configuration[]
|
||||
/**
|
||||
* {@link EntityManagerFactoryDependsOnPostProcessor} that ensures that
|
||||
* {@link EntityManagerFactory} beans depend on the {@code elasticsearchClient} bean.
|
||||
*/
|
||||
@Configuration
|
||||
static class ElasticsearchJpaDependencyConfiguration
|
||||
extends EntityManagerFactoryDependsOnPostProcessor {
|
||||
|
||||
ElasticsearchJpaDependencyConfiguration() {
|
||||
super("elasticsearchClient");
|
||||
}
|
||||
|
||||
}
|
||||
// end::configuration[]
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.elasticsearch.jest;
|
||||
|
||||
import io.searchbox.client.config.HttpClientConfig;
|
||||
|
||||
import org.springframework.boot.autoconfigure.elasticsearch.jest.HttpClientConfigBuilderCustomizer;
|
||||
|
||||
/**
|
||||
* Example configuration for using a {@link HttpClientConfigBuilderCustomizer} to
|
||||
* configure additional HTTP settings.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class JestClientCustomizationExample {
|
||||
|
||||
/**
|
||||
* A {@link HttpClientConfigBuilderCustomizer} that applies additional HTTP settings
|
||||
* to the auto-configured jest client.
|
||||
*/
|
||||
// tag::customizer[]
|
||||
static class HttpSettingsCustomizer implements HttpClientConfigBuilderCustomizer {
|
||||
|
||||
@Override
|
||||
public void customize(HttpClientConfig.Builder builder) {
|
||||
builder.maxTotalConnection(100).defaultMaxTotalConnectionPerRoute(5);
|
||||
}
|
||||
|
||||
}
|
||||
// end::customizer[]
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.jdbc;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Example configuration for configuring a very basic custom {@link DataSource}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class BasicDataSourceExample {
|
||||
|
||||
/**
|
||||
* A configuration that exposes an empty {@link DataSource}.
|
||||
*/
|
||||
@Configuration
|
||||
static class BasicDataSourceConfiguration {
|
||||
|
||||
// tag::configuration[]
|
||||
@Bean
|
||||
@ConfigurationProperties("app.datasource")
|
||||
public DataSource dataSource() {
|
||||
return DataSourceBuilder.create().build();
|
||||
}
|
||||
// end::configuration[]
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.jdbc;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
/**
|
||||
* Example configuration for configuring two data sources with what Spring Boot does in
|
||||
* auto-configuration.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class CompleteTwoDataSourcesExample {
|
||||
|
||||
/**
|
||||
* A complete configuration that exposes two data sources.
|
||||
*/
|
||||
@Configuration
|
||||
static class CompleteDataSourcesConfiguration {
|
||||
|
||||
// tag::configuration[]
|
||||
@Bean
|
||||
@Primary
|
||||
@ConfigurationProperties("app.datasource.foo")
|
||||
public DataSourceProperties fooDataSourceProperties() {
|
||||
return new DataSourceProperties();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
@ConfigurationProperties("app.datasource.foo")
|
||||
public DataSource fooDataSource() {
|
||||
return fooDataSourceProperties().initializeDataSourceBuilder().build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties("app.datasource.bar")
|
||||
public DataSourceProperties barDataSourceProperties() {
|
||||
return new DataSourceProperties();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties("app.datasource.bar")
|
||||
public DataSource barDataSource() {
|
||||
return barDataSourceProperties().initializeDataSourceBuilder().build();
|
||||
}
|
||||
// end::configuration[]
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.jdbc;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
/**
|
||||
* Example configuration for configuring a configurable custom {@link DataSource}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class ConfigurableDataSourceExample {
|
||||
|
||||
/**
|
||||
* A configuration that defines dedicated settings and reuses
|
||||
* {@link DataSourceProperties}.
|
||||
*/
|
||||
@Configuration
|
||||
static class ConfigurableDataSourceConfiguration {
|
||||
|
||||
// tag::configuration[]
|
||||
@Bean
|
||||
@Primary
|
||||
@ConfigurationProperties("app.datasource")
|
||||
public DataSourceProperties dataSourceProperties() {
|
||||
return new DataSourceProperties();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties("app.datasource")
|
||||
public HikariDataSource dataSource(DataSourceProperties properties) {
|
||||
return properties.initializeDataSourceBuilder().type(HikariDataSource.class)
|
||||
.build();
|
||||
}
|
||||
// end::configuration[]
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.jdbc;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Example configuration for configuring a simple {@link DataSource}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class SimpleDataSourceExample {
|
||||
|
||||
/**
|
||||
* A simple configuration that exposes dedicated settings.
|
||||
*/
|
||||
@Configuration
|
||||
static class SimpleDataSourceConfiguration {
|
||||
|
||||
// tag::configuration[]
|
||||
@Bean
|
||||
@ConfigurationProperties("app.datasource")
|
||||
public HikariDataSource dataSource() {
|
||||
return DataSourceBuilder.create().type(HikariDataSource.class).build();
|
||||
}
|
||||
// end::configuration[]
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.jdbc;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
/**
|
||||
* Example configuration for configuring a configurable secondary {@link DataSource} while
|
||||
* keeping the auto-configuration defaults for the primary one.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class SimpleTwoDataSourcesExample {
|
||||
|
||||
/**
|
||||
* A simple configuration that exposes two data sources.
|
||||
*/
|
||||
@Configuration
|
||||
static class SimpleDataSourcesConfiguration {
|
||||
|
||||
// tag::configuration[]
|
||||
@Bean
|
||||
@Primary
|
||||
@ConfigurationProperties("app.datasource.foo")
|
||||
public DataSourceProperties fooDataSourceProperties() {
|
||||
return new DataSourceProperties();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
@ConfigurationProperties("app.datasource.foo")
|
||||
public DataSource fooDataSource() {
|
||||
return fooDataSourceProperties().initializeDataSourceBuilder().build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties("app.datasource.bar")
|
||||
public BasicDataSource barDataSource() {
|
||||
return DataSourceBuilder.create().type(BasicDataSource.class).build();
|
||||
}
|
||||
// end::configuration[]
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.test.autoconfigure.restdocs.restassured;
|
||||
|
||||
import org.springframework.boot.test.autoconfigure.restdocs.RestDocsRestAssuredConfigurationCustomizer;
|
||||
import org.springframework.boot.test.context.TestConfiguration;
|
||||
import org.springframework.restdocs.restassured3.RestAssuredRestDocumentationConfigurer;
|
||||
import org.springframework.restdocs.templates.TemplateFormats;
|
||||
|
||||
public class AdvancedConfigurationExample {
|
||||
|
||||
// tag::configuration[]
|
||||
@TestConfiguration
|
||||
public static class CustomizationConfiguration
|
||||
implements RestDocsRestAssuredConfigurationCustomizer {
|
||||
|
||||
@Override
|
||||
public void customize(RestAssuredRestDocumentationConfigurer configurer) {
|
||||
configurer.snippets().withTemplateFormat(TemplateFormats.markdown());
|
||||
}
|
||||
|
||||
}
|
||||
// end::configuration[]
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.test.autoconfigure.restdocs.restassured;
|
||||
|
||||
// tag::source[]
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.web.server.LocalServerPort;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.springframework.restdocs.restassured3.RestAssuredRestDocumentation.document;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
@AutoConfigureRestDocs
|
||||
public class UserDocumentationTests {
|
||||
|
||||
@LocalServerPort
|
||||
private int port;
|
||||
|
||||
@Autowired
|
||||
private RequestSpecification documentationSpec;
|
||||
|
||||
@Test
|
||||
public void listUsers() throws Exception {
|
||||
given(this.documentationSpec).filter(document("list-users")).when()
|
||||
.port(this.port).get("/").then().assertThat().statusCode(is(200));
|
||||
}
|
||||
|
||||
}
|
||||
// end::source[]
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.test.spock;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.client.LocalHostUriTemplateHandler;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/**
|
||||
* Example configuration for using TestRestTemplate with Spock 1.0 when
|
||||
* {@link SpringBootTest} cannot be used.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class SpockTestRestTemplateExample {
|
||||
|
||||
/**
|
||||
* Test configuration for a {@link TestRestTemplate}.
|
||||
*/
|
||||
// tag::test-rest-template-configuration[]
|
||||
@Configuration
|
||||
static class TestRestTemplateConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestRestTemplate testRestTemplate(
|
||||
ObjectProvider<RestTemplateBuilder> builderProvider,
|
||||
Environment environment) {
|
||||
RestTemplateBuilder builder = builderProvider.getIfAvailable();
|
||||
TestRestTemplate template = builder == null ? new TestRestTemplate()
|
||||
: new TestRestTemplate(builder.build());
|
||||
template.setUriTemplateHandler(new LocalHostUriTemplateHandler(environment));
|
||||
return template;
|
||||
}
|
||||
|
||||
}
|
||||
// end::test-rest-template-configuration[]
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.test.web;
|
||||
|
||||
// tag::test-random-port[]
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
public class RandomPortExampleTests {
|
||||
|
||||
@Autowired
|
||||
private TestRestTemplate restTemplate;
|
||||
|
||||
@Test
|
||||
public void exampleTest() {
|
||||
String body = this.restTemplate.getForObject("/", String.class);
|
||||
assertThat(body).isEqualTo("Hello World");
|
||||
}
|
||||
|
||||
}
|
||||
// tag::test-random-port[]
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.web.client;
|
||||
|
||||
import org.apache.http.HttpException;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.HttpRequest;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.conn.DefaultProxyRoutePlanner;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
/**
|
||||
* Example configuration for using a {@link RestTemplateCustomizer} to configure a proxy.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class RestTemplateProxyCustomizationExample {
|
||||
|
||||
/**
|
||||
* A {@link RestTemplateCustomizer} that applies an HttpComponents-based request
|
||||
* factory that is configured to use a proxy.
|
||||
*/
|
||||
// tag::customizer[]
|
||||
static class ProxyCustomizer implements RestTemplateCustomizer {
|
||||
|
||||
@Override
|
||||
public void customize(RestTemplate restTemplate) {
|
||||
HttpHost proxy = new HttpHost("proxy.example.com");
|
||||
HttpClient httpClient = HttpClientBuilder.create()
|
||||
.setRoutePlanner(new DefaultProxyRoutePlanner(proxy) {
|
||||
|
||||
@Override
|
||||
public HttpHost determineProxy(HttpHost target,
|
||||
HttpRequest request, HttpContext context)
|
||||
throws HttpException {
|
||||
if (target.getHostName().equals("192.168.0.5")) {
|
||||
return null;
|
||||
}
|
||||
return super.determineProxy(target, request, context);
|
||||
}
|
||||
|
||||
}).build();
|
||||
restTemplate.setRequestFactory(
|
||||
new HttpComponentsClientHttpRequestFactory(httpClient));
|
||||
}
|
||||
|
||||
}
|
||||
// end::customizer[]
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.web.security;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
|
||||
/**
|
||||
* Example configuration for using a {@link WebSecurityConfigurerAdapter} to configure
|
||||
* unauthenticated access to the home page at "/".
|
||||
*
|
||||
* @author Robert Stern
|
||||
*/
|
||||
public class UnauthenticatedAccessExample {
|
||||
|
||||
/**
|
||||
* {@link WebSecurityConfigurerAdapter} that provides init to configure
|
||||
* {@link WebSecurity} argument to customize access rules.
|
||||
*/
|
||||
// tag::configuration[]
|
||||
@Configuration
|
||||
static class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
public void init(WebSecurity web) {
|
||||
web.ignoring().antMatchers("/");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.antMatcher("/**").authorizeRequests().anyRequest().authenticated();
|
||||
}
|
||||
|
||||
}
|
||||
// end::configuration[]
|
||||
|
||||
}
|
||||
@@ -0,0 +1,599 @@
|
||||
/* Javadoc style sheet */
|
||||
/*
|
||||
Overall document style
|
||||
*/
|
||||
|
||||
@import url('resources/fonts/dejavu.css');
|
||||
|
||||
body {
|
||||
background-color:#ffffff;
|
||||
color:#353833;
|
||||
font-family:'DejaVu Sans', Arial, Helvetica, sans-serif;
|
||||
font-size:14px;
|
||||
margin:0;
|
||||
}
|
||||
a:link, a:visited {
|
||||
text-decoration:none;
|
||||
color:#4A6782;
|
||||
}
|
||||
a:hover, a:focus {
|
||||
text-decoration:none;
|
||||
color:#bb7a2a;
|
||||
}
|
||||
a:active {
|
||||
text-decoration:none;
|
||||
color:#4A6782;
|
||||
}
|
||||
a[name] {
|
||||
color:#353833;
|
||||
}
|
||||
a[name]:hover {
|
||||
text-decoration:none;
|
||||
color:#353833;
|
||||
}
|
||||
pre {
|
||||
font-family:'DejaVu Sans Mono', monospace;
|
||||
font-size:14px;
|
||||
}
|
||||
h1 {
|
||||
font-size:20px;
|
||||
}
|
||||
h2 {
|
||||
font-size:18px;
|
||||
}
|
||||
h3 {
|
||||
font-size:16px;
|
||||
font-style:italic;
|
||||
}
|
||||
h4 {
|
||||
font-size:13px;
|
||||
}
|
||||
h5 {
|
||||
font-size:12px;
|
||||
}
|
||||
h6 {
|
||||
font-size:11px;
|
||||
}
|
||||
ul {
|
||||
list-style-type:disc;
|
||||
}
|
||||
code, tt {
|
||||
font-family:'DejaVu Sans Mono', monospace;
|
||||
font-size:14px;
|
||||
padding-top:4px;
|
||||
margin-top:8px;
|
||||
line-height:1.4em;
|
||||
}
|
||||
dt code {
|
||||
font-family:'DejaVu Sans Mono', monospace;
|
||||
font-size:14px;
|
||||
padding-top:4px;
|
||||
}
|
||||
table tr td dt code {
|
||||
font-family:'DejaVu Sans Mono', monospace;
|
||||
font-size:14px;
|
||||
vertical-align:top;
|
||||
padding-top:4px;
|
||||
}
|
||||
sup {
|
||||
font-size:8px;
|
||||
}
|
||||
/*
|
||||
Document title and Copyright styles
|
||||
*/
|
||||
.clear {
|
||||
clear:both;
|
||||
height:0px;
|
||||
overflow:hidden;
|
||||
}
|
||||
.aboutLanguage {
|
||||
float:right;
|
||||
padding:0px 21px;
|
||||
font-size:11px;
|
||||
z-index:200;
|
||||
margin-top:-9px;
|
||||
}
|
||||
.legalCopy {
|
||||
margin-left:.5em;
|
||||
}
|
||||
.bar a, .bar a:link, .bar a:visited, .bar a:active {
|
||||
color:#FFFFFF;
|
||||
text-decoration:none;
|
||||
}
|
||||
.bar a:hover, .bar a:focus {
|
||||
color:#bb7a2a;
|
||||
}
|
||||
.tab {
|
||||
background-color:#0066FF;
|
||||
color:#ffffff;
|
||||
padding:8px;
|
||||
width:5em;
|
||||
font-weight:bold;
|
||||
}
|
||||
/*
|
||||
Navigation bar styles
|
||||
*/
|
||||
.bar {
|
||||
background-color:#4D7A97;
|
||||
color:#FFFFFF;
|
||||
padding:.8em .5em .4em .8em;
|
||||
height:auto;/*height:1.8em;*/
|
||||
font-size:11px;
|
||||
margin:0;
|
||||
}
|
||||
.topNav {
|
||||
background-color:#4D7A97;
|
||||
color:#FFFFFF;
|
||||
float:left;
|
||||
padding:0;
|
||||
width:100%;
|
||||
clear:right;
|
||||
height:2.8em;
|
||||
padding-top:10px;
|
||||
overflow:hidden;
|
||||
font-size:12px;
|
||||
}
|
||||
.bottomNav {
|
||||
margin-top:10px;
|
||||
background-color:#4D7A97;
|
||||
color:#FFFFFF;
|
||||
float:left;
|
||||
padding:0;
|
||||
width:100%;
|
||||
clear:right;
|
||||
height:2.8em;
|
||||
padding-top:10px;
|
||||
overflow:hidden;
|
||||
font-size:12px;
|
||||
}
|
||||
.subNav {
|
||||
background-color:#dee3e9;
|
||||
float:left;
|
||||
width:100%;
|
||||
overflow:hidden;
|
||||
font-size:12px;
|
||||
}
|
||||
.subNav div {
|
||||
clear:left;
|
||||
float:left;
|
||||
padding:0 0 5px 6px;
|
||||
text-transform:uppercase;
|
||||
}
|
||||
ul.navList, ul.subNavList {
|
||||
float:left;
|
||||
margin:0 25px 0 0;
|
||||
padding:0;
|
||||
}
|
||||
ul.navList li{
|
||||
list-style:none;
|
||||
float:left;
|
||||
padding: 5px 6px;
|
||||
text-transform:uppercase;
|
||||
}
|
||||
ul.subNavList li{
|
||||
list-style:none;
|
||||
float:left;
|
||||
}
|
||||
.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited {
|
||||
color:#FFFFFF;
|
||||
text-decoration:none;
|
||||
text-transform:uppercase;
|
||||
}
|
||||
.topNav a:hover, .bottomNav a:hover {
|
||||
text-decoration:none;
|
||||
color:#bb7a2a;
|
||||
text-transform:uppercase;
|
||||
}
|
||||
.navBarCell1Rev {
|
||||
background-color:#F8981D;
|
||||
color:#253441;
|
||||
margin: auto 5px;
|
||||
}
|
||||
.skipNav {
|
||||
position:absolute;
|
||||
top:auto;
|
||||
left:-9999px;
|
||||
overflow:hidden;
|
||||
}
|
||||
/*
|
||||
Page header and footer styles
|
||||
*/
|
||||
.header, .footer {
|
||||
clear:both;
|
||||
margin:0 20px;
|
||||
padding:5px 0 0 0;
|
||||
}
|
||||
.indexHeader {
|
||||
margin:10px;
|
||||
position:relative;
|
||||
}
|
||||
.indexHeader span{
|
||||
margin-right:15px;
|
||||
}
|
||||
.indexHeader h1 {
|
||||
font-size:13px;
|
||||
}
|
||||
.title {
|
||||
color:#2c4557;
|
||||
margin:10px 0;
|
||||
}
|
||||
.subTitle {
|
||||
margin:5px 0 0 0;
|
||||
}
|
||||
.header ul {
|
||||
margin:0 0 15px 0;
|
||||
padding:0;
|
||||
}
|
||||
.footer ul {
|
||||
margin:20px 0 5px 0;
|
||||
}
|
||||
.header ul li, .footer ul li {
|
||||
list-style:none;
|
||||
font-size:13px;
|
||||
}
|
||||
/*
|
||||
Heading styles
|
||||
*/
|
||||
div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 {
|
||||
background-color:#dee3e9;
|
||||
border:1px solid #d0d9e0;
|
||||
margin:0 0 6px -8px;
|
||||
padding:7px 5px;
|
||||
}
|
||||
ul.blockList ul.blockList ul.blockList li.blockList h3 {
|
||||
background-color:#dee3e9;
|
||||
border:1px solid #d0d9e0;
|
||||
margin:0 0 6px -8px;
|
||||
padding:7px 5px;
|
||||
}
|
||||
ul.blockList ul.blockList li.blockList h3 {
|
||||
padding:0;
|
||||
margin:15px 0;
|
||||
}
|
||||
ul.blockList li.blockList h2 {
|
||||
padding:0px 0 20px 0;
|
||||
}
|
||||
/*
|
||||
Page layout container styles
|
||||
*/
|
||||
.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer {
|
||||
clear:both;
|
||||
padding:10px 20px;
|
||||
position:relative;
|
||||
}
|
||||
.indexContainer {
|
||||
margin:10px;
|
||||
position:relative;
|
||||
font-size:12px;
|
||||
}
|
||||
.indexContainer h2 {
|
||||
font-size:13px;
|
||||
padding:0 0 3px 0;
|
||||
}
|
||||
.indexContainer ul {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
.indexContainer ul li {
|
||||
list-style:none;
|
||||
padding-top:2px;
|
||||
}
|
||||
.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt {
|
||||
font-size:12px;
|
||||
font-weight:bold;
|
||||
margin:10px 0 0 0;
|
||||
color:#4E4E4E;
|
||||
}
|
||||
.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd {
|
||||
margin:5px 0 10px 0px;
|
||||
font-size:14px;
|
||||
font-family:'DejaVu Sans Mono',monospace;
|
||||
}
|
||||
.serializedFormContainer dl.nameValue dt {
|
||||
margin-left:1px;
|
||||
font-size:1.1em;
|
||||
display:inline;
|
||||
font-weight:bold;
|
||||
}
|
||||
.serializedFormContainer dl.nameValue dd {
|
||||
margin:0 0 0 1px;
|
||||
font-size:1.1em;
|
||||
display:inline;
|
||||
}
|
||||
/*
|
||||
List styles
|
||||
*/
|
||||
ul.horizontal li {
|
||||
display:inline;
|
||||
font-size:0.9em;
|
||||
}
|
||||
ul.inheritance {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
ul.inheritance li {
|
||||
display:inline;
|
||||
list-style:none;
|
||||
}
|
||||
ul.inheritance li ul.inheritance {
|
||||
margin-left:15px;
|
||||
padding-left:15px;
|
||||
padding-top:1px;
|
||||
}
|
||||
ul.blockList, ul.blockListLast {
|
||||
margin:10px 0 10px 0;
|
||||
padding:0;
|
||||
}
|
||||
ul.blockList li.blockList, ul.blockListLast li.blockList {
|
||||
list-style:none;
|
||||
margin-bottom:15px;
|
||||
line-height:1.4;
|
||||
}
|
||||
ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList {
|
||||
padding:0px 20px 5px 10px;
|
||||
border:1px solid #ededed;
|
||||
background-color:#f8f8f8;
|
||||
}
|
||||
ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList {
|
||||
padding:0 0 5px 8px;
|
||||
background-color:#ffffff;
|
||||
border:none;
|
||||
}
|
||||
ul.blockList ul.blockList ul.blockList ul.blockList li.blockList {
|
||||
margin-left:0;
|
||||
padding-left:0;
|
||||
padding-bottom:15px;
|
||||
border:none;
|
||||
}
|
||||
ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast {
|
||||
list-style:none;
|
||||
border-bottom:none;
|
||||
padding-bottom:0;
|
||||
}
|
||||
table tr td dl, table tr td dl dt, table tr td dl dd {
|
||||
margin-top:0;
|
||||
margin-bottom:1px;
|
||||
}
|
||||
/*
|
||||
Table styles
|
||||
*/
|
||||
.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary {
|
||||
width:100%;
|
||||
border-left:1px solid #EEE;
|
||||
border-right:1px solid #EEE;
|
||||
border-bottom:1px solid #EEE;
|
||||
}
|
||||
.overviewSummary, .memberSummary {
|
||||
padding:0px;
|
||||
}
|
||||
.overviewSummary caption, .memberSummary caption, .typeSummary caption,
|
||||
.useSummary caption, .constantsSummary caption, .deprecatedSummary caption {
|
||||
position:relative;
|
||||
text-align:left;
|
||||
background-repeat:no-repeat;
|
||||
color:#253441;
|
||||
font-weight:bold;
|
||||
clear:none;
|
||||
overflow:hidden;
|
||||
padding:0px;
|
||||
padding-top:10px;
|
||||
padding-left:1px;
|
||||
margin:0px;
|
||||
white-space:pre;
|
||||
}
|
||||
.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link,
|
||||
.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link,
|
||||
.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover,
|
||||
.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover,
|
||||
.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active,
|
||||
.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active,
|
||||
.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited,
|
||||
.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited {
|
||||
color:#FFFFFF;
|
||||
}
|
||||
.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,
|
||||
.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span {
|
||||
white-space:nowrap;
|
||||
padding-top:5px;
|
||||
padding-left:12px;
|
||||
padding-right:12px;
|
||||
padding-bottom:7px;
|
||||
display:inline-block;
|
||||
float:left;
|
||||
background-color:#F8981D;
|
||||
border: none;
|
||||
height:16px;
|
||||
}
|
||||
.memberSummary caption span.activeTableTab span {
|
||||
white-space:nowrap;
|
||||
padding-top:5px;
|
||||
padding-left:12px;
|
||||
padding-right:12px;
|
||||
margin-right:3px;
|
||||
display:inline-block;
|
||||
float:left;
|
||||
background-color:#F8981D;
|
||||
height:16px;
|
||||
}
|
||||
.memberSummary caption span.tableTab span {
|
||||
white-space:nowrap;
|
||||
padding-top:5px;
|
||||
padding-left:12px;
|
||||
padding-right:12px;
|
||||
margin-right:3px;
|
||||
display:inline-block;
|
||||
float:left;
|
||||
background-color:#4D7A97;
|
||||
height:16px;
|
||||
}
|
||||
.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {
|
||||
padding-top:0px;
|
||||
padding-left:0px;
|
||||
padding-right:0px;
|
||||
background-image:none;
|
||||
float:none;
|
||||
display:inline;
|
||||
}
|
||||
.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd,
|
||||
.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd {
|
||||
display:none;
|
||||
width:5px;
|
||||
position:relative;
|
||||
float:left;
|
||||
background-color:#F8981D;
|
||||
}
|
||||
.memberSummary .activeTableTab .tabEnd {
|
||||
display:none;
|
||||
width:5px;
|
||||
margin-right:3px;
|
||||
position:relative;
|
||||
float:left;
|
||||
background-color:#F8981D;
|
||||
}
|
||||
.memberSummary .tableTab .tabEnd {
|
||||
display:none;
|
||||
width:5px;
|
||||
margin-right:3px;
|
||||
position:relative;
|
||||
background-color:#4D7A97;
|
||||
float:left;
|
||||
|
||||
}
|
||||
.overviewSummary td, .memberSummary td, .typeSummary td,
|
||||
.useSummary td, .constantsSummary td, .deprecatedSummary td {
|
||||
text-align:left;
|
||||
padding:0px 0px 12px 10px;
|
||||
width:100%;
|
||||
}
|
||||
th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th,
|
||||
td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{
|
||||
vertical-align:top;
|
||||
padding-right:0px;
|
||||
padding-top:8px;
|
||||
padding-bottom:3px;
|
||||
}
|
||||
th.colFirst, th.colLast, th.colOne, .constantsSummary th {
|
||||
background:#dee3e9;
|
||||
text-align:left;
|
||||
padding:8px 3px 3px 7px;
|
||||
}
|
||||
td.colFirst, th.colFirst {
|
||||
white-space:nowrap;
|
||||
font-size:13px;
|
||||
}
|
||||
td.colLast, th.colLast {
|
||||
font-size:13px;
|
||||
}
|
||||
td.colOne, th.colOne {
|
||||
font-size:13px;
|
||||
}
|
||||
.overviewSummary td.colFirst, .overviewSummary th.colFirst,
|
||||
.overviewSummary td.colOne, .overviewSummary th.colOne,
|
||||
.memberSummary td.colFirst, .memberSummary th.colFirst,
|
||||
.memberSummary td.colOne, .memberSummary th.colOne,
|
||||
.typeSummary td.colFirst{
|
||||
width:25%;
|
||||
vertical-align:top;
|
||||
}
|
||||
td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover {
|
||||
font-weight:bold;
|
||||
}
|
||||
.tableSubHeadingColor {
|
||||
background-color:#EEEEFF;
|
||||
}
|
||||
.altColor {
|
||||
background-color:#FFFFFF;
|
||||
}
|
||||
.rowColor {
|
||||
background-color:#EEEEEF;
|
||||
}
|
||||
/*
|
||||
Content styles
|
||||
*/
|
||||
.description pre {
|
||||
margin-top:0;
|
||||
}
|
||||
.deprecatedContent {
|
||||
margin:0;
|
||||
padding:10px 0;
|
||||
}
|
||||
.docSummary {
|
||||
padding:0;
|
||||
}
|
||||
|
||||
ul.blockList ul.blockList ul.blockList li.blockList h3 {
|
||||
font-style:normal;
|
||||
}
|
||||
|
||||
div.block {
|
||||
font-size:14px;
|
||||
font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif;
|
||||
}
|
||||
|
||||
td.colLast div {
|
||||
padding-top:0px;
|
||||
}
|
||||
|
||||
|
||||
td.colLast a {
|
||||
padding-bottom:3px;
|
||||
}
|
||||
/*
|
||||
Formatting effect styles
|
||||
*/
|
||||
.sourceLineNo {
|
||||
color:green;
|
||||
padding:0 30px 0 0;
|
||||
}
|
||||
h1.hidden {
|
||||
visibility:hidden;
|
||||
overflow:hidden;
|
||||
font-size:10px;
|
||||
}
|
||||
.block {
|
||||
display:block;
|
||||
margin:3px 10px 2px 0px;
|
||||
color:#474747;
|
||||
}
|
||||
.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink,
|
||||
.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel,
|
||||
.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink {
|
||||
font-weight:bold;
|
||||
}
|
||||
.deprecationComment, .emphasizedPhrase, .interfaceName {
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase,
|
||||
div.block div.block span.interfaceName {
|
||||
font-style:normal;
|
||||
}
|
||||
|
||||
div.contentContainer ul.blockList li.blockList h2{
|
||||
padding-bottom:0px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Spring
|
||||
*/
|
||||
|
||||
pre.code {
|
||||
background-color: #F8F8F8;
|
||||
border: 1px solid #CCCCCC;
|
||||
border-radius: 3px 3px 3px 3px;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
margin: 4px 20px 2px 0px;
|
||||
}
|
||||
|
||||
pre.code code, pre.code code * {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
pre.code code, pre.code code * {
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:mvn="http://maven.apache.org/POM/4.0.0"
|
||||
version="1.0">
|
||||
|
||||
<xsl:output method="text" encoding="UTF-8" indent="no"/>
|
||||
<xsl:key name="by-full-name" match="//mvn:dependency" use="concat(mvn:groupId, '.', mvn:artifactId)"/>
|
||||
<xsl:template match="/">
|
||||
<xsl:text>|===
</xsl:text>
|
||||
<xsl:text>| Group ID | Artifact ID | Version
</xsl:text>
|
||||
<xsl:for-each select="//mvn:dependency[generate-id() = generate-id(key('by-full-name',
|
||||
concat(mvn:groupId, '.', mvn:artifactId))[1])]">
|
||||
<xsl:sort select="mvn:groupId"/>
|
||||
<xsl:sort select="mvn:artifactId"/>
|
||||
<xsl:text>
</xsl:text>
|
||||
<xsl:text>| `</xsl:text>
|
||||
<xsl:copy-of select="mvn:groupId"/>
|
||||
<xsl:text>`
</xsl:text>
|
||||
<xsl:text>| `</xsl:text>
|
||||
<xsl:copy-of select="mvn:artifactId"/>
|
||||
<xsl:text>`
</xsl:text>
|
||||
<xsl:text>| </xsl:text>
|
||||
<xsl:copy-of select="mvn:version"/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:for-each>
|
||||
<xsl:text>|===</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.builder;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link SpringApplicationBuilderExample}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@RunWith(ModifiedClassPathRunner.class)
|
||||
@ClassPathExclusions("spring-web-*.jar")
|
||||
public class SpringApplicationBuilderExampleTests {
|
||||
|
||||
@Rule
|
||||
public OutputCapture outputCapture = new OutputCapture();
|
||||
|
||||
@Test
|
||||
public void contextHierarchyWithDisabledBanner() {
|
||||
new SpringApplicationBuilderExample().hierarchyWithDisabledBanner(new String[0]);
|
||||
assertThat(this.outputCapture.toString()).doesNotContain(":: Spring Boot ::");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.context;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.core.env.StandardEnvironment;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link EnvironmentPostProcessorExample}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class EnvironmentPostProcessorExampleTests {
|
||||
|
||||
private final StandardEnvironment environment = new StandardEnvironment();
|
||||
|
||||
@Test
|
||||
public void applyEnvironmentPostProcessor() {
|
||||
assertThat(this.environment.containsProperty("test.foo.bar")).isFalse();
|
||||
new EnvironmentPostProcessorExample().postProcessEnvironment(this.environment,
|
||||
new SpringApplication());
|
||||
assertThat(this.environment.containsProperty("test.foo.bar")).isTrue();
|
||||
assertThat(this.environment.getProperty("test.foo.bar")).isEqualTo("value");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.context.embedded;
|
||||
|
||||
import org.apache.catalina.Context;
|
||||
import org.apache.tomcat.util.http.LegacyCookieProcessor;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.context.embedded.TomcatLegacyCookieProcessorExample.LegacyCookieProcessorConfiguration;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatWebServer;
|
||||
import org.springframework.boot.web.server.WebServerFactoryCustomizerBeanPostProcessor;
|
||||
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link TomcatLegacyCookieProcessorExample}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class TomcatLegacyCookieProcessorExampleTests {
|
||||
|
||||
@Test
|
||||
public void cookieProcessorIsCustomized() {
|
||||
ServletWebServerApplicationContext applicationContext = (ServletWebServerApplicationContext) new SpringApplication(
|
||||
TestConfiguration.class, LegacyCookieProcessorConfiguration.class).run();
|
||||
Context context = (Context) ((TomcatWebServer) applicationContext.getWebServer())
|
||||
.getTomcat().getHost().findChildren()[0];
|
||||
assertThat(context.getCookieProcessor())
|
||||
.isInstanceOf(LegacyCookieProcessor.class);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory tomcatFactory() {
|
||||
return new TomcatServletWebServerFactory(0);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebServerFactoryCustomizerBeanPostProcessor postProcessor() {
|
||||
return new WebServerFactoryCustomizerBeanPostProcessor();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.jdbc;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Test for {@link BasicDataSourceExample}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(properties = "app.datasource.jdbcUrl=jdbc:h2:mem:basic;DB_CLOSE_DELAY=-1")
|
||||
@Import(BasicDataSourceExample.BasicDataSourceConfiguration.class)
|
||||
public class BasicDataSourceExampleTests {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
@Test
|
||||
public void validateConfiguration() throws SQLException {
|
||||
assertThat(this.context.getBeansOfType(DataSource.class)).hasSize(1);
|
||||
DataSource dataSource = this.context.getBean(DataSource.class);
|
||||
assertThat(dataSource.getConnection().getMetaData().getURL())
|
||||
.isEqualTo("jdbc:h2:mem:basic");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.jdbc;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link CompleteTwoDataSourcesExample}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@Import(CompleteTwoDataSourcesExample.CompleteDataSourcesConfiguration.class)
|
||||
public class CompleteTwoDataSourcesExampleTests {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
@Test
|
||||
public void validateConfiguration() throws SQLException {
|
||||
assertThat(this.context.getBeansOfType(DataSource.class)).hasSize(2);
|
||||
DataSource dataSource = this.context.getBean(DataSource.class);
|
||||
assertThat(this.context.getBean("fooDataSource")).isSameAs(dataSource);
|
||||
assertThat(dataSource.getConnection().getMetaData().getURL())
|
||||
.startsWith("jdbc:h2:mem:");
|
||||
DataSource barDataSource = this.context.getBean("barDataSource",
|
||||
DataSource.class);
|
||||
assertThat(barDataSource.getConnection().getMetaData().getURL())
|
||||
.startsWith("jdbc:h2:mem:");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.jdbc;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Test for {@link SimpleDataSourceExample}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(properties = {
|
||||
"app.datasource.url=jdbc:h2:mem:configurable;DB_CLOSE_DELAY=-1",
|
||||
"app.datasource.maximum-pool-size=42" })
|
||||
@Import(ConfigurableDataSourceExample.ConfigurableDataSourceConfiguration.class)
|
||||
public class ConfigurableDataSourceExampleTests {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
@Test
|
||||
public void validateConfiguration() throws SQLException {
|
||||
assertThat(this.context.getBeansOfType(DataSource.class)).hasSize(1);
|
||||
HikariDataSource dataSource = this.context.getBean(HikariDataSource.class);
|
||||
assertThat(dataSource.getConnection().getMetaData().getURL())
|
||||
.isEqualTo("jdbc:h2:mem:configurable");
|
||||
assertThat(dataSource.getMaximumPoolSize()).isEqualTo(42);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.jdbc;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.boot.SpringBootConfiguration;
|
||||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
/**
|
||||
* A sample {@link SpringBootConfiguration} that only enables the auto-configuration for
|
||||
* the {@link DataSource}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@SpringBootConfiguration
|
||||
@ImportAutoConfiguration(DataSourceAutoConfiguration.class)
|
||||
class SampleApp {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.jdbc;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Test for {@link SimpleDataSourceExample}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(properties = {
|
||||
"app.datasource.jdbc-url=jdbc:h2:mem:simple;DB_CLOSE_DELAY=-1",
|
||||
"app.datasource.maximum-pool-size=42" })
|
||||
@Import(SimpleDataSourceExample.SimpleDataSourceConfiguration.class)
|
||||
public class SimpleDataSourceExampleTests {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
@Test
|
||||
public void validateConfiguration() throws SQLException {
|
||||
assertThat(this.context.getBeansOfType(DataSource.class)).hasSize(1);
|
||||
HikariDataSource dataSource = this.context.getBean(HikariDataSource.class);
|
||||
assertThat(dataSource.getConnection().getMetaData().getURL())
|
||||
.isEqualTo("jdbc:h2:mem:simple");
|
||||
assertThat(dataSource.getMaximumPoolSize()).isEqualTo(42);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.jdbc;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link SimpleTwoDataSourcesExample}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(properties = { "app.datasource.bar.url=jdbc:h2:mem:bar;DB_CLOSE_DELAY=-1",
|
||||
"app.datasource.bar.max-total=42" })
|
||||
@Import(SimpleTwoDataSourcesExample.SimpleDataSourcesConfiguration.class)
|
||||
public class SimpleTwoDataSourcesExampleTests {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
@Test
|
||||
public void validateConfiguration() throws SQLException {
|
||||
assertThat(this.context.getBeansOfType(DataSource.class)).hasSize(2);
|
||||
DataSource dataSource = this.context.getBean(DataSource.class);
|
||||
assertThat(this.context.getBean("fooDataSource")).isSameAs(dataSource);
|
||||
assertThat(dataSource.getConnection().getMetaData().getURL())
|
||||
.startsWith("jdbc:h2:mem:");
|
||||
BasicDataSource barDataSource = this.context.getBean("barDataSource",
|
||||
BasicDataSource.class);
|
||||
assertThat(barDataSource.getUrl()).isEqualTo("jdbc:h2:mem:bar;DB_CLOSE_DELAY=-1");
|
||||
assertThat(barDataSource.getMaxTotal()).isEqualTo(42);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.test.spock;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link SpockTestRestTemplateExample}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = SpockTestRestTemplateExample.TestRestTemplateConfiguration.class)
|
||||
public class SpockTestRestTemplateExampleTests {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Test
|
||||
public void testRestTemplateBeanIsAvailable() {
|
||||
assertThat(this.applicationContext.getBeansOfType(TestRestTemplate.class))
|
||||
.hasSize(1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
test:
|
||||
foo:
|
||||
bar: value
|
||||