Commit Graph

2467 Commits

Author SHA1 Message Date
Andy Wilkinson 5198fe887b Stop auto-config of MethodValidationPP triggering early init
Previously, if a user's configuration class provided a custom
Validator bean, that configuration class would be initialized very
early so that the Validator could be used to create the
auto-configured MethodValidationPostProcessor. This early
initialization could problems as it may prevent any of the
configuration class's dependencies from being post-processed.

This commit updates the injection of the Validator bean to be lazy,
thereby preventing the creation of the auto-configured
MethodValidationPostProcessor from triggering early initialization.

Closes gh-9416
2017-07-21 13:33:33 +01:00
Phillip Webb 68910f2b8f Polish 2017-07-19 10:21:06 -07:00
Stephane Nicoll 7e97d38de7 Polish Javadoc
Closes gh-9726
2017-07-19 14:38:38 +02:00
Madhura Bhave 6381b88736 Create Jwk and Jwt token store beans conditionally
Closes gh-9777
2017-07-17 16:51:16 -07:00
Phillip Webb aa57ca7e18 Polish 2017-07-06 16:53:04 -07:00
Stephane Nicoll 85c7643638 Remove use of 'javax.annotation.Resource'
This commit removes the only use of the `javax.annotation.Resource`
annotation from the codebase. This ensures that injection point are
only defined with Spring's annotation model.

Closes gh-9441
2017-06-26 17:46:46 +02:00
Stephane Nicoll 58a1ed19a9 Polish 2017-06-26 13:36:57 +02:00
Stephane Nicoll 5aa27beb54 Polish 2017-06-23 11:40:16 +02:00
Stephane Nicoll 90c4e7518b Detect Neo4j https driver url
Closes gh-9549
2017-06-23 11:39:39 +02:00
Johnny Lim 8ca70a7efd Polish
See gh-9570
2017-06-22 09:28:49 +02:00
Madhura Bhave e437c4cd67 OAuth2ClientIdCondition should not match if clientId absent
Fixes gh-9435
2017-06-16 10:55:49 -07:00
Stephane Nicoll 5d69318e2d Add reference to SpringBootApplication in EnableAutoConfiguration
Closes gh-9521
2017-06-15 13:43:13 +02:00
Spring Buildmaster 05d4d0281c Next Development Version 2017-06-08 12:47:16 +00:00
Andy Wilkinson e5906a6b64 Allow HttpMsgConverter to depend on ConvService without creating a cycle
In an MVC web application, DelegatingWebMvcConfiguration provides the
ConversionService while also consuming WebMvcConfigurerAdapters that,
among other things, can configure HTTP message converters. Boot's
WebMvcConfigurerAdapter, WebMvcAutoConfigurationAdapter, consumes
the HttpMessageConverters bean and uses it to configure Spring MVC's
HTTP message converters. This can create a bean dependency cycle if
an HTTP message converter bean depends, directly or indirectly on
the ConversionService. An example of the cycle is:

┌─────┐
|  jsonComponentConversionServiceCycle.ThingDeserializer defined in …
↑     ↓
|  org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration
↑     ↓
|  org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter
↑     ↓
|  org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration
↑     ↓
|  mappingJackson2HttpMessageConverter defined in class path resource [org/springframework/boot/autoconfigure/web/JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration.class]
↑     ↓
|  jacksonObjectMapper defined in class path resource [org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration$JacksonObjectMapperConfiguration.class]
└─────┘

This commit breaks the cycle by making WebMvcAutoConfigurationAdapter
consume HttpMessageConverters lazily. This allows the adapter to be
created without triggered instantiation of every HTTP message
converter bean and all their dependencies. This allows it to be
injected into DelegatingWebMvcConfiguration without triggering an
attempt to retrieve the ConversionService.

