Commit Graph

2526 Commits (9543fcf44d2cbaf9b7fc8962955c515b2cc3d876)

Author SHA1 Message Date
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
Phillip Webb 758ddcd420 Polish 8 years ago
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
8 years ago
Stephane Nicoll a132bd141f Merge branch '1.4.x' into 1.5.x 8 years ago
Stephane Nicoll 0a55e3e736 Polish "Clarify edge case docs on ConditionalOnClass"
Closes gh-8185
8 years ago
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
8 years ago
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
8 years ago
Andy Wilkinson f6a7e17688 Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson 6564fb3d96 Consider all loader paths when checking template availability
Closes gh-8842
8 years ago
Stephane Nicoll 7c9b2afa5b Merge branch '1.4.x' into 1.5.x 8 years ago
Dr. Stefan Hüttemann 0294ad3e95 Allow to disable max http post size limit
Closes gh-8508
8 years ago
Andy Wilkinson c74f0a70ca Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson 5dad7182db Address deprecation warnings 8 years ago
Phillip Webb ad38776de3 Polish 8 years ago
Phillip Webb ddcb5ee328 Polish 8 years ago
Andy Wilkinson 94e9c9417d Merge branch '1.4.x' into 1.5.x 8 years ago
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
8 years ago
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.
8 years ago
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
8 years ago
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
8 years ago
Stephane Nicoll fa3679af71 Merge branch '1.4.x' into 1.5.x 8 years ago
Stephane Nicoll cd76da9a4c Avoid using immutable collections for configuration proprerties
Closes gh-8620
8 years ago
Stephane Nicoll 22934e097d Merge branch '1.4.x' into 1.5.x 8 years ago
Vedran Pavic 17aad4f00c Improve `RedisSessionConfiguration` conditions
Closes gh-8582
8 years ago
Madhura Bhave 8deb72be80 Fix ResourceServerProperties validation
Only try and validate if clientId is present.

Fixes gh-8565
8 years ago
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
8 years ago
Stephane Nicoll f8bf05b91f Polish contribution
Closes gh-8474
8 years ago
srichard 0ddaca57fb Add Tomcat Access Log's fileDateFormat property
Closes gh-8396
8 years ago
Stephane Nicoll feb1ab375f Merge branch '1.4.x' into 1.5.x 8 years ago
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
8 years ago
Stephane Nicoll 6624fe47c3 Merge branch '1.4.x' into 1.5.x 8 years ago
Stephane Nicoll e7922a574a Polish 8 years ago
Stephane Nicoll 207ab3ecb4 Merge branch '1.4.x' into 1.5.x 8 years ago
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
8 years ago
Phillip Webb fedd7b9506 Polish 8 years ago
Phillip Webb a3d5101369 Merge branch '1.4.x' into 1.5.x 8 years ago
Phillip Webb f5aeac3658 Polish 8 years ago
Stephane Nicoll 28bba876fa Merge branch '1.4.x' into 1.5.x 8 years ago
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
8 years ago
Spring Buildmaster d23fa24340 Next Development Version 8 years ago
Spring Buildmaster 2a83e80a9b Next Development Version 8 years ago
Andy Wilkinson 9e9f006720 Polish "Enable customization of RestTemplate that retrieves JwtAccessTokenConverter's key"
See gh-8268
See gh-5859
8 years ago
Eddú Meléndez dc9ff73805 Enable customization of RestTemplate that retrieves JwtAccessTokenConverter's key
Closes gh-8268
See gh-5859
8 years ago
Stephane Nicoll d74af04724 Rename JSR 303 Validator bean name
Closes gh-8481
8 years ago
Stephane Nicoll bb8800a625 Deprecate spring.cache.hazelcast.config
The additional configuration for an `HazelcastInstance` will be removed
in 2.0. This commit makes sure that the property is deprecated in 1.5

