Commit Graph

3116 Commits (258c442e9a5219bd4f57aab50233c600e1936fb3)

Author SHA1 Message Date
Andy Wilkinson 8df852bf71 Change default order of AutoConfigureOrder to 0
Previously, AutoConfigureOrder defaulted to Ordered.LOWEST_PRECEDENCE.
This made is impossible for an individual auto-configuration to
indicate that it wanted to go "last", i.e. after any
auto-configuration classes that didn't not specify an order, or
specified an order other than LOWEST_PRECEDENCE.

This commit changes to default to 0, allowing a single
 auto-configuration to easily indicate that it should go last.

 Closes gh-10142
7 years ago
Phillip Webb 80f023f996 Polish 7 years ago
Andy Wilkinson 7fc12bc8a3 Polish 7 years ago
Stephane Nicoll afda0ec129 Default Hibernate DDL auto to none with Flyway/Liquibase
This commit adds a strategy interface to specific if a given DataSource
has its schema managed. The Hibernate auto-configuration uses it to set
it to "none" if a mechanism to initialize the DataSource is
found and "create-drop" otherwise.

Both Flyway and Liquibase implements that strategy interface and
register it in the context accordingly.

Closes gh-9262
7 years ago
Johnny Lim db76112700 Polish
See gh-10109
7 years ago
Phillip Webb 2c97d3a5e9 Polish 7 years ago
Madhura Bhave 64ffcfc83f Document JWK property
Closes gh-10022
7 years ago
Stephane Nicoll 26b93e9454 Polish
See gh-10084
7 years ago
Stephane Nicoll 1897d76cda Merge branch '1.5.x' 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
Johnny Lim 118f65556f Remove unused ExpectedExceptions
Closes gh-10101
7 years ago
Stephane Nicoll f52003f9ed Merge branch '1.5.x' 7 years ago
Madhura Bhave d03b8e14f1 Fix Windows test failures 7 years ago
Madhura Bhave 919dfd3f90 Remove unused properties and constants
Since the autoconfig totally backs off in the presence
of a WebSecurityConfigurerAdapter, there is no need to
order them ahead of/after the one provided by Spring Boot.

See gh-7958
7 years ago
Stephane Nicoll f6134a8862 Polish 7 years ago
Madhura Bhave 9b5e5f32e1 ClientId not always required for client credentials
Fixes gh-10013
7 years ago
Madhura Bhave e08ddbf838 Rework security autoconfiguration
This commit combines security autoconfigurations for
management endpoints and the rest of the application. By default,
if Spring Security is on the classpath, it turns on @EnableWebSecurity.
In the presence of another WebSecurityConfigurerAdapter this backs off
completely. A default AuthenticationManager is also provided with a user
and generated password. This can be turned off by specifying a bean of
type AuthenticationManager, AuthenticationProvider or UserDetailsService.

Closes gh-7958
7 years ago
Stephane Nicoll 77edebe094 Polish
Closes gh-10076
7 years ago
Stephane Nicoll 0d7cde7a5d Add deprecated metadata for Neo4j
See gh-10076
7 years ago
Stephane Nicoll 8a12a6ce36 Add deprecated metadata for Thymeleaf
See gh-10076
7 years ago
Stephane Nicoll 64231eaa9e Add deprecated metadata for Sendgrid
See gh-10076
7 years ago
Stephane Nicoll b57e66fbe5 Add deprecated metadata for Redis pool
See gh-10076
7 years ago
Stephane Nicoll b2950b568c Add deprecated metadata for datasource initialization
See gh-10076
7 years ago
Stephane Nicoll b574e5c1e6 Add deprecated metadata for Hibernate
See gh-10076
7 years ago
Stephane Nicoll dde652781e Add deprecated metadata for multipart
See gh-10076
7 years ago
Stephane Nicoll 1fefe24de8 Add deprecated metadata for server-related properties
See gh-10076
7 years ago
Stephane Nicoll 88656b31c9 Add deprecated metadata for Liquibase
See gh-10076
7 years ago
Stephane Nicoll e5c5fe9fc5 Add deprecated metadata for Flyway
See gh-10076
7 years ago
Stephane Nicoll 0a7a4c60aa Remove deprecated `error.path` property 7 years ago
Stephane Nicoll 4dc5022203 Polish 7 years ago
Stephane Nicoll f8e08f79ed Add DispatcherType enum for configuration purpose
This commit creates our own version of javax.servlet.DispatcherType for
configuration purpose as we can use the other one now the servlet api
is optional.