Closes gh-9409
2017-06-07 17:18:09 +01:00
Andy Wilkinson 6b7dfce5c6 Formatting 2017-06-07 17:17:57 +01:00
Andy Wilkinson a03ddd331c Polishing 2017-06-07 17:14:26 +01:00
Andy Wilkinson ad629055fa Ensure that custom static resource locations end with /
Closes gh-9360
2017-06-06 11:39:04 +01:00
Phillip Webb b9fd99e268 Polish 2017-06-02 13:47:28 -07:00
Stephane Nicoll f11edd1eb3 Add missing `@Configuration` on `EmbeddedDatabaseConfiguration` 2017-06-02 17:42:18 +02:00
Andy Wilkinson a347383111 Merge branch '1.4.x' into 1.5.x 2017-06-02 14:18:44 +01:00
Andy Wilkinson bf656c70ad Improve MultipartProperties' javadoc
Closes gh-9073
2017-06-02 14:13:26 +01:00
Stephane Nicoll c736a1698b Clarify default value of `ConditionalOnMissingBean` on bean methods
Closes gh-9387
2017-06-02 14:55:58 +02:00
Stephane Nicoll b8591206d5 Polish 2017-05-29 11:49:46 +02:00
Stephane Nicoll 062dc3cb9a Upgrade to Neo4J OGM 2.1.3
Closes gh-9335
2017-05-29 11:48:55 +02:00
Stephane Nicoll b5709fd618 Polish
See gh-9330
2017-05-28 17:44:58 +02:00
Stephane Nicoll 50876382db Improve Spring Session validation message
Closes gh-9284
2017-05-23 11:37:26 +02:00
Phillip Webb 440d03bf9e Merge branch '1.4.x' into 1.5.x 2017-05-15 15:59:08 -07:00
Phillip Webb 9a4a20537c Polish 2017-05-15 11:19:19 -07:00
Andy Wilkinson fd2ab2fee0 Merge branch '1.4.x' into 1.5.x 2017-05-15 17:44:42 +01:00
Andy Wilkinson 198093c6a8 Fix violation reported by Checkstyle 2017-05-15 17:44:17 +01:00
Andy Wilkinson 5693acf558 Merge branch '1.4.x' into 1.5.x 2017-05-15 17:08:53 +01:00
Andy Wilkinson a6f8351dd6 Close Liquibase-specific DataSource once database has been migrated
Previously, when the liquibase.url, .username, and .password
properties were used to configure a DataSource specifically for
Liquibase that DataSource would never be explicitly closed. As it is
created by DataSourceBuilder with no explicitly configured type it
will use whichever connection pool is available and, therefore, will
create and keep open the pool's minimum number of connections. This
is an unnecessary use of resources both in the application and in the
database.

This commit updates LiquibaseAutoConfiguration so that if it uses
DataSourceBuilder to create a DataSource then it will also close that
DataSource once the database has been migrated.

Closes gh-9218
2017-05-15 17:08:45 +01:00
Andy Wilkinson a2e749940e Merge branch '1.4.x' into 1.5.x 2017-05-12 15:00:58 +01:00
Andy Wilkinson a3f5cbc4a2 Polishing 2017-05-12 15:00:44 +01:00
Phillip Webb 4a7dcc8786 Formatting 2017-05-09 21:43:24 -07:00
Stephane Nicoll e236b71615 Move RabbitMQ Simple listener support to dedicated namespace
Move `spring.rabbitmq.listener.*` to `spring.rabbitmq.listener.simple.*`
in preparation for Spring AMQP 2.0 that supports different container
types.

Closes gh-9108
See gh-9055
2017-05-05 10:03:47 +02:00
Stephane Nicoll ea33cc2f7d Deprecated MustacheCompilerFactoryBean
Closes gh-8999
2017-05-03 13:09:52 +02:00
Stephane Nicoll 5121b848e1 Making sure to stop embedded web servers in tests
Closes gh-9012
2017-05-03 11:33:42 +02:00
Phillip Webb 76ee2f401c Polish 2017-04-28 09:48:13 -07:00
Phillip Webb 4db4c81b9b Polish 2017-04-28 09:38:56 -07:00
Stephane Nicoll 1de2316a0b Refine validator and MVC validator configuration
This commit ensures that a primary JSR 303 and Spring Validator will be
exposed if the auto-configuration kicks in. As `LocalValidatorFactoryBean`
exposes 3 contracts (JSR-303 `Validator` and `ValidatorFactory` as well as
the `Spring` validator one), this makes sure that those types can be
injected by type.

`LocalValidatorFactoryBean` exposes 3 contracts and we're only checking
for the absence of a `javax.validation.Validator` to auto-configure a
`LocalValidatorFactoryBean`. If no standard JSR validator exists but a
Spring's `Validator` exists and is primary, we shouldn't flag the
auto-configured one as `@Primary`. Previous iterations on this feature
have made sure that we'll auto-configure at most one
`javax.validation.Validator` so not flagging it `@Primary` is no problem.

This commit also restores and adds tests that validates
`ValidationAutoConfiguration` will configure a JSR validator even if a
Spring Validator is present.

This effectively fixes gh-8495 in a different way.