See gh-8470
8 years ago
Madhura Bhave 605b0aefc6 Simplify validation logic in ResourceServerProperties
Closes gh-8306
Closes gh-8317
8 years ago
Stephane Nicoll 3e0e4e81b9 Polish 8 years ago
Stephane Nicoll 5cc569fc91 Improve execution speed of `CacheAutoConfigurationTests`
As of Hazelcast 3.7, the bootstrap is pretty slow by default due to the
networking discovery. This commit disables both TCP/IP and multicast
discoveries.
8 years ago
Stephane Nicoll 5278baca01 Polish 8 years ago
Stephane Nicoll 0d61f92479 Ignore URI when local.mongo.port is set
This commit makes sure that if `local.mongo.port` is set, a `MongoClient`
on the embedded MongoDB instance is created. When an embedded instance
is detected, only the `host` property is used and the `uri` is ignored if
set.

This makes sure that the auto-configured `MongoClient` automatically
switches to the embedded server, even if a production uri has been
specified.

Closes gh-8219
8 years ago
Phillip Webb 3ee7dae09b Merge branch '1.4.x' into 1.5.x 8 years ago
Phillip Webb f1012c104a Polish 8 years ago
Phillip Webb 987b6c956e Polish 8 years ago
Phillip Webb 57111aba22 Get published DataSource from EntityManager
Update DataSourceInitializedPublisher to always attempt to obtain the
published DataSource directly from the EntityManager. In the case where
the EntityManager doesn't provide a DataSource, the previous logic is
used.

Fixes gh-8296
8 years ago
Andy Wilkinson 70472b36f1 Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson 59d3a79c82 Avoid eager initialization when finding beans by annotation
Closes gh-8269
8 years ago
Andy Wilkinson 4390c81115 Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson 8a326a8713 Simplify BeanTypeRegistry by requiring a DefaultListableBeanFactory
Closes gh-8439
8 years ago
Phillip Webb ca1540cefe Update header copyright for changed files 8 years ago
Phillip Webb 77f6ed8357 Further rework Spring MVC JSR-303 validation
Rework Spring MVC JSR-303 validation support a little more to move
most of the creation logic to the wrapper class. Also rename
`SpringValidatorAdapterWrapper` -> `WebMvcValidator`.

See gh-8223
8 years ago
Phillip Webb 7ed1a26c2d Fix test failures when running in Eclipse
Update MultipartAutoConfigurationTests to reset the Tomcat URL factory.
8 years ago
Phillip Webb 5867cd6175 Polish 8 years ago
Phillip Webb 47b00c086c Polish 8 years ago
Stephane Nicoll 0435f122d4 Rework JSR-303 validation exposure with Spring MVC
This commit improves the initial solution by actually overriding the
`mvcValidator` `@Bean`. This gives us more control as whether a custom
validator has been specified or not. We now wrap it regardless of it
being custom or provided by auto-configuration.

Closes gh-8223
8 years ago
Stephane Nicoll d8f62c46ad Prevent warning due to BPP dependency
`MethodValidationPostProcessor` requires a `Validator` so we need to flag
it as an infrastructure bean to prevent an additional log that indicates
it won't be post-processed.

We obviously don't want to post-process the `Validator` here so adding the
additional meta-data is a good idea anyway.

Closes gh-8422
8 years ago
Stephane Nicoll 4aa99b9531 Avoid exposing several javax.validaton.Validator beans
This commit makes sure that the Spring `Validator` used by the MVC
layer doesn't expose a JSR-303 contract, if any.

The default implementation of the `mvcValidator` is
`LocalValidatorFactoryBean`. While this object is exposed as a Spring
`Validator` only, its runtime capabilities expose that contract as well
as the standard `Validator` and `ValidatorFactory` ones.

Concretely, if an auto-configuration is checking if a
`javax.validation.Validator` bean is missing, the condition will match
since we only know about "advertized types": beans haven't been created
yet so we can't inspect their runtime capabilities. Since the condition
match, we will auto-configure a bean. At runtime though, we're no longer
ale to inject a `javax.validation.Validator` by type since two candidates
are available.

This commit introduces `SpringValidatorAdapterWrapper`, a wrapper class
on any `SpringValidatorAdapter` (`LocalValidatorFactoryBean` being one of
the available implementations) that only exposes the Spring contract.