Closes gh-9856
7 years ago
Stephane Nicoll 8383648a14 Revert "Expose SpringBootCondition's logger"
Closes gh-10000
7 years ago
Johnny Lim 14c9f91aab Polish
Closes gh-10054
7 years ago
Stephane Nicoll 394371eb73 Polish "Harmonize database initializers"
Closes gh-9752
7 years ago
Vedran Pavic 14b7be8325 Harmonize database initializers
This commit updates database initializers configuration to enable them
automatically only when an embedded `DataSource` is used. Related
configuration properties have been updated to use a more expressive
`DatabaseInitializerMode` enum rather than `Boolean` flag.

See gh-9752
7 years ago
Stephane Nicoll 29078c78f2 Merge branch '1.5.x' 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 30014785a4 Merge branch '1.5.x' 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
Stephane Nicoll fa85308ab9 Polish "Expose SpringBootCondition's logger"
Closes gh-10000
7 years ago
Oleg Zhurakousky 58826644d1 Expose SpringBootCondition's logger
See gh-10000
7 years ago
Andy Wilkinson fcec8a9b0b Merge branch '1.5.x' 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
Andy Wilkinson abf39915e8 Polish 7 years ago
Andy Wilkinson 5c06bd5ab9 Merge branch '1.5.x' 7 years ago
Johnny Lim 56f47e1a50 Polish
Closes gh-9938
7 years ago
Andy Wilkinson 7bd285dd93 Polish 7 years ago
Madhura Bhave ea087b9bac Move liquibase config properties to spring.liquibase
Closes gh-9897
7 years ago
Madhura Bhave f9e316306a Move Flyway config properties to spring.flyway
Closes gh-9896
7 years ago
Andy Wilkinson 7cc4410613 Merge branch '1.5.x' 7 years ago
Gytis Trikleris f43ad00129 Delay Narayana recovery manager until it's started explicitly
Closes gh-9641
7 years ago
Phillip Webb fd1dfbb247 Add missing TestPropertyValues 'apply' calls
Update a few usages of `TestPropertyValues` so that `apply` is called
consistently.
7 years ago
Phillip Webb e1602fe59a Polish 7 years ago
Eddú Meléndez 87ba8d2e14 Upgrade to Jackson 2.9.0
Closes gh-9912
7 years ago
Phillip Webb 30ff329e3d Polish 7 years ago
Stephane Nicoll ebbe29cc85 Migrate HazelcastJpaDependencyAutoConfigurationTests to context runner
This commit also makes sure to generate unique embedded data source and
disable datasource initialization as this is not required by those
tests.

See gh-9889
7 years ago
Stephane Nicoll 49d249bdf4 Disable Aop auto-config if aspectjweaver is not present
This commit adds an additional class check to AopAutoConfiguration as
it is main role is to configure `@EnableAspectJAutoProxy` which won't
work properly if `aspectjweaver` is not present.

Closes gh-9880
7 years ago
Phillip Webb 9127c48fb5 Fixup warnings 7 years ago
Phillip Webb a869d25dbb Polish 7 years ago
Stephane Nicoll 22deceb7f2 Migrate tests to ApplicationContextRunner 7 years ago
Andy Wilkinson 56b817e8ad Merge branch '1.5.x' 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
Phillip Webb 89ad0660d1 Make ApplicationContextRunner immutable
Update `ApplicationContextRunner` so that it is totally immutable.
Methods now return new instances rather than changing existing state.

See gh-9875
7 years ago
Phillip Webb ad9f28110c Make TestPropertyValues immutable
Update `TestPropertyValues` so that it is totally immutable. Methods
now return a new instance rather than changing existing state.

See gh-9875
7 years ago
Phillip Webb 07556cda51 Restructure `boot.test.context` package
Split up `org.springframework.boot.test.context` into distinct packages
for `runner` and `assertj`.

See gh-9875
7 years ago
Phillip Webb 497457c397 Rename ApplicationContextTester -> Runner
Rename `ApplicationContextTester` and related classes to
`ApplicationContextRunner` and refactor existing tests to use correctly
named variables.

See gh-9875
7 years ago
Andy Wilkinson 5616915621 Polishing 7 years ago
Stephane Nicoll 9891462ac4 Migrate test to WebApplicationContextTester 7 years ago
Spring Buildmaster 41c5c0e7c9 Next development version 7 years ago
Stephane Nicoll 996e6bf48c Reset Neo4j tests to use the default driver again
This commit resets the artificial use of the http driver now the bolt
driver doesn't check if the connection to the Neo4J server is valid
on startup.

See neo4j/neo4j-java-driver#380

