Commit Graph

2507 Commits (b03f8905679838c108a3de9a1ca0f649d8877b98)

Author SHA1 Message Date
Marten Deinum ab3d65ccae Polish JobLauncherCommandLineRunner
The JobLauncherCommandLineRunner reassigned method arguments inside the
merge method. Instead of reassigning the method argument just return
the new instance directly.

Also some minor cleanup (unnesseccary null check and continue keyword).

Closes gh-10612
7 years ago
Stephane Nicoll 81e33dc801 Fix NPE in url is null and no embedded database is available
Closes gh-10626
7 years ago
Spring Buildmaster c0f9f64776 Next Development Version 7 years ago
Andy Wilkinson ffdff1cdc2 Consider multiple MBeanExporters when excluding beans from export
Closes gh-10632
7 years ago
Johnny Lim bfa291f671 Polish 7 years ago
Andy Wilkinson 616d11c00a Only wait for background preinit to complete when it has started
Closes gh-10362
7 years ago
Eddú Meléndez 93844bffbc Polish JacksonAutoConfiguration
This commit removes unused constructor parameters introduced in 0c2ecb7.

Closes gh-10412
7 years ago
Stephane Nicoll d490b99473 Clarify scope of spring.datasource.platform
Closes gh-10416
7 years ago
Stephane Nicoll 61ae92992b Polish "Document default value change for proxy-target-class"
Closes gh-10134
7 years ago
Stephane Nicoll fbb6b88155 Document default prefix/suffix values
Closes gh-10290
7 years ago
Stephane Nicoll b309495c2e Polish 7 years ago
Spring Buildmaster 30eb937a83 Next Development Version 7 years ago
Andy Wilkinson 5938df52ea 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
7 years ago
Stephane Nicoll db18abc542 Fix Elasticsearch template condition if no client is defined
This commit makes sure to backoff if a Client bean is not available.

Closes gh-10143
7 years ago
Stephane Nicoll 5fc01880bc Polish 7 years ago
Madhura Bhave 64ffcfc83f Document JWK property
Closes gh-10022
7 years ago
Paul Vorbach 04ca7f137d Identify and fix incomplete assertions
Several calls to assertThat lacked a following assertion most often due
to wrong use of parenthesis.

See gh-10084
7 years ago
Madhura Bhave 9b5e5f32e1 ClientId not always required for client credentials
Fixes gh-10013
7 years ago
Stephane Nicoll fa037610f8 Add missing class check on Neo4jDataAutoConfiguration
Neo4jDataAutoConfiguration is meant to kick in when Spring Data Neo4J is
on the classpath. Yet, we were only checking for the presence of neo4j
itself and the transaction manager provided by spring-tx.

This commit makes sure to back off if Spring Data Neo4J is not present.

Closes gh-10038
7 years ago
Stephane Nicoll dbaaf2a5fa Improve conditions on FreeMarkerWebConfiguration
This commit makes sure to prevent the Freemarker web auto-configuration
to kick in if `spring-webmvc` is not on the classpath.

Closes gh-10027
7 years ago
Andy Wilkinson e08d09f5a3 Polish "Fix logged property names when initializing OAuth2 client"
See gh-9944
7 years ago
Christian Bühler 6babd41f19 Fix logged property names when initializing OAuth2 client
Closes gh-9944
7 years ago
Johnny Lim 56f47e1a50 Polish
Closes gh-9938
7 years ago
Gytis Trikleris f43ad00129 Delay Narayana recovery manager until it's started explicitly
Closes gh-9641
7 years ago
Andy Wilkinson d62c26c971 Ensure that preinitialization has completed before run returns
Previously, background preinitialization was started in response to
an ApplicationEnvironmentPreparedEvent and would complete at an
undetermined time later. This opened a window where SpringApplication
run could return and background preinitialization could still be
in progress. If, within this window, something attempted to configure
the logging system, an IO failure could occur as logging on the
background preinitialization thread would attempt to use resources
that had been closed.

