Commit Graph

1270 Commits

Author SHA1 Message Date
Andy Wilkinson 2ae8a021f9 Merge branch '1.2.x' 2015-08-10 16:59:04 +01:00
Andy Wilkinson a2f4c1cc4a Add support for configuring allowSessionOverride via the environment
This commit adds support for using the environment to configure the
Freemarker and Velocity view resolvers to allow session overrides.

Closes gh-3410
2015-08-10 16:58:17 +01:00
Andy Wilkinson 1e4c972c3d Fix customJodaDateTimeFormat to specify time zone when creating Date
See gh-3569
2015-08-10 12:36:54 +01:00
Dave Syer 2985b0e9d8 Clarify init params in Jersey autoconfig (only servlet and filter)
See gh-3557
2015-08-10 10:50:49 +01:00
Andy Wilkinson 9fcc860908 Polish contribution
Closes gh-3643
2015-08-06 12:06:39 +01:00
Joao Pedro Evangelista 7568af1710 Add auto-configuration of HttpPutContentFormFilter
Closes gh-3652
2015-08-06 12:06:28 +01:00
Phillip Webb 9a53707014 Add @ImportAutoConfiguration annotation for tests
Add a new `@ImportAutoConfiguration` annotation that can be used by
tests that wish to selectively import certain auto-configuration
classes. Also add `@AutoConfigurationPackage` so that package
registration is decoupled from `@EnableAutoConfiguration`.

An added benefit of the change is @EnableAutoConfigurationImportSelector
can now be subclassed to provide custom annotation support if needed.

Fixes gh-3660
See gh-2772
2015-08-05 14:58:19 -07:00
Phillip Webb 8d92236eea Polish 2015-08-05 12:09:23 -07:00
Phillip Webb 3ff878a94b Remove `include` from @EnableAutoConfiguration
Revert commit 1d31d23e29 to
remove `include` from `@EnableAutoConfiguration`. We'll
add a dedicated annotation instead to fix this.

See gh-3660
2015-08-05 10:03:43 -07:00
Eric Bottard 2b15ea65e2 Polish Javadoc
Closes gh-3667
2015-08-05 14:37:55 +02:00
Stephane Nicoll 6c7a5c5077 Harmonize Undertow's access log properties
Harmonize the configuration properties for Undertow to match the changes
made for gh-2491.

Move `spring.undertow.accessLog*` to `spring.undertow.accesslog.*`
2015-08-05 14:34:48 +02:00
Stephane Nicoll 62406546e2 Improve customization of Tomcat's access log
Add `directory`, `prefix` and `suffix` properties to further customize
how access logs are configured on Tomcat. Relocate all properties to the
`server.tomcat.accesslog` namespace.

`server.tomcat.accessLogPattern` and `server.tomcat.accessLogEnabled` are
deprecated and replaced by `server.tomcat.accesslog.pattern` and
`server.tomcat.accesslog.enabled` respectively.

Closes gh-2491
2015-08-05 14:34:48 +02:00
Andy Wilkinson 2a5a32b603 Add auto-configuration for H2’s web console
Three conditions must be met for the console to be enabled:

 - H2 is on the classpath
 - The application is a web application
 - spring.h2.console.enabled is set to true

If spring-boot-devtools is on the classpath, spring.h2.console.enabled
will be set to true automatically. Without the dev tools, the enabled
property will have to be set to true in application.properties.

By default, the console is available at /h2-console. This can be
configured via the spring.h2.console.path property. The value of this
property must begin with a '/'.

When Spring Security is on the classpath the console will be secured
based on the user's security.* configuration. When the console is
secured, CSRF protection is disabled and frame options is set to
SAMEORIGIN for its path. Both settings are required in order for the
console to function.

Closes gh-766
2015-08-05 10:54:03 +01:00
Phillip Webb 1d31d23e29 Add `include` support to @EnableAutoConfiguration
Update the `@EnableAutoConfiguration` annotation to include an `include`
attribute which can be used to specify specific auto-configuration
classes.

Primarily added to so that tests can selectively auto-configure without
needing to worry about class import order.

Fixes gh-3660
2015-08-04 16:43:05 -07:00
Phillip Webb 4279ffeddf Polish formatting 2015-08-04 15:07:42 -07:00
Stephane Nicoll 7669e888cb Polish
Closes gh-3649
2015-08-04 15:11:11 +02:00
jhernan d8bf3a72da Customize mail sender protocol
See gh-3649
2015-08-04 15:08:49 +02:00
Stephane Nicoll d18180e2e4 Add missing package-info 2015-08-04 14:00:38 +02:00
Stephane Nicoll bfe930a873 Auto-configure @EnableConfigurationProperties
Add an auto-configuration that avoid a Spring Boot user to add
`@EnableConfigurationProperties` to its configuration to benefit from
that feature.