Also, if a `javax.validation.Validator` bean is available, we will use it
for the MVC layer, rather than creating a new one.

Closes gh-8223
8 years ago
Andy Wilkinson b034a505a5 Polish 0f42c5dd
- Apply standard code formatting
- Add class javadoc to MultipleResourceServerConfigurationTests
- Add missing @Override annotations
- Remove unused ExpectedException field
- Remove use of SpringApplicationBuilder from the tests
- Use @ImportAutoConfiguration to import auto-configuration
- Add assertions to verify that the orders haven't been changed
- Remove unnecessary mocking of EmbeddedServletContainerFactory

See gh-8347
8 years ago
Dave Syer 0f42c5dd94 Check there is only one ResourceServerConfiguration before modifying
Fixes gh-8347
8 years ago
Madhura Bhave 67810abd9e Match ResourceServerCondition if JWK config present
Closes gh-8350
8 years ago
Stephane Nicoll 43a534f4ca Polish contribution
Closes gh-8195
8 years ago
Mathieu Ouellet fa8f0a6136 Add schema validation options for embedded LDAP
See gh-8195
8 years ago
Stephane Nicoll f57ddff478 Remove dead code
Closes gh-8305
8 years ago
Madhura Bhave b4134e239e Add autoconfiguration for JWKTokenStore
If `jwk.key-set-uri` is present.

Closes gh-4437
8 years ago
Andy Wilkinson 01729cc1d2 Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson 9e1238e286 Consider resource loader path when checking Groovy template availability
Closes gh-8304
8 years ago
Stephane Nicoll a0ef61a27d Enable proxy target class for `MethodValidationPostProcessor`
Closes gh-8277
8 years ago
Andy Wilkinson e0b355d313 Avoid ClassNotFoundException caused by areturn verification
The verifier's type checker is required to check that a type returned
from a method (an areturn instruction) is assignable to the method's
declared return type. When the return type is an interface, the JLS
states that it should be treated as java.lang.Object. This means that
no analysis of the type being returned is required and verification
passes. When the return type is a class, the type being returned must
be analyzed to ensure that it is compatible. This analysis causes the
return type to be loaded during verification.

Prior to this commit, BasicBatchConfigurer's
createAppropriateTransactionManager method had a return type of
AbstractPlatformTransactionManager and a branch that could return
a JpaTransactionManager. This caused the verifier to attempt to load
JpaTransactionManager so that it could check that it was assignable
to AbstractPlatformTransactionManager. This would fail when
spring-orm is not on the classpath as JpaTransactionManager could not
be loaded.

This commit updates BasicBatchConfigurer to change the return type
of createAppropriateTransactionManager so that it returns a
PlatformTransactionManager which is an interface. As described above,
this relaxes the verification of any areturn instructions in the
method and, in this particular case stops the verifier from trying to
load JpaTransactionManager.

Closes gh-8181
8 years ago
Andy Wilkinson 601c6aa305 Tidy up code formatting and address some compiler warnings 8 years ago
Stephane Nicoll aa49468171 Allow to define a custom MessageRecoverer
This commit improves `SimpleRabbitListenerContainerFactoryConfigurer` to
use a custom `MessageConverter`. If such a bean is present, it is used
for the default factory that is auto-configured.

Closes gh-8194
8 years ago
Stephane Nicoll 8a59e88a9d Fix MongoDB CustomConversions bean name
This commit qualifies the `CustomConversions` bean name that the Mongo
auto-configuration might create. `CustomConversions` is a common pattern
in Spring Data and other stores are using the same name.

See https://jira.spring.io/browse/DATASOLR-362

Closes gh-8225
8 years ago
Stephane Nicoll 45a91fca31 Fix parsing of spring.autoconfigure.exclude property
This commits makes sure that `AutoConfigureImportSelector` properly
parses comma separated lists that contain additional spaces.