This commit updates BackgroundPreinitializer so that it waits for
preinitialization to have completed when it receives an application
ready or application failed event. This prevents SpringApplication
run from returning while preinitialization is still in progress,
closing the window described above.

With info level logging enabled it appears that background
preinitialization consistently completes before the application ready
event is published. As a result, waiting should have no adverse effect
on performance in normal circumstances. With logging configured such
that background preinitialization outputs a large volume of log
messages (enabling trace logging for the root logger, for example), it
will be slowed down sufficiently for waiting to be necessary.

Closes gh-5669
7 years ago
Andy Wilkinson 42eec50e90 Perform background preinitialization once per class loader
Background preinitialization triggers static initialization of a
number of components that are slow to initialize. As the
initialization is static, it's only necessary once per class loader.

Previously, a new background preinitialization thread would be
created and started for each ApplicationEnvironmentPreparedEvent.
This commit updates the preinitializer to only create and start the
thread if preinitialization has not already been started for the
current class loader.

Closes gh-9869
7 years ago
Spring Buildmaster 17a5bb0be4 Next development version 7 years ago
Spring Buildmaster 41c5c0e7c9 Next development version 7 years ago
Phillip Webb dca463c7d9 Polish 7 years ago
Phillip Webb 66619bbe2b Formatting 7 years ago
Phillip Webb b9cfe21193 Make @ImportAutoConfiguration not register package
Update `@ImportAutoConfiguration` so that it is no longer annotated with
`@AutoConfigurationPackage` and as such isn't a marker for
`AutoConfigurationPackages`.

Having `@ImportAutoConfiguration` marked as an auto-configuration
package is particularly problematic in tests since it frequently breaks
context caching.

Fixes gh-9282
7 years ago
Stephane Nicoll 9fd94720f1 Better customization of the auto-configured ActiveMQConnectionFactory
This commit exposes additional properties and a callback interface to
further tune the auto-configured ActiveMQConnectionFactory.

Closes gh-9667
7 years ago
Stephane Nicoll 9a34d952e9 Provide an alternative to `spring.activemq.pool.configuration`
This commit expands the support of PooledConnectionFactory so that
binding the third party object is no longer necessary. All 3rd party
properties are now deprecated in favour of our explicit support.

The main reason behind this change is that a `connection-factory` and
`properties` property were exposed. The former is used to set the
`ConnectionFactory` and makes no sense as a key. The latter is
rebuilding the underlying `ActiveMQConnectionFactory` at each call
without reusing any existing settings.

Closes gh-9837
7 years ago
Andy Wilkinson d4ecda9030 Work around javac bug (internal review ID 9050163) 7 years ago
Andy Wilkinson bb35e772c2 Polish "Make NarayanaRecoveryManagerBean conditional on missing bean"
Closes gh-9724
7 years ago
Gytis Trikleris d8a6954744 Make NarayanaRecoveryManagerBean conditional on missing bean
See gh-9724
7 years ago
Andy Wilkinson 8f877dcee2 Disable auto-config of Narayana's JMS support when JMS module absent
Closes gh-9844
7 years ago
Andy Wilkinson 39b4ecdf63 Adapt to breaking change in Spring Data
See gh-9834
7 years ago
Andy Wilkinson c70cc55db8 Polishing
See gh-9827
7 years ago
Andy Wilkinson 15410a406e Revert "Stop auto-config of MethodValidationPP triggering early init"
5198fe887b. The underlying Framework
problem that prevents @Lazy from working properly is still there
in some form or another.