As our own auto-configurations are tested independently, such annotation
is still present to avoid a useless reference to this new
auto-configuration.

Closes gh-2457
2015-08-04 13:59:57 +02:00
Andy Wilkinson 0e8812f0e9 Merge branch '1.2.x' 2015-08-04 11:43:45 +01:00
Andy Wilkinson 905346d0cd Consider @Bean methods with args to determine type created by factory
Previously, BeanTypeRegistry would only look for a @Bean method
with no arguments when trying to determine the type that will be
created by a factory bean. This meant that the type produced by a
factory bean declared via a @Bean that has one or more arguments would
be unknown and any on missing bean conditions look for a bean of the
type produced by the factory bean would match in error.

This commit updates BeanTypeRegistry to, where possible, use the
factory method metadata for the bean definition when determining the
type that will be created. This allows it to determine the type for
factory bean created by @Bean methods that take arguments and also
avoids the use reflection to find the factory method. Where factory
method metadata is not available, the existing reflection-based
approach is used as a fallback.

Closes gh-3657
2015-08-04 11:34:53 +01:00
Stephane Nicoll eb5d92f3f0 Exclude auto-configurations via property
Add `spring.autoconfigure.exclude` to control the list of
auto-configuration classes to exclude via configuration. Merge the
exclusions defined on the `@EnableAutoConfiguration` or
`@SpringBooApplication` if any.

Closes gh-2435
2015-08-04 10:50:49 +02:00
Rob Winch f543e3259e Add Test that HiddenHttpMethodFilter before FilterChainProxy
Fixes gh-3447
2015-08-03 14:22:23 -05:00
Phillip Webb 891dd5a0f6 Polish 2015-08-03 11:03:48 -07:00
Stephane Nicoll 15442b9667 Avoid wrong meta-data
Make `getFaviconLocations` package private so that it's not (wrongly)
exposed in the meta-data.

Closes gh-3647
2015-08-03 10:46:33 +02:00
Stephane Nicoll 3cae8e4d20 Remove outdated key 2015-08-03 10:11:10 +02:00
Stephane Nicoll d9648a36fe Add more specific test
Add an error controller test that translates a ResponseStatus annotated
exception that does not contain a reason attribute.