Closes gh-8220
8 years ago
Andy Wilkinson e891fe0584 Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson 06017f688a Only auto-configure SpringSocialDialect for Thymeleaf 2
Previously, SocialWebAutoConfiguration would create a
SpringSocialDialect bean when SpringTemplateEngine was on the
classpath. This class exists in both Thymeleaf 2 and Thymeleaf 3 but
SpringSocialDialect is only compatible with Thymeleaf 2.

This commit updates the auto-configuration to require
SpringResourceResourceResolver to be on the classpath. This class
exists in Thymeleaf 2 but does not exist in Thymeleaf 3.

Closes gh-4858
8 years ago
Stephane Nicoll 130e0808d0 Merge branch '1.4.x' into 1.5.x 8 years ago
Stephane Nicoll 008aef6142 Document @LiquibaseDataSource feature
Closes gh-8214
8 years ago
Stephane Nicoll e88bda4682 Avoid extra space if condition is empty
Previously, if a builder was created with an empty condition, an extra
space was added before the message. This commit checks for this
particular case and adds a space only when necessary.

Closes gh-8218
8 years ago
Stephane Nicoll 519a03ccda Polish 8 years ago
Johnny Lim 09998d1155 Fix ImportAutoConfigurationImportSelectorTests.determineImportsWhenUsingNonMetaWithClassesShouldBeSame()
Closes gh-8204
8 years ago
Johnny Lim 0adab8a2be Use logical 'and' instead of bitwise 'and'
Closes gh-8198
8 years ago
Johnny Lim 846994e498 Polish
Closes gh-8148
8 years ago
Spring Buildmaster 5c12500366 Next Development Version 8 years ago
Spring Buildmaster a2696bf873 Next Development Version 8 years ago
Phillip Webb fa6a138598 Refine ImportsContextCustomizer cache logic
Update `ImportsContextCustomizer` so that whenever possible a more
specific cache key is used.

Prior to this commit the customizer would generate a key based on *all*
annotations on the test class. This has repeatedly caused issues where
test classes that should have the same cache key did not due to
unrelated annotations.

A new `DeterminableImports` interface has been added that can be
implemented by `ImportSelector` and `ImportBeanDefinitionRegistrar`
implementations that are able to determine their imports early. The
existing `ImportAutoConfigurationImportSelector` and
`AutoConfigurationPackages` classes have been retrofitted with
this interface.

Fixes gh-7953
8 years ago
Andy Wilkinson f34d309548 Formatting 8 years ago
Spring Buildmaster ed1ce140c0 Next Development Version 8 years ago
Andy Wilkinson f5445ba5ff Remove OnValidatorAvailableCondition as it is now redundant
Previously, Hibernate Validator would fail to initialize if it was
on the classpath but an EL implementation was not.
OnValidatorAvailableCondition protected against this scenario by
initializing the validator.

The Hibernate Validator shortcoming was addressed in eb222209
(gh-7598). As a result, checking for the precences of the
ValidationProvider META-INF/services resource is now sufficient to
auto-configure validation. This commit removes
OnValidatorAvailableCondition as it is no longer necessary.

Closes gh-8110
8 years ago
Andy Wilkinson f823599d1f Replace @PostConstruct validation with setter validation
Closes gh-7579
8 years ago
Andy Wilkinson 37cf31f450 Upgrade to Couchbase Java Client 2.3.7
In version 2.3.6 and earlier, an attempt to create a Bucket or a
ClusterInfo would fail fast with a ConnectException in the cause of
the Couchbase server was done. In 2.3.7 this remains true for a
Bucket but is no longer the case for ClusterInfo. The latter now
retries for 75 seconds by default and when it eventually fails a
ConnectException is no longer part of the cause chain.

This commit makes the auto-configured ClusterInfo depend on the
auto-configured Bucket. This means that the Bucket is always created
before the ClusterInfo, thereby ensuring that things fail gracefully
with useful diagnostics when the server is unavailable.