See gh-9416
7 years ago
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
7 years ago
Phillip Webb 68910f2b8f Polish 7 years ago
Stephane Nicoll 7e97d38de7 Polish Javadoc
Closes gh-9726
7 years ago
Madhura Bhave 6381b88736 Create Jwk and Jwt token store beans conditionally
Closes gh-9777
7 years ago
Phillip Webb aa57ca7e18 Polish 7 years ago
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
8 years ago
Stephane Nicoll 58a1ed19a9 Polish 8 years ago
Stephane Nicoll 5aa27beb54 Polish 8 years ago
Stephane Nicoll 90c4e7518b Detect Neo4j https driver url
Closes gh-9549
8 years ago
Johnny Lim 8ca70a7efd Polish
See gh-9570
8 years ago
Madhura Bhave e437c4cd67 OAuth2ClientIdCondition should not match if clientId absent
Fixes gh-9435
8 years ago
Stephane Nicoll 5d69318e2d Add reference to SpringBootApplication in EnableAutoConfiguration
Closes gh-9521
8 years ago
Spring Buildmaster 05d4d0281c Next Development Version 8 years ago
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
8 years ago
Andy Wilkinson 6b7dfce5c6 Formatting 8 years ago
Andy Wilkinson a03ddd331c Polishing 8 years ago
Andy Wilkinson ad629055fa Ensure that custom static resource locations end with /
Closes gh-9360
8 years ago
Phillip Webb b9fd99e268 Polish 8 years ago
Stephane Nicoll f11edd1eb3 Add missing `@Configuration` on `EmbeddedDatabaseConfiguration` 8 years ago
Andy Wilkinson a347383111 Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson bf656c70ad Improve MultipartProperties' javadoc
Closes gh-9073
8 years ago
Stephane Nicoll c736a1698b Clarify default value of `ConditionalOnMissingBean` on bean methods
Closes gh-9387
8 years ago
Stephane Nicoll b8591206d5 Polish 8 years ago
Stephane Nicoll 062dc3cb9a Upgrade to Neo4J OGM 2.1.3
Closes gh-9335
8 years ago
Stephane Nicoll b5709fd618 Polish
See gh-9330
8 years ago
Stephane Nicoll 50876382db Improve Spring Session validation message
Closes gh-9284
8 years ago
Phillip Webb 440d03bf9e Merge branch '1.4.x' into 1.5.x 8 years ago
Phillip Webb 9a4a20537c Polish 8 years ago
Andy Wilkinson fd2ab2fee0 Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson 198093c6a8 Fix violation reported by Checkstyle 8 years ago
Andy Wilkinson 5693acf558 Merge branch '1.4.x' into 1.5.x 8 years ago
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
8 years ago
Andy Wilkinson a2e749940e Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson a3f5cbc4a2 Polishing 8 years ago
Phillip Webb 4a7dcc8786 Formatting 8 years ago
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
8 years ago
Stephane Nicoll ea33cc2f7d Deprecated MustacheCompilerFactoryBean
Closes gh-8999
8 years ago
Stephane Nicoll 5121b848e1 Making sure to stop embedded web servers in tests
Closes gh-9012
8 years ago
Phillip Webb 76ee2f401c Polish 8 years ago
Phillip Webb 4db4c81b9b Polish 8 years ago
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
8 years ago
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.
8 years ago
Stephane Nicoll 3dc9b125d7 Merge branch '1.4.x' into 1.5.x 8 years ago
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.
8 years ago
Spring Buildmaster 9768b0a8c2 Next Development Version 8 years ago
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
8 years ago
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
8 years ago
Spring Buildmaster d719d2cbbc Next Development Version 8 years ago
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
8 years ago
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
8 years ago
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
8 years ago
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
8 years ago
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
8 years ago
Phillip Webb b2ae6b5f50 Merge branch '1.4.x' into 1.5.x 8 years ago
Phillip Webb cdf3eadc95 Rename AbstractTemplateAvailabilityProvider
Rename `AbstractTemplateAvailabilityProvider` to
`PathBasedTemplateAvailabilityProvider`.

Closes gh-8913
8 years ago
Stephane Nicoll e1f727719a Merge branch '1.4.x' into 1.5.x 8 years ago
Stephane Nicoll b7efec5401 Support case insensitive value for Cassandra's SchemaAction
Closes gh-8903
8 years ago
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
8 years ago
Phillip Webb c97268981a Polish 8 years ago
Phillip Webb d301d0f4c3 Merge branch '1.4.x' into 1.5.x 8 years ago