Closes gh-9500
7 years ago
Andy Wilkinson 02e836b7a7 Allow Session's repository filter to be configured via the environment
Closes gh-8301
7 years ago
Emanuel Campolo 2626a3a795 Use lambdas when possible
Replace anonymous inner classes with lambda declarations (when possible
using method references).

See gh-9781
7 years ago
Emanuel Campolo 798fe5ed53 Collapse catch clauses
Use multi-catch for exceptions whenever possible.

See gh-9781
7 years ago
Emanuel Campolo 4a189bdee7 Replace Collections.sort() with direct sort call
Replace existing `Collections.sort(...)` calls with `.sort(...)`
directly on the collection instance.

See gh-9781
7 years ago
Emanuel Campolo 04fdec6f8b Replace explicit generics with diamond operator
Where possible, explicit generic declarations to use the Java 8 diamond
operator.

See gh-9781
7 years ago
Stephane Nicoll ab43bf4643 Polish 7 years ago
Stephane Nicoll 663ff05895 Polish "Allow to customize OkHttpClient.Builder"
Closes gh-9669
7 years ago
Eddú Meléndez 406f41740e Allow to customize OkHttpClient.Builder
This commit enables to auto-configure OkHttpClient.Builder in
InfluxDbAutoConfiguration if it is available.

See gh-9669
7 years ago
Phillip Webb 3a01f4a6da Polish lambda formatting 7 years ago
Phillip Webb 7b2b8dc4a3 Merge branch '1.5.x' 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 5516e8626c Merge branch '1.5.x' 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 6c21b0090b Merge branch '1.5.x' 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 9c59758abe Merge branch '1.5.x' 7 years ago
Andy Wilkinson d4ecda9030 Work around javac bug (internal review ID 9050163) 7 years ago
Andy Wilkinson c45a351308 Merge branch '1.5.x' 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 11fc7c1393 Merge branch '1.5.x' 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
Johnny Lim bd27d147d7 Polish
Closes gh-9827
7 years ago
Andy Wilkinson 18cfd9d3dd Merge branch '1.5.x' 7 years ago
Andy Wilkinson c70cc55db8 Polishing
See gh-9827
7 years ago
Andy Wilkinson 536c3bbd1c Merge branch '1.5.x' 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 1fe84225e5 Merge branch '1.5.x' 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 e1ef2a591f Fixup tests to use new ApplicationContextTester
Update existing tests that previously use `ContextLoader` to the newly
introduced `*ApplicationContextTester` classes.

See gh-9634
7 years ago
Phillip Webb 2f0f25f5ad Add Configurations class
Add a general purpose `Configurations` class that encapsulates the
sorting and merging rules that are usually apply. The class is
particularly useful in tests where configuration classes often need
to be specified, but an `@Import` or `ImportSelector` cannot be easily
used.

Two `Configurations` subclasses have been initially added. The
`UserConfigurations` class can be used to represent user defined
configuration and the `AutoConfigurations` class can be used to
represent a subset of auto-configurations. Auto configurations are
sorted using the same `@AutoConfiguraionBefore`/`@AutoConfiguraionAfter`
logic as the `@EnableAutoConfiguration` annotation.

Fixes gh-9795
7 years ago
Phillip Webb 9db72450da Merge branch '1.5.x' 7 years ago
Phillip Webb 68910f2b8f Polish 7 years ago
Stephane Nicoll 38ad582959 Polish "Add support for arbitrary producer/consumer Kafka properties"
Closes gh-9775
7 years ago
Gary Russell 191752d2c0 Add support for arbitrary producer/consumer Kafka properties
PR #7672 Added support for arbitrary common properties.

However, Kafka emits a warning if a producer configuration contains
properties intended only for consumers, and vice versa.

The documentation showed a sample of how to write code to configure
arbitrary properties but this is inconvenient.

Add arbitrary properties to the consumer and procucer configs.