Closes gh-8092
8 years ago
Stephane Nicoll 505e7f75ea Polish contribution
Closes gh-8089
8 years ago
dreis d58f38f6f6 Use String.replace() with single char if possible
See gh-8089
8 years ago
Stephane Nicoll 551bfb2c60 Polish contribution
Closes gh-8103
8 years ago
Johnny Lim 32f9e90de5 Replace 'String.length() == 0' with 'String.isEmpty()'
See gh-8103
8 years ago
Johnny Lim e0de28a1f7 Polish
Closes gh-8076
8 years ago
Phillip Webb b0e06c30a0 Polish 8 years ago
Phillip Webb de50cfa21e Make OnClassCondition an AutoConfigurationImportFilter
Update OnClassCondition to implement AutoConfigurationImportFilter so
that auto-configuration candidates can be filtered early. The
optimization helps to improve application startup time by reducing
the number of classes that are loaded.

See gh-7573
8 years ago
Phillip Webb 20a20b7711 Add AutoConfigurationImportFilter support
Add `AutoConfigurationImportFilter` strategy interface which can be used
to filter auto-configuration candidates before they are loaded.

See gh-7573
8 years ago
Phillip Webb 02641a8207 Optimize AutoConfigurationSorter
Optimize `AutoConfigurationSorter` by used properties generated by the
annotation processor whenever possible. The removes the need for each
candidate class to be ASM parsed just to access the order annotations.

See gh-7573
8 years ago
Phillip Webb 1cbda9bd60 Add AutoConfigurationMetadata abstraction
Add AutoConfigurationMetadata interface and a an internal loader that
allows easy access to data written by `spring-boot-configure-processor`.

See gh-7573
8 years ago
Madhura Bhave ca435512c0 Introduce spring-boot-autoconfigure-processor
Add an annotation processor that generates properties files for certain
auto-configuration class annotations. Currently attribute values from
@AutoConfigureOrder, @AutoConfigureBefore, @AutoConfigureAfter and
@ConditionalOnClass annotations are stored.

The properties file will allow optimizations to be added in the
`spring-boot-autoconfigure` project. Primarily by removing the need
to ASM parse as many `.class` files.

See gh-7573
8 years ago
Phillip Webb ccf964eb9a Optimize OnEnabledResourceChainCondition
Optimize OnEnabledResourceChainCondition by removing the DataBinder.
Properties are now read directly from the Environment.

See gh-7573
8 years ago
Phillip Webb f8ded6de63 Don't use DataBinder to work out excludes
Update `AutoConfigurationImportSelector` so that exclude properties
are loaded without invoking a `DataBinder`. This optimization helps
to improve application startup time.

See gh-7573
8 years ago
Phillip Webb cfd5a73b64 Don't call ReflectionUtils do deduce bean type
Update `OnBeanCondition` to no longer call `ReflectionUtils` when
deducing the bean method return type. Since Spring Framework 4.2
the return type has been directly available from `MethodMetadata`.

See gh-7573
8 years ago
Phillip Webb 996afafac6 Optimize OnClassCondition isPresent check
Update `OnClassCondition` to use its own `isPresent` rather than using
`ClassUtils.isPresent`. Using our own implementation saves a few cycles
since we never need to check for native types, and we don't support
nested class references specified in the non `$` notation.

See gh-7573
8 years ago
Phillip Webb 9650668291 Remove dependency from `root` to `condition`
Remove the slightly unusual dependency from the root autoconfigure
pacakge to `condition`. Prior to this commit the link was required in
ordere to populate the `ConditionEvaluationReport`. We now introduce
a `AutoConfigurationImportListener` strategy that allows anyone to
listen for AutoConfigurationImportEvents. The listener implementation
is now used to update the ConditionEvaluationReport.

Fixes gh-8073
8 years ago
Phillip Webb b225b7f33a Rename EnableAutoConfigurationImportSelector
Rename EnableAutoConfigurationImportSelector to the more general
AutoConfigurationImportSelector since it's now used for more than
just the enable annotation.

The existing EnableAutoConfigurationImportSelector class remains in
a deprecated form so that it can be made package-private again in
Spring Boot 2.0.

