Commit Graph

1322 Commits (d09805fd750163d1d03f1c5b1e85d8a2162e048c)

Author SHA1 Message Date
Dave Syer 84a3e3827b Ensure tomcat on the classpath does not imply web application 9 years ago
Andy Wilkinson 2ae8a021f9 Merge branch '1.2.x' 9 years ago
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
9 years ago
Andy Wilkinson 1e4c972c3d Fix customJodaDateTimeFormat to specify time zone when creating Date
See gh-3569
9 years ago
Dave Syer 2985b0e9d8 Clarify init params in Jersey autoconfig (only servlet and filter)
See gh-3557
9 years ago
Andy Wilkinson 9fcc860908 Polish contribution
Closes gh-3643
9 years ago
Joao Pedro Evangelista 7568af1710 Add auto-configuration of HttpPutContentFormFilter
Closes gh-3652
9 years ago
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
9 years ago
Phillip Webb 8d92236eea Polish 9 years ago
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
9 years ago
Eric Bottard 2b15ea65e2 Polish Javadoc
Closes gh-3667
9 years ago
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.*`
9 years ago
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
9 years ago
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
9 years ago
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
9 years ago
Phillip Webb 4279ffeddf Polish formatting 9 years ago
Stephane Nicoll 7669e888cb Polish
Closes gh-3649
9 years ago
jhernan d8bf3a72da Customize mail sender protocol
See gh-3649
9 years ago
Stephane Nicoll d18180e2e4 Add missing package-info 9 years ago
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
9 years ago
Andy Wilkinson 0e8812f0e9 Merge branch '1.2.x' 9 years ago
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
9 years ago
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
9 years ago
Rob Winch f543e3259e Add Test that HiddenHttpMethodFilter before FilterChainProxy
Fixes gh-3447
9 years ago
Phillip Webb 891dd5a0f6 Polish 9 years ago
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
9 years ago
Stephane Nicoll 3cae8e4d20 Remove outdated key 9 years ago
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
9 years ago
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
9 years ago
izeye ee6fc8d917 Fix typos
Closes gh-3608
9 years ago
Stephane Nicoll 32128a6ac2 Polish 9 years ago
Stephane Nicoll 92871ea03e Polish
See gh-3600
9 years ago
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
9 years ago
Stephane Nicoll 4c5a1036a3 Merge branch '1.2.x' 9 years ago
Pei-Tang Huang 3953baba81 Add SQLServer XA DataSource class name
Closes gh-3604
9 years ago
Stephane Nicoll 42e230192f Polish 9 years ago
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
9 years ago
izeye a242415bb1 Remove an unused parameter
Closes gh-3589
9 years ago
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
9 years ago
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
9 years ago
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
9 years ago
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
9 years ago
Dave Syer da816526bd Add additional pre-validation check in ResourceServerProperties
With this change a user can have `@EnableOAuth2Client` without
`@EnableOAuth2Sso`.

Fixes gh-3568
9 years ago
Phillip Webb 6f6f898739 Polish 9 years ago
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
9 years ago
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
9 years ago
Stephane Nicoll db41e0d7d5 Fix duplicate meta-data for server.session-timeout
Closes gh-3537
9 years ago
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
9 years ago
Phillip Webb 728e64b929 Polish 9 years ago
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
9 years ago
Stephane Nicoll 538c8d04b1 Polish 9 years ago
Andy Wilkinson 2c81907d58 Flesh out and polish Embedded MongoDB auto-configuration contribution
Embedded MongoDB is now auto-configured when it is on the classpath.
The Mongo instance will listen on the port specified by the
spring.data.mongodb.port property. If this property has a value of
zero and randomly allocated port will be used. In such an event, the
MongoClient created by MongoAutoConfiguration will be automatically
configured to use the port that was allocated.

By default, MongoDB 2.6.10 will be used. This can be configured using
the spring.embedded-mongodb.version property. Mongo's sync delay
feature is enabled by default. This can be configured using the
spring.embedded-mongobd.features property.

Closes gh-2002
9 years ago
Henryk Konsek f2b2c085e9 Add auto-configuration support for Embedded MongoDB
See gh-2002
9 years ago
Stephane Nicoll 4aace564a2 Fix typo
Closes gh-3519
9 years ago
Stephane Nicoll aa483984c5 Polish 1683d8a8
Closes gh-3475
9 years ago
Josh Thornhill 1683d8a8f3 Customize default `RabbitListenerFactory`
Expose acknowledgment mode, concurrency, prefecth and transaction size
settings in configuration for the default
`RabbitListenerContainerFactory`.

Closes gh-3479
9 years ago
Stephane Nicoll 22a7b0cdee Customize default `JmsListenerFactory`
Expose acknowledgment mode and concurrency settings in configuration for
 the default `JmsListenerContainerFactory`

 Closes gh-3519
9 years ago
Andy Wilkinson bedf2edffa Update auto-configuration @Bean methods to return most specific type
Closes gh-2536
Closes gh-2403
9 years ago
izeye f4589e7cc3 Fix typos
Closes gh-3504
9 years ago
Stephane Nicoll f2d32d3e98 Add support for property deprecation
Previously, an item could only have a 'deprecated' boolean flag to
indicate that the property is deprecated. It is desirable to provide an
additional description for the deprecation as well as the name of the
property to use instead.

The `deprecated` boolean flag is now supported. Instead, a `deprecated`
object can be specified with two optional attributes: `reason` to provide
an explanation for the deprecation and `replacement` to refer to the
property that should be used instead. If none of them is present, an
empty deprecation object should be set.

For backward compatibility, the `deprecated` field is still set.

Deprecation information can only set via manual meta-data.

Closes gh-3449
9 years ago
Andy Wilkinson b1e9139efe Allow Jackson’s time zone to be configured via the environment
This commit adds a new property, spring.jackson.time-zone, that can be
used to configure the time zone that Jackson uses when configuring
dates. It affects the serialisation of both JDK and Joda date types.

Closes gh-3505
9 years ago
Phillip Webb f0f5f78e25 Polish 9 years ago
Stephane Nicoll e52c190b05 Narrow String properties to a more precise type
We envision that IDE will support auto-completion for known types in the
future, for instance Charset, MimeType, Resource and Locale. Some of our
own configuration keys use a raw String type whereas they actually
represent a higher-level concept.

We now make sure to expose these with a better type, if applicable.

Closes gh-2898
9 years ago
Stephane Nicoll eafee1ecb6 Fix ordering of mail auto-configuration
It is not possible to put `@Order` on nested `@Configuration` classes and
there is no ordering guarantee of them anyway. Previously, we relied on
the declaration order to check if the `test-connection` flag should apply
to an existing `JavaMailSenderImpl`. It turns out at the
`JavaMailSenderImpl` bean was not created at that time and so the
evaluation was wrongly failing.

To make that more explicit, that code is now in its own
auto-configuration with an explicit `@AutoConfigureAfter` declaration.

Since the JNDI support could be affected by the exact same issue, it has
been restored to its own package private configuration class that is
processed before the  `MailSenderAutoConfiguration` content is evaluated.

Closes gh-3478
9 years ago
Phillip Webb a158baf50f Back-off auto-conf on EntityManagerFactory bean
Don't auto-configure a LocalContainerEntityManagerFactoryBean if the
user directly defines an EntityManagerFactory bean.

Fixes gh-2803
9 years ago
Andy Wilkinson db50fb8704 Remove redundant metadata for JOOQ’s SQL dialect
Also add a test that I’d written before Phil fixed the problem in
5dbe623.

See gh-3468
9 years ago
Phillip Webb 5dbe6232b8 Use jOOQ enum for sqlDialect
Switch JooqProperties.sqlDialect from a String to the actual enum to
allow IDE hints and case insensitive binding.

Fixes gh-3468
9 years ago
Phillip Webb fd6024ebf1 Move and refactor Redis test server @Rule
Move the Redis JUnit @Rule so that it can be used with
SessionAutoConfigurationTests. Also refactored the internals a little.
9 years ago
Phillip Webb 9ebe15232e Polish 9 years ago
Dave Syer 28edc95f18 Ensure Spring Session autoconfig creates ServerProperties carefully
Without this change there can be more than one ServerProperties in a
context with different names.

Fixes gh-3476
9 years ago
Dave Syer e5d3fa0c6c Merge remote-tracking branch '1.2.x' 9 years ago
Dave Syer ff79138aa5 Alternative fix for Rabbit listener transactions
Never inject a transaction manager (user can create his own
"rabbitListenerContainerFactory" bean if he wants an actual
non-JTA transaction manager.

See gh-3432
9 years ago
Dave Syer 67933ab01f Add boolean flag spring.rabbit.listener.useTransactionManager
If set *and* there is a transaction manager in the context, then the
listener container created by Spring Boot will use the transaction
manager to execute the listeners.

Fixes gh-3432 (by virtue of not requiring a JtaTransactionManager any
more).
9 years ago
Stephane Nicoll cb5eccb5c1 Add missing handle-as meta-data
Liquibase has a `changeLog` property that is definitely used as a
`Resource` but cannot be defined as such as the original String value
should be kept against an API we don't control.

Update the tests also to make it more clear that if hints are added
against a property that is detected automatically, said property still
keeps all its auto-discovered capabilities.

Closes gh-3457
9 years ago
Stephane Nicoll 8ff8afec7c Add "handle-as" hint provider
Replace the enum provider by a more general purpose provider that can
substitute the type of the property for the purpose of auto-completing
the values.

"handle-as" can be used for enums but for any type that the IDE
understands such as locale, charset, mime-type and Spring's resource
abstraction.

Closes gh-3457
9 years ago
Phillip Webb 67f7079cb2 Formatting 9 years ago
Stephane Nicoll e344eece99 Remove hint for server.tomcat.compression
server.tomcat.compression has been removed in 00d594d so the hint for it
is no longer relevant.
9 years ago
Stephane Nicoll 97634e85ac Remove unnecessary keyword 9 years ago
Stephane Nicoll f77b0e4b6a Force documentation of nested group
The `strategy` group is not detected in the meta-data because the
Strategy inner class is not defined at the "right" level in the
hierarchy.

For now, `@NestedConfigurationProperty` was added to workaround the
issue. Once gh-3454 is solved, we should remove them.
9 years ago
Stephane Nicoll 4dda1814e2 Prevent bean early initialization
Fix `CacheManagerValidatorPostProcessor` that could lead to early bean
initialization.

Fixes gh-3440
9 years ago
Phillip Webb 3588ca8637 Add session configuration properties
Add support for the following server properties which can be used to
configure the session:

	server.session.tracking-modes
	server.session.cookie.name
	server.session.cookie.domain
	server.session.cookie.path
	server.session.cookie.comment
	server.session.cookie.http-only
	server.session.cookie.secure
	server.session.cookie.max-age

In addition `server.session-timeout` is now deprecated and has been
replaced with `server.session.timeout`.

Fixes gh-3240
9 years ago
Stephane Nicoll a073a505ae Move spring.oauth2.* to security.oauth2.*
Unfortunately, we have no other choice to flip the ignoreUnknownFields
attribute of `SecurityProperties` has many different target are now set
for that namespace outside the class. See gh-3445 for a potential way
to improve that.

Closes gh-3327
10 years ago
Phillip Webb ef39634e30 Polish 10 years ago
Phillip Webb 223a6bd062 Merge branch '1.2.x' 10 years ago
Phillip Webb 7da808918f Fix Flyway and Liquibase JPA 'depends-on' setup
Ensure that FlywayAutoConfiguration and LiquibaseAutoConfiguration occur
after HibernateJpaAutoConfiguration so that the DependsOnPostProcessor
condition can correctly check for a LocalContainerEntityManagerFactory
bean.

Fixes gh-3437
10 years ago
Phillip Webb 9b78f5d52e Replace @ConditionalOnExpression conditions
Replace @ConditionalOnExpression usage in auto-configuration in favor
of faster direct Environment access.
10 years ago
Phillip Webb b2fcd77d93 Rework EndpointWebMvcAutoConfiguration port logic
Update the `ManagementServerPort` detection logic to attempt direct
property resolution before looking for a local property bean
definition. Bean definitions provided by auto-configuration classes
are ignored.

This change allow `OnManagementMvcCondition` to use the
`ManagementServerPort` to determine when `EndpointWebMvcConfiguration`
should apply (removing the need to create a temporary context).

See gh-3345
10 years ago
Marten Deinum a3e62676af Extend TemplateViewResolverProperties for Groovy
Use AbstractTemplateViewResolverProperties as the base class for
GroovyTemplateProperties since the Spring GroovyMarkupViewResolver is
an AbstractTemplateViewResolver.

The auto-configuration for Groovy is now more aligned with the existing
Freemarker and Velocity auto-configuration, with a `resourceLoaderPath`
property being used instead of `prefix`.

Fixes gh-3365
Closes gh-3374
10 years ago
Phillip Webb 0cf6efca4f Polish 10 years ago
Stephane Nicoll eb10275f5a Polish
Polish 383e94c to validate any `JavaMailSenderImpl` and not only the
one that has been created by auto-configuration.

Closes gh-3409
10 years ago
Eddú Meléndez 6f31080f78 Add mail server connection check
If a `JavaMailSenderImpl` is available, check that the underlying mail
server is available on startup. Add a `spring.mail.test-connection`
property to control this behaviour.

Closes gh-3408
10 years ago
Dave Syer 20091b75c9 Tidy up some oauth2 features and add a test for request-scoped context 10 years ago
Stephane Nicoll 774474f8b7 Add hint providers for core properties
Closes gh-3322
10 years ago
Spring Buildmaster 7ce391db4f Next development version 10 years ago
Phillip Webb b1f8a692a8 Merge branch '1.2.x' 10 years ago
Phillip Webb 04dfac1c6c Formatting 10 years ago
Phillip Webb d61c38167e Formatting 10 years ago
Stephane Nicoll 533d36a468 Merge branch '1.2.x' 10 years ago
Stephane Nicoll 441049cf4e Auto-detect JMS sessionTransacted flag
If a JtaTransactionManager is present, it is associated with the
auto-created JmsListenerContainerFactory. However, if no such transaction
manager is present, local transaction support is not enabled.

This gives a default situation where the message is acknowledged even
before the listener is invoked. We now make sure to turn on local JMS
transactions if no JtaTransactionManager is present.

Fixes gh-3393
10 years ago
Andy Wilkinson 2159190713 Merge branch '1.2.x' 10 years ago