See gh-9775
7 years ago
Stephane Nicoll d9f2770006 Merge branch '1.5.x' 7 years ago
Stephane Nicoll 7e97d38de7 Polish Javadoc
Closes gh-9726
7 years ago
Phillip Webb 75aebfaf27 Fix WebClientAutoConfigurationTests
Update tests to return a mock response rather than Mono.empty().
7 years ago
Stephane Nicoll e56798f347 Align to API change of Spring Data Cassandra 7 years ago
Madhura Bhave 39ec335d41 Merge branch '1.5.x' 7 years ago
Madhura Bhave 6381b88736 Create Jwk and Jwt token store beans conditionally
Closes gh-9777
7 years ago
Phillip Webb 51c2b049c2 Fix CodecsAutoConfiguration following API change
Update CodecsAutoConfiguration to align with the latest Spring Framework
changes.
7 years ago
Phillip Webb c1101e7eb2 Formatting 7 years ago
Stephane Nicoll 9df0992bd9 Polish "Align with breaking API changes in RedisCacheManager"
Closes gh-9734
7 years ago
Mark Paluch d22cd0cc9e Align with breaking API changes in RedisCacheManager
See gh-9734
7 years ago
Johnny Lim 360e3a492c Polish
closes gh-9729
7 years ago
Phillip Webb 8e3baf3130 Polish 7 years ago
Stephane Nicoll cb13c98649 Polish 7 years ago
Stephane Nicoll fa71051ec6 Polish "Upgrade to Infinispan 9.0.3.Final"
Closes gh-9688
7 years ago
Stephane Nicoll ef5c2afcc9 Polish 7 years ago
Andy Wilkinson dd0ce54425 Improve the type-safety of ContextLoader for servlet and reactive web 7 years ago
Andy Wilkinson 19ddfad63e Migrate some more tests to the new ContextLoader 7 years ago
Phillip Webb eb17aa06f9 Merge branch '1.5.x' 7 years ago
Phillip Webb aa57ca7e18 Polish 7 years ago
Andy Wilkinson b11053afc4 Align with breaking API changes in Spring Data MongoDB 7 years ago
Brian Clozel 64777204d8 Apply codecs auto-configuration to WebFlux
This commit introduces `CodecCustomizer`, a new callback-based interface
for customizing the codecs configuration for WebFlux server and client.

Instances of those customizers are applied to the `WebClient.Builder`
and to the `WebFluxAutoConfiguration` (which deals with both WebFlux and
WebFlux.fn).

For now, only Jackson codecs are auto-configured, by getting the
`ObjectMapper` instance created by Spring Boot. Other codecs can be
configured as soon as WebFlux supports those.

Closes gh-9166
7 years ago
Brian Clozel 4ce726b1a0 Auto-configure WebClient.Builder
This commit adds a new customizer interface for applying
configuration changes to `WebClient.Builder` beans:
`WebClientCustomizer`.

The new WebClient auto-configuration will make available, as a
prototype scoped bean, `WebClient.Builder` instances.
Once injected, developers can use those to create `WebClient`
instances to be used in their application.

`WebClientCustomizer` beans are sorted according to their
`Order` and then applied to the builder instances.

Closes gh-9522
7 years ago
Stephane Nicoll 18ba414000 Add test helper to manipulate the ApplicationContext
This commit adds ContextLoader, a test helper that configures an
ApplicationContext that is meant to simulate a particular
auto-configuration scenario.

The auto-configuration, user configuration and environment can be
customized. The loader invokes a ContextConsumer to assert the context
and automatically close the context once it is done.

Concretely, tests can create a shared field instance of that helper with
the shared configuration to increase its visibility and tune the context
further in each test.

If the context is expected to fail, `loadAndFail` allows to optionally
assert the root exception and consume it for further assertions.

This commit also migrates some tests to illustrate the practical use of
the helper

Closes gh-9634
7 years ago
Stephane Nicoll 2892039ccd Better tests for datasource initialization
See gh-9528
7 years ago
Stephane Nicoll 4e19c47e78 Fix wrong assertion 7 years ago
Stephane Nicoll 1ba0df99b2 Polish 7 years ago
Stephane Nicoll 557361c9e0 Properly set redis password for Cluster and Sentinel config
Closes gh-9583
7 years ago
Stephane Nicoll 1a839d6656 Remove useless cluster check 7 years ago
Stephane Nicoll 1b181b2f34 Upgrade to Tomcat 8.5.16
This commit uses the replacement for deprecated APIs in 8.5.16 to ease
a forward compatibility with Tomcat 9

Closes gh-9611
7 years ago
Johnny Lim 533c418ad4 Polish
Closes gh-9610
8 years ago
Andy Wilkinson 5a4ef50ef1 Adapt to API changes in Spring Data Commons 8 years ago
Stephane Nicoll c99a222759 Merge branch '1.5.x' 8 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 8ea38d1cbe Merge branch '1.5.x' 8 years ago
Stephane Nicoll 58a1ed19a9 Polish 8 years ago
Stephane Nicoll b465d9d815 Remove dead code 8 years ago
Stephane Nicoll e418cad752 Merge branch '1.5.x' 8 years ago
Stephane Nicoll 5aa27beb54 Polish 8 years ago
Stephane Nicoll 90c4e7518b Detect Neo4j https driver url
Closes gh-9549
8 years ago