Fixes gh-8072
8 years ago
Phillip Webb 2c89d9918f Relocate AutoConfigurations from root package
Move PropertyPlaceholder and MessageSource auto-configuration from the
root package to the `context` subpackage.

Fixes gh-8071
8 years ago
Phillip Webb 5703fb1515 Polish 8 years ago
Andy Wilkinson 9a79d32f4c Polishing 8 years ago
Andy Wilkinson c86b844477 Remove @Component from ResourceServerFilterChainOrderProcessor
Closes gh-8050
8 years ago
Andy Wilkinson a30fe9d9ff Update ServerPropertiesTests to tolerate changes in Tomcat 8.5.11
Closes gh-7360
8 years ago
Stephane Nicoll 915c959a28 Polish contribution
Closes gh-7600
8 years ago
Stephane Nicoll b19d31e067 Use a random port with embedded Mongo by default
This commit improves the logic of the embedded Mongo support to use a
random port if no custom port has been specified. This doesn't change
the default if the embedded support isn't active.

Closes gh-8044
8 years ago
Andy Wilkinson b900a3efc8 Update Actuator endpoints to use custom media type
Previously, the actuator's endpoints produced application/json and,
where appropriate, also consumed application/json. Without a custom,
versioned media type, it's impossible for us to make changes to the
endpoints without breaking clients.

This commit introduces a new media type,
application/spring-boot.actuator.v1+json, that is now produced by
default with application/json also being produced if requested.
Endpoints that consume JSON will now also accept content the uses
the new media type in addition to application/json.

Closes gh-7967
8 years ago
Phillip Webb f3cd0ad22c Polish 8 years ago
Madhura Bhave a5a382b8b1 Set AccessTokenConverter if available
Fixes gh-7091
8 years ago
Stephane Nicoll e5e497ec3a Document `@ImportAutoConfiguration#exclude`
Closes gh-7862
8 years ago
Andy Wilkinson f93d4a0cbf Add explicit aliases for exclude and excludeName on SpringBootApplication
Previously, SpringBootApplication relied on implicity aliasing of
exclude and excludeName that worked because the two attributes have
the same names as the equivalent attributes on
EnableAutoConfiguration.

This commit updates SpringBootApplication to make the aliases explicit
and also adds tests to EnableAutoConfigurationImportSelectorTests to
verify that the aliasing is working as intended.

Closes gh-7951
8 years ago
Stephane Nicoll c41ff17dd7 Provide relevant default values for Enums
This commits adds manual metadata for enums that have a default value
since the annotation processor is not able to detect that yet.

Closes gh-7890
8 years ago
Phillip Webb f42ebe428c Remove JSR-330 configuration annotations
Replace JSR-330 validation annotations from all internal
`@ConfigurationProperties` classes with standard Asserts.

Prior to this commit validation of our own configuration properties
would only occur when the user happens to have compliant JSR-330
implementation on their classpath.

See gh-7579
8 years ago
Phillip Webb 0a6456a748 Always use `prefix` config annotation attribute
Update use of `@ConfigurationProperties` to prefer the more explicit
`prefix` attribute, rather than `value`.

See gh-7579
8 years ago
Phillip Webb 43d432a527 Polish 8 years ago
Kazuki Shimizu 19e117c9cb Use constructor injection in DataSourceInitializer
Closes gh-7973
8 years ago
Kazuki Shimizu bd6ae47d68 Prevent unnecessary debug log message creation
Closes gh-8001
8 years ago
Stephane Nicoll d556e82cf7 Polish contribution
Closes gh-8004
8 years ago
Johnny Lim acc36c076d Polish
See gh-8004
8 years ago
Stephane Nicoll ada441bccc Allow custom override of user info OAuth2RestTemplate
Closes gh-5996
8 years ago
Stephane Nicoll 3e05329fd7 Order internal RepositoryRestConfigurer
This commit provides an order of zero for the RepositoryRestConfigurer
that is used internally to configure the `RepositoryRestConfiguration`. In
practice, an unordered `RepositoryRestConfigurer` will run after ours.

