This commit is contained in:
Phillip Webb
2015-09-02 20:17:28 -07:00
parent db41fb16c0
commit 6193b640a4
57 changed files with 364 additions and 310 deletions

View File

@@ -590,7 +590,8 @@ NOTE: The double backslashes are only required when you're using a properties fi
configuration. If you are using YAML, single backslashes are sufficient and a value
that's equivalent to the one shown above would be `192\.168\.\d{1,3}\.\d{1,3}`.
NOTE: You can trust all proxies by setting the `internal_proxies` to empty (but don't do this in production).
NOTE: You can trust all proxies by setting the `internal_proxies` to empty (but don't do
this in production).
You can take complete control of the configuration of the
`RemoteIpValve` by switching the automatic one off (i.e. set one of
@@ -1164,16 +1165,17 @@ Check out {sc-spring-boot-autoconfigure}/web/WebMvcAutoConfiguration.{sc-ext}[`W
{sc-spring-boot-autoconfigure}/velocity/VelocityAutoConfiguration.{sc-ext}[`VelocityAutoConfiguration`]
[[howto-customize-view-resolvers-velocity]]
=== Velocity
By default, Spring Boot configures a `VelocityViewResolver`. If you need a `VelocityLayoutViewResolver`
instead, you can easily configure your own by creating a bean with name `velocityViewResolver`. You can
also inject the `VelocityProperties` instance to apply the base defaults to your custom view resolver.
By default, Spring Boot configures a `VelocityViewResolver`. If you need a
`VelocityLayoutViewResolver` instead, you can easily configure your own by creating a bean
with name `velocityViewResolver`. You can also inject the `VelocityProperties` instance to
apply the base defaults to your custom view resolver.
The following example replaces the auto-configured velocity view resolver with a
`VelocityLayoutViewResolver` defining a customized `layoutUrl` and all settings that would have been
applied from the auto-configuration:
`VelocityLayoutViewResolver` defining a customized `layoutUrl` and all settings that would
have been applied from the auto-configuration:
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
@@ -1187,6 +1189,7 @@ applied from the auto-configuration:
----
[[howto-logging]]
== Logging
@@ -1456,7 +1459,6 @@ entity manager based on the presence of a bean of that type.
[[howto-use-two-entity-managers]]
=== Use Two EntityManagers
Even if the default `EntityManagerFactory` works fine, you will need to define a new one
because otherwise the presence of the second bean of that type will switch off the
default. To make it easy to do that you can use the convenient `EntityManagerBuilder`
@@ -1488,7 +1490,6 @@ Example:
.persistenceUnit("orders")
.build();
}
----
The configuration above almost works on its own. To complete the picture you need to
@@ -1501,7 +1502,6 @@ If you are using Spring Data, you need to configure `@EnableJpaRepositories` acc
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
@Configuration
@EnableJpaRepositories(basePackageClasses = Customer.class,
entityManagerFactoryRef = "customerEntityManagerFactory")
@@ -1515,11 +1515,10 @@ If you are using Spring Data, you need to configure `@EnableJpaRepositories` acc
public class OrderConfiguration {
...
}
----
[[howto-use-traditional-persistence-xml]]
=== Use a traditional persistence.xml
Spring doesn't require the use of XML to configure the JPA provider, and Spring Boot

View File

@@ -1351,9 +1351,10 @@ https://spring.io/blog/2014/07/24/spring-framework-4-1-handling-static-web-resou
and in Spring Framework's {spring-reference}/#mvc-config-static-resources[reference documentation].
====
[[boot-features-spring-mvc-web-binding-initializer]]
==== ConfigurableWebBindingInitializer
Spring MVC uses a `WebBindingInitializer` to initialize a `WebDataBinder` for a particular
request. If you create your own `ConfigurableWebBindingInitializer` `@Bean`, Spring Boot
will automatically configure Spring MVC to use it.
@@ -3419,7 +3420,8 @@ You could also specify the `hazelcast.xml` configuration file to use via configu
Otherwise, Spring Boot tries to find the Hazelcast configuration from the default
locations, that is `hazelcast.xml` in the working directory or at the root of the
classpath. We also check if the `hazelcast.config` system property is set. Check the
http://docs.hazelcast.org/docs/latest/manual/html-single/[Hazelcast documentation] for more details.
http://docs.hazelcast.org/docs/latest/manual/html-single/[Hazelcast documentation] for
more details.
NOTE: Spring Boot also has an
<<boot-features-caching-provider-hazelcast,explicit caching support for Hazelcast>>. The
@@ -3712,6 +3714,7 @@ TIP: A https://github.com/snicoll-demos/spring-boot-master-auto-configuration[de
is available to showcase how you can create a starter step by step.
[[boot-features-understanding-auto-configured-beans]]
=== Understanding auto-configured beans
Under the hood, auto-configuration is implemented with standard `@Configuration` classes.
@@ -3818,9 +3821,9 @@ The `@ConditionalOnExpression` annotation allows configuration to be included ba
result of a {spring-reference}/#expressions[SpEL expression].
[[boot-features-custom-starter]]
=== Creating your own starter
A full Spring Boot starter for a library may contain the following components:
* The `autoconfigure` module that contains the auto-configuration code.
@@ -3831,10 +3834,11 @@ A full Spring Boot starter for a library may contain the following components:
TIP: You may combine the auto-configuration code and the dependency management in a single
module if you don't need to separate those two concerns.
[[boot-features-custom-starter-naming]]
==== Naming
Please make sure to provide a proper namespace for your starter. Do not start your module
FPlease make sure to provide a proper namespace for your starter. Do not start your module
names with `spring-boot`, even if you are using a different Maven groupId. We may offer an
official support for the thing you're auto-configuring in the future.
@@ -3854,9 +3858,10 @@ meta-data generation>> so that IDE assistance is available for your keys as well
may want to review the generated meta-data (`META-INF/spring-configuration-metadata.json`)
to make sure your keys are properly documented.
[[boot-features-custom-starter-module-autoconfigure]]
==== Autoconfigure module
The autoconfigure module contains everything that is necessary to get started with the
library. It may also contain configuration keys definition (`@ConfigurationProperties`)
and any callback interface that can be used to further customize how the components are
@@ -3866,9 +3871,10 @@ TIP: You should mark the dependencies to the library as optional so that you can
the autoconfigure module in your projects more easily. If you do it that way, the library
won't be provided and boot will backoff by default.
[[boot-features-custom-starter-module-starter]]
==== Starter module
The starter is an empty jar, really. Its only purpose is to provide the necessary
dependencies to work with the library; see it as an opinionated view of what is required
to get started.
@@ -3879,6 +3885,8 @@ a proper set of _default_ dependencies may be hard if the number of optional dep
is high as you should avoid bringing unnecessary dependencies for a typical usage of the
library.
[[boot-features-websockets]]
== WebSockets
Spring Boot provides WebSockets auto-configuration for embedded Tomcat (8 and 7), Jetty 9