Closes gh-8979
Closes gh-8976
2017-04-28 11:41:42 +02:00
Stephane Nicoll f42998f5ca Revert "Refine validator and MVC validator configuration"
This commit reverts c9561f0 and 69a8c0d and effectivly fixes gh-8979 but
reintroduces the issue reported in gh-8495.
2017-04-28 11:12:09 +02:00
Stephane Nicoll 3dc9b125d7 Merge branch '1.4.x' into 1.5.x 2017-04-27 14:30:40 +02:00
Stephane Nicoll 703a6dc056 Prevents BasicErrorControllerIntegrationTest to start another server
`BasicErrorControllerIntegrationTest` is handling the context in each test
and yet it starts a useless test via `@SpringBootTest`. This commit
removes the useless runner and associated annotations.
2017-04-27 14:26:50 +02:00
Spring Buildmaster 9768b0a8c2 Next Development Version 2017-04-21 08:32:01 +00:00
Phillip Webb 5f3d5fbec1 Remove public "skip path extension" constant
Remove the public constant to make it clearer that skipping path
extensions is really an internal Spring Boot concern.

See gh-8765
2017-04-20 13:31:04 -07:00
Phillip Webb 69a8c0d871 Fix MVC validator configuration warning
Replace the MVC validator post processor with an `@Import` so
that a "cannot enhance @Configuration bean definition"
warning does not occur.

Fixes gh-8951
See gh-8495
2017-04-20 11:57:18 -07:00
Spring Buildmaster d719d2cbbc Next Development Version 2017-04-20 12:46:19 +00:00
Dave Syer 14638e67bc Extended PropertiesLauncher class location logic
Update `PropertiesLauncher` so that classes can be loaded outside of
`BOOT-INF/classes`. You can use a subdirectory, or the root directory
of an external jar (but not the parent archive to avoid issues
with agents and awkward delegation models).

Fixes gh-8480
Closes gh-8486
2017-04-19 22:18:12 -07:00
Phillip Webb 5abc050a96 Support detection and with test initializers
Relax `SpringBootTestContextBootstrapper` rules so that a test can
specify an `ApplicationContextInitializer` and still have
`@SpringBootConfiguration` detected.

Prior to this commit detection would not occur because it's possible
that an initializer _could_ register configuration. This scenario is
actually quite unlikely to occur, certainly less likely than wanting to
use an initializer in combination with auto-detection.

Fixes gh-8483
2017-04-19 22:18:12 -07:00
Phillip Webb c9561f031c Refine validator and MVC validator configuration
Update `ValidationAutoConfiguration` and `WebMvcAutoConfiguration` to
ensure as much as possible that only a single Validator bean of each
type is registered.

Validation auto-configuration now does the following:
- If no validator is found: Registers a `LocalValidatorFactoryBean`
  (providing both Spring and JSR validation)
- If the user defines a Spring & JSR validator: Backs off
- If the user defines only a JSR validator: Adapts it to a Spring
  validator (without exposing another JSR implementation)

WebMvcAutoConfiguration auto-configuration has been updated to make
MVC validation follow common Spring Boot patterns:
- If not validator beans are found (due to the user excluding
  ValidationAutoConfiguration) a new `mvcValidator` bean will be
  registered.
- If a single validator bean is found it will be used for MVC
  validation.
- If multiple validator beans are defined it will either use the one
  named `mvcValidator` or it will register a new `mvcValidator` bean

Any automatically registered `mvcValidator` bean will not implement
the JSR validator interface.

Finally, it is no longer possible to provide an MVC validator via a
`WebMvcConfigurer`.

Fixes gh-8495
2017-04-19 22:18:12 -07:00
Andy Wilkinson b9be0e3e0f Skip actuator path extension content negotiation
Allow `PathExtensionContentNegotiationStrategy` to be bypassed by
actuator endpoints. Prior to this commit calling `/loggers/com.aaa.cab`
would return a HTTP 406 response due to `.cab` being a known extension.

Fixes gh-8765
2017-04-18 14:56:11 -07:00
Walter Seymore f5f65463d2 Fail fast on getKeyFromServer() failure
Update `ResourceServerTokenServicesConfiguration` to fail fast if the
`getKeyFromServer()` call fails. Since the key is part of the singleton
`JwtAccessTokenConverter` bean there is not real way to refresh without
restarting the application.

A hard failure seems preferable to an inconsistent state.

Closes gh-8924
2017-04-18 14:56:10 -07:00
Phillip Webb b2ae6b5f50 Merge branch '1.4.x' into 1.5.x 2017-04-17 22:14:45 -07:00
Phillip Webb cdf3eadc95 Rename AbstractTemplateAvailabilityProvider
Rename `AbstractTemplateAvailabilityProvider` to
`PathBasedTemplateAvailabilityProvider`.