Closes gh-7981
8 years ago
Vedran Pavic 8f6a0e96fd Improve `UserInfoTokenServices` logging
Closes gh-7995
8 years ago
Andy Wilkinson ae3434ba4c Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson d2201d5284 Correct copyright dates and enforce that starting year is 2012
Closes gh-7923
8 years ago
Andy Wilkinson 66915a456a Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson 6f7d1de167 Remove redundant logic from OAuth2MethodSecurityConfiguration
Previously, OAuth2MethodSecurityConfiguration set the
PermissionEvaluator on the expression evaluator by looking in the
context for a PermissionEvaluator bean. This is unnecessary as
GlobalMethodSecurityConfiguration already does the same thing and does
so after the post-processor in OAuth2MethodSecurityConfiguration has
run. This commit removes the redundant logic and adds tests to check
that both the PermissionEvaluator and the RoleHierarchy are set use
beans in the context.

Closes gh-7979
8 years ago
Stephane Nicoll 5ee12a824f Fix assertion
See gh-7962
8 years ago
Andy Wilkinson 65025d8dab Enable Neo4J's open in view interceptor by default
Closes gh-7943
8 years ago
Stephane Nicoll 4523927e28 Polish 8 years ago
Phillip Webb 10de30ff11 Polish LDAP contribution
See gh-7733
8 years ago
Eddú Meléndez 6a84c369fd Add LDAP auto-configuration support
Add auto-configuration support for spring-ldap and spring-data-ldap.

See gh-2645
See gh-7733
8 years ago
Phillip Webb 565f75438e Polish 8 years ago
Dave Syer fe344df9c5 Change default order of OAuth2 resource server filter chain
The default is now SecurityProperties.ACCESS_OVERRIDE_ORDER-1
(instead of 3), and the user can set it with
security.oauth2.resource.filter-order (as opposed to being hard
coded). The filter is provided by Spring OAuth2 so this change is
a BeanPostProcessor to call a setter on that object.

Fixes gh-5072
8 years ago
Phillip Webb eb22220961 Upgrade to hibernate-validator 5.3.4
Upgrade to `hibernate-validator` 5.3.4 and introduce a new
`MessageInterpolatorFactory` that creates a suitable
`MessageInterpolator` (taking into account missing EL dependencies).

Rework `ConfigurationPropertiesBindingPostProcessor` and
`ValidationAutoConfiguration` to make use of the new factory.

Fixes gh-7598
8 years ago
Stephane Nicoll 0a26a4146b Make `spring.session.store-type` mandatory
This commit removes the automatic enabling of Redis as the Spring Session
store when it is available. This case is covered by a warning in `1.4.x`
that this commit removes as well.

Closes gh-7858
8 years ago
Stephane Nicoll bf7271afa5 Upgrade to Couchbase Cache Client 2.1.0
As of 2.1 cache expiration times are to be set in seconds. This commit
migrates to the new method, yet keeping the milliseconds unit.

Closes gh-7824
8 years ago
Johnny Lim f915ae197a Polish 8 years ago
Phillip Webb 76d5b913cd Polish 8 years ago
Stephane Nicoll fe89af5e82 Polish contribution
Closes gh-7796
8 years ago
Eddú Meléndez 24c83d12da Autodetect spring.jpa.database from spring.datasource.url
Previously, property `spring.jpa.database` should be provided. This
commit allows to detect the database when `spring.datasource.url` is
provided.

Closes gh-7708
8 years ago
Phillip Webb b27f4e23be Ignore @ImportAutoConfiguration exclude errors
Update `ImportAutoConfigurationImportSelector` to ignore excludes for
classes that aren't loaded. Since the import classes for tests tend to
be much more limited, the exception isn't really helpful.