See gh-3623
2015-07-30 17:08:03 +02:00
Stephane Nicoll 96fc107ca1 Customize Thymeleaf default template resolver order
Currently, the default TemplateResolver had no specific order. Thymeleaf
handles that with a "always first" strategy (that can be confusing if
several TemplateResolver have a "null" order.

While it is a fine default (and changing it could lead to weird side
effects), it has to be changed as soon as another TemplateResolver bean
is defined in the project.

The `spring.thymeleaf.template-resolver-order` property has been added to
control  the order of the default TemplateResolver.

Closes gh-3575
2015-07-28 14:28:31 +02:00
izeye ee6fc8d917 Fix typos
Closes gh-3608
2015-07-28 08:54:47 +02:00
Stephane Nicoll 32128a6ac2 Polish 2015-07-27 16:02:03 +02:00
Stephane Nicoll 92871ea03e Polish
See gh-3600
2015-07-27 15:15:38 +02:00
Johannes Stelzer 64461bb978 Add locale customization of the ObjectMapper
Add a new spring.jackson.locale property to customize the locale of the
ObjectMapper.

Closes gh-3600
2015-07-27 15:15:30 +02:00
Stephane Nicoll 4c5a1036a3 Merge branch '1.2.x' 2015-07-27 14:58:37 +02:00
Pei-Tang Huang 3953baba81 Add SQLServer XA DataSource class name
Closes gh-3604
2015-07-27 14:58:10 +02:00
Stephane Nicoll 42e230192f Polish 2015-07-24 07:19:53 +02:00
Stephane Nicoll d6e914be87 Add auto-startup configuration property
Allow to disable the auto-startup flag of the default JMS and RabbitMQ
containers. This effectively permit to disable automatic listening via
configuration.

Closes gh-3587
2015-07-24 06:49:27 +02:00
izeye a242415bb1 Remove an unused parameter
Closes gh-3589
2015-07-24 05:55:40 +02:00
Stephane Nicoll 3b5fa5a6a3 Clean server.context-path if necessary
While the doc states that the default value is '/', setting that value
explicitly will lead to an error since we enforce that the default root
is the empty string.

Changing the doc will probably be more confusing than anything else so
we're now cleaning the user's provided value if necessary

Closes gh-3554
2015-07-23 14:22:52 +02:00
Andy Wilkinson 37edee4f5e List classes with no class-level conditions in the auto-config report
This commit adds a new "Unconditional classes" section to the
auto-configuration report. It lists any auto-configuration classes
that do not have any class-level conditions, i.e. the class will be
always be part of the application's configuration.

Closes gh-2209
2015-07-23 12:12:43 +01:00
Andy Wilkinson 24c63c9b55 Adopt RepositoryRestConfigurer and discourage subclassing
A RepositoryRestMvcConfiguration subclass provided by a user is
problematic in a Spring Boot application as it causes
RepositoryRestMvcConfiguration's bean declarations to be processed
before any auto-configuration runs.

One problem that this causes is that it switches off Boot's Jackson
auto-configuration due to RepositoryRestMvcConfiguration having
already declared multiple ObjectMapper beans. Unlike Boot's
auto-configured ObjectMapper, none of these ObjectMappers are marked
as @Primary. This then leads to wiring failures due to multiple
candidates being available.

To address this problem a new RepositoryRestConfigurer abstract has been
introduced in Spring Data Gosling. Its use is now strongly preferred
over subclassing RepositoryRestMvcConfiguration. Note that our own
RepositoryRestMvcConfiguration subclass remains. It is imported as part
of auto-configuration (avoiding the ordering problems described above),
and provides configuration properties binding for
RepositoryRestConfiguration. However, the Jackson ObjectMapper
configuration has been moved out into a new RepositoryRestConfigurer
implementation.

While SpringBootRepositoryRestMvcConfiguration remains, this commit
makes it package private to discourage users from subclassing it. While
this may break existing applications, it, coupled with the documentation
updates, will hopefully guide them toward using
RepositoryRestConfigurer.

Closes gh-3439
2015-07-23 11:58:21 +01:00
Dave Syer e1dec6061d Make MongoRepositoriesAutoConfiguration order more explicit
It has to come after MongoDataAutoConfiguration (not
MongoAutoConfiguration) because it looks for beans that are defined
there (e.g. MongoMappingContext which is the one that scans for entities).

Fixes gh-3577
2015-07-22 16:46:49 +01:00
Dave Syer da816526bd Add additional pre-validation check in ResourceServerProperties
With this change a user can have `@EnableOAuth2Client` without
`@EnableOAuth2Sso`.

Fixes gh-3568
2015-07-21 10:17:51 +01:00
Phillip Webb 6f6f898739 Polish 2015-07-20 10:22:10 -07:00
Dave Syer c5008f844c Make sure bean resolver is set in the OAuth2 expression evaluator
Also copies the ExpressionParser (the only public getter), trust
resolver and permission evaluator (if available in the context). Changes
the logic to not replace an existing OAuth2MethodSecurityExpressionHandler
so that users can override simply by providing a bean of that type.

Fixes gh-3542
2015-07-20 14:20:55 +01:00
Phillip Webb 3b4928c549 Restore ServerProperties.getSessionTimeout()
Restore the deprecated method to give people a change to migrate. The
@DeprecatedConfigurationProperties annotation is now used to generate
the deprecated meta-data, removing the need for manual meta-data.

Closes gh-3537
2015-07-17 14:15:15 -07:00
Stephane Nicoll db41e0d7d5 Fix duplicate meta-data for server.session-timeout
Closes gh-3537
2015-07-17 14:02:38 +02:00
Phillip Webb 08d1f6daf5 Allow persistent servlet sessions across restarts
Update Tomcat, Jetty and Undertow to serialize session data when the
application is stopped and load it again when the application restarts.

Persistent session are opt-in; either by setting `persistentSession`
on the ConfigurableEmbeddedServletContainer or by using the property
`server.session.persistent=true`.

Fixes gh-2490
2015-07-16 17:29:20 -07:00
Phillip Webb 728e64b929 Polish 2015-07-16 12:56:49 -07:00
Andy Wilkinson 352ff4e899 Rename Embedded Mongo configuration prefix to spring.mongodb.embedded
Previously, the prefix was spring.embedded-mongodb. This was
inconsistent with the prefixes for Artermis and HornetQ which are
spring.artemis.embedded and spring.hornetq.embedded respectively.

See gh-2002
2015-07-16 17:04:15 +01:00
Stephane Nicoll 538c8d04b1 Polish 2015-07-16 17:45:00 +02:00