Closes gh-8913
2017-04-17 22:12:44 -07:00
Stephane Nicoll e1f727719a Merge branch '1.4.x' into 1.5.x 2017-04-14 16:04:22 +02:00
Stephane Nicoll b7efec5401 Support case insensitive value for Cassandra's SchemaAction
Closes gh-8903
2017-04-14 16:04:04 +02:00
Stephane Nicoll 715cf7da75 Do not enable cglib if spring.aop.proxy-target-class is configured
This commit makes sure to honour the `spring.aop.proxy-target-class`
property if set by the user. Previously, the
`PersistenceExceptionTranslationPostProcessor` was always configured to
use cglib, regardless of the value of that property.

Closes gh-8887
2017-04-12 10:55:43 +02:00
Phillip Webb c97268981a Polish 2017-04-11 20:59:03 -07:00
Phillip Webb d301d0f4c3 Merge branch '1.4.x' into 1.5.x 2017-04-11 20:42:48 -07:00
Phillip Webb 758ddcd420 Polish 2017-04-11 20:17:23 -07:00
Stephane Nicoll a00b695748 Do not enable cglib if spring.aop.proxy-target-class is configured
This commit makes sure to honour the `spring.aop.proxy-target-class`
property if set by the user. Previously, the
`MethodValidationPostProcessor` was always configured to use cglib,
regardless of the value of that property.

Closes gh-8869
2017-04-11 15:28:21 +02:00
Stephane Nicoll a132bd141f Merge branch '1.4.x' into 1.5.x 2017-04-10 16:13:53 +02:00
Stephane Nicoll 0a55e3e736 Polish "Clarify edge case docs on ConditionalOnClass"
Closes gh-8185
2017-04-10 16:12:11 +02:00
Andy Wilkinson 035cbd91f4 Use main thread in OnClassCondition if thread create/start fails
Previously, as a result of the changes made in de50cfa21e, an
application would fail to start on Google AppEngine as it prevents
the creation of new threads.

This commit updates OnClassCondition so that it falls back to
performing the work on the main thread when its unable to shift it
to a separate thread.

Closes gh-8584
2017-04-10 15:09:21 +01:00
Phillip Verheyden 08f8219248 Clarify edge case docs on ConditionalOnClass
When used as a meta-annotation the value() attribute of
@ConditionalOnClass will fail silently resulting in the @Conditional
nature of the annotation being ignored.