Closes gh-6809
8 years ago
Phillip Webb aacf5d660f Update copyright year for changed files 8 years ago
Phillip Webb 273beaa3ce Polish 8 years ago
Phillip Webb f8acaae115 Merge branch '1.4.x' into 1.5.x 8 years ago
Phillip Webb 9ccf47398e Formatting 8 years ago
Kazuki Shimizu 85503fcbca Polishing log message and comment
Closes gh-7793
8 years ago
Stephane Nicoll a90a73d1ac Merge branch '1.4.x' into 1.5.x 8 years ago
Stephane Nicoll 7b494cf319 Polish
See gh-7793
8 years ago
Stephane Nicoll c230a21a8c Polish CacheManagerCustomizers
Closes gh-7792
8 years ago
Stephane Nicoll 2f3571f173 Defend against lambda transaction customizers
Update `CacheManagerCustomizers` to deal directly with
`ClassCastException` assuming that they are because a customizer is
implemented using a lambda.

Closes gh-7788
8 years ago
Stephane Nicoll 1fa8b1ac91 Defend against lambda transaction customizers
Update `CacheManagerCustomizers` to deal directly with
`ClassCastException` assuming that they are because a customizer is
implemented using a lambda.

Closes gh-7788
8 years ago
Phillip Webb 54aeff47a2 Add exclude support to @ImportAutoConfiguration
Update `@ImportAutoConfiguration` with support for an exclude attribute
that works in a similar way to `@EnableAutoConfiguration`.

Also update existing `@Test...` annotation with exclude attribute
aliases.

Fixes gh-6809
8 years ago
Phillip Webb 3c930347c5 Defend against lambda transaction customizers
Update `TransactionManagerCustomizers` to deal directly with
`ClassCastExceptions` assuming that they are because a customizer is
implemented using a lambda.

See gh-7561
8 years ago
Kazuki Shimizu a7b77e6f9a Remove a nested TransactionProperties
Remove a few nested `TransactionProperties` that should have been
deleted in commit f22744c748.

See gh-7561
Closes gh-7786
8 years ago
Stephane Nicoll 7c25ccb0f3 Merge branch '1.4.x' into 1.5.x 8 years ago
Stephane Nicoll 1f5970c537 Fix auto-configuration class reference
Closes gh-7781
8 years ago
Stephane Nicoll 301b8bc611 Make the dependency to TransactionAutoConfiguration explicit
Closes gh-7773
8 years ago
Stephane Nicoll 4b641ca211 Polish
Closes gh-7561
8 years ago
Phillip Webb f22744c748 Add support for TransactionManagerCustomizers
Add a `TransactionManagerCustomizer` callback interface that can be
used to customize auto-configured `PlatformTransactionManagers`.

Also update `...transaction.*` properties under a single unified
`spring.transaction...` key since the existing auto-configurations
would often share a transaction manager (the technology specific
transaction managers are `@ConditionalOnMissingBean` and may use
a manager created by a previous auto-configuration).

See gh-7561
8 years ago
Phillip Webb 601f7c0a69 Polish 8 years ago
Phillip Webb 8b69856fc9 Polish 8 years ago
Phillip Webb 3af5ae2a26 Polish `ObjectProvider` names
Consistently use the simple name for ObjectProvider parameter and
field names. For example:

  `ObjectProvider<Something> something`

rather than

  `ObjectProvider<Something> somethingProvider`
8 years ago
Phillip Webb e0541d0f74 Polish 8 years ago
Stephane Nicoll b24c8d04ba Allow to customize the auto-configured JestClient
This commit adds a `HttpClientConfigBuilderCustomizer` to further tune
the auto-configured `JestClient`.

Closes gh-7762
8 years ago
Stephane Nicoll a60e356136 Enable Jest's multi-threaded support by default
Since the `JestClient` is auto-configured as a bean, it must have its
multi-threaded support enabled by default. This commit exposes a new
`spring.elasticsearch.jest.multi-threaded` property that is `true` by
default.

Closes gh-6806
8 years ago
Phillip Webb d05357e036 Migrate to Tomcat WebSocket client
Move samples and tests from Jetty websocket client to Tomcat since the
upcoming Jetty release contains a bug in `JsrSession`
(https://github.com/eclipse/jetty.project/issues/1202).

See gh-7599
8 years ago