See gh-8185
2017-04-10 15:58:17 +02:00
Andy Wilkinson f6a7e17688 Merge branch '1.4.x' into 1.5.x 2017-04-10 13:45:41 +01:00
Andy Wilkinson 6564fb3d96 Consider all loader paths when checking template availability
Closes gh-8842
2017-04-10 13:37:32 +01:00
Stephane Nicoll 7c9b2afa5b Merge branch '1.4.x' into 1.5.x 2017-04-10 10:57:52 +02:00
Dr. Stefan Hüttemann 0294ad3e95 Allow to disable max http post size limit
Closes gh-8508
2017-04-10 10:54:20 +02:00
Andy Wilkinson c74f0a70ca Merge branch '1.4.x' into 1.5.x 2017-04-07 12:14:47 +01:00
Andy Wilkinson 5dad7182db Address deprecation warnings 2017-04-07 12:01:01 +01:00
Phillip Webb ad38776de3 Polish 2017-04-04 09:48:10 -07:00
Phillip Webb ddcb5ee328 Polish 2017-04-04 09:36:27 -07:00
Andy Wilkinson 94e9c9417d Merge branch '1.4.x' into 1.5.x 2017-04-04 10:22:50 +01:00
Andy Wilkinson b280e3092d Don't forward to welcome page that won't exist due to custom mapping
Previously, WelcomePageHandlerMapping would forward to index.html.
This assumed that the static path pattern was always /**. If it had
been customised to, for example, /foo/**, then the forward would still
be to index.html and a 404 would result as the page is actually
available at /foo/index.html.

At first glance, it would appear that the forward should be made to
foo/index.html. However, as it's a forward rather than a redirect,
any relative URLs in the index.html page would then be resolved using
/ whereas they should be resolved using /foo/. This could be addressed
by using a redirect rather than a forward, but we don't want to do
that as it's more invasive and would require a roundtrip back to the
client. Instead, this commit simply stops performing the forward when
the static path pattern is not /**.

Closes gh-8788
2017-04-04 10:13:24 +01:00
Stephane Nicoll 5cc2e103f2 Disable unexpected datasource initialization
This commit restore the disabling of datasource initialization that was
accidently removed in db33a75 so that other tests aren't affected by it.
2017-04-03 10:42:12 +03:00
Stephane Nicoll 0163731043 Automatically enable transaction management for Neo4j
This commit makes sure that `@EnableTransactionManagement` is
auto-configured with Neo4j. It actually reuses what was done in #8434,
making sure that the `Neo4jDataAutoConfiguration` is ordered properly.

Closes gh-8587
2017-04-03 09:37:37 +03:00
Stephane Nicoll db33a75484 Enable transaction management consistently
Previously to this commit, transaction management was only enabled when
a `DataSource` is configured. The processing of `@Transactional`
annotations are now enabled as long as a `PlatformTransactionManager` is
present.

Also, the `spring.aop.proxy-target-class` is now honoured if set, still
defaulting to CGLIB mode.

Closes gh-8434
2017-04-03 09:24:15 +03:00
Stephane Nicoll fa3679af71 Merge branch '1.4.x' into 1.5.x 2017-03-16 12:40:12 +01:00
Stephane Nicoll cd76da9a4c Avoid using immutable collections for configuration proprerties
Closes gh-8620
2017-03-16 12:39:48 +01:00
Stephane Nicoll 22934e097d Merge branch '1.4.x' into 1.5.x 2017-03-15 15:10:37 +01:00
Vedran Pavic 17aad4f00c Improve `RedisSessionConfiguration` conditions
Closes gh-8582
2017-03-15 15:09:31 +01:00
Madhura Bhave 8deb72be80 Fix ResourceServerProperties validation
Only try and validate if clientId is present.

Fixes gh-8565
2017-03-14 11:03:21 -07:00
Stephane Nicoll 5d27c7e501 Handle non supported JOOQ dialect
This commit uses a fallback translator if the JOOQ Dialect in use is not
one we support.

Closes gh-8521
2017-03-10 16:27:44 +01:00
Stephane Nicoll f8bf05b91f Polish contribution
Closes gh-8474
2017-03-10 10:20:48 +01:00
srichard 0ddaca57fb Add Tomcat Access Log's fileDateFormat property
Closes gh-8396
2017-03-10 09:57:00 +01:00
Stephane Nicoll feb1ab375f Merge branch '1.4.x' into 1.5.x 2017-03-10 09:36:55 +01:00
Eddú Meléndez 251090b1e5 Add missing spring-data-cassandra metadata
This commit adds the missing
`spring.data.cassandra.repositories.enabled` in the metadata and the
documentation.

Closes gh-8562
2017-03-10 09:34:19 +01:00
Stephane Nicoll 6624fe47c3 Merge branch '1.4.x' into 1.5.x 2017-03-09 18:33:28 +01:00
Stephane Nicoll e7922a574a Polish 2017-03-09 18:33:13 +01:00
Stephane Nicoll 207ab3ecb4 Merge branch '1.4.x' into 1.5.x 2017-03-09 18:21:40 +01:00
Stephane Nicoll 07c56c60ba Make sure Hazelcast bootstraps before any JCache setup
This commit makes sure that if a `javax.cache.CacheManager` is required,
an auto-configured `HazelcastInstance` is fully resolved first. This
prevents the case where the JCache bootstrap actually starts an instance
early, followed by a second (potentially unwanted) instance created by the
regular auto-configuration.

Since the JCache implementation works with an `HazelcastInstance` behind
the scenes, if there is one `HazelcastInstance` configured and it has a
name, then we configure the `CacheProvider` to use that. Future Hazelcast
version will allow to pass the instance directly (i.e. not requiring an
actual name).

Closes gh-8484
2017-03-09 17:59:20 +01:00
Phillip Webb fedd7b9506 Polish 2017-03-06 12:01:05 -08:00
Phillip Webb a3d5101369 Merge branch '1.4.x' into 1.5.x 2017-03-06 11:48:52 -08:00
Phillip Webb f5aeac3658 Polish 2017-03-06 11:43:29 -08:00
Stephane Nicoll 28bba876fa Merge branch '1.4.x' into 1.5.x 2017-03-06 08:19:12 +01:00
Stephane Nicoll 9fb9a67c4b Avoid early initializations
This commit flags the two `BeanPostProcessors` registered by the
embedded support as `synthetic` so that they don't trigger an early
initialization of other components.

Closes gh-8467
2017-03-06 08:16:58 +01:00
Spring Buildmaster d23fa24340 Next Development Version 2017-03-03 16:18:26 +00:00
Spring Buildmaster 2a83e80a9b Next Development Version 2017-03-03 14:39:21 +00:00