Commit Graph

2014 Commits (0b288446811f6bdfaa75c240f0ec265debe9dd3d)

Author SHA1 Message Date
Andy Wilkinson a4d7a77547 Apply spring.thymeleaf.cache to auto-configured ThymeleafViewResolver
Previously, spring.thymeleaf.cache was only applied to auto-configured
TemplateResolver. This commit also applies the propery to the
auto-configured ThymeleafViewResolver.

Closes gh-5395
9 years ago
Johnny Lim 6d48ee9593 Polish
Closes gh-5714
9 years ago
Phillip Webb 5881c9c74f Polish 9 years ago
Stephane Nicoll f561d9d9d8 Polish auto-configuration for Spring Web Services
Closes gh-5645
9 years ago
Vedran Pavic a7b3a913c2 Add auto-configuration for Spring Web Services
Closes gh-1045
9 years ago
oEmbedler Inc af39d558ff Fix potential NPE in RedisAutoConfiguration
Closes gh-5667
9 years ago
Phillip Webb 6eeda76af7 Merge branch '1.3.x' 9 years ago
Sergey Pauk 8542f4f481 Make UserInfoTokenServices.getPrincipal protected
Update UserInfoTokenServices.getPrincipal() so that it can be overridden
by subclasses to allow a custom authenticated principal to be returned
from the authorized request parameters.

Fixes gh-5053
9 years ago
Phillip Webb c79ecc29c6 Polish 9 years ago
Phillip Webb 7956e68224 Fix warnings 9 years ago
Venil Noronha 1def64e49e Add Jetty `acceptors` and `selectors` support
Add support for Jetty `acceptors` and `selectors` configuration, either
directly on the `JettyEmbeddedServletContainerFactory` or via
`server.jetty.acceptors`/`server.jetty.selectors` server properties.

Fixes gh-5380
Closes gh-5649
9 years ago
Phillip Webb 2d992c1324 Polish 9 years ago
Stephane Nicoll 99ae6dac53 Customize Couchbase's socket connect timeout
Our Windows build is failing currently because the couchbase server does
not handle a socket connection within a second (the default). This commit
adds a property to customize this option and set it to 10 sec in the
sample.

While investigating this issue, it turns out that while
`CouchbaseConfiguration` is public, it is not really possible to extend
it in user's configuration. This commit fixes this problem and add a test
that demonstrates how it can be used.

Closes gh-5657
9 years ago
Stephane Nicoll c38bb9657d Polish 9 years ago
Anand Shah 4d667970c4 Remove SolrAutoConfiguration @PreDestroy
Remove @PreDestroy from SolrAutoConfiguration since the container will
call the close method anyway.

Fixes gh-5333
Closes gh-5339
9 years ago
Phillip Webb 58417ebca5 Delete accidentally committed file
Remove accidentally committed SizeThreshold class.
9 years ago
Phillip Webb ea44ae6a35 Polish contribution 9 years ago
Venil Noronha 6d2f88ed9b Support max-http-header-size & max-http-post-size
Add `server.max-http-header-size` and `server.max-http-post-size`
properties and deprecate `server.tomcat.max-http-header-size`.

Fixes gh-5637
Closes gh-5641
9 years ago
Stephane Nicoll 3d9ac6ea57 Polish 9 years ago
Phillip Webb 2861c7651d Polish 9 years ago
Phillip Webb 0c0be1e626 Polish contribution 9 years ago
Venil Noronha d0ccea1b26 Support ActiveMQ trusted packages
Ass support for white-listing specific packages or trusting all packages
when using ActiveMQ.

Fixes gh-5631
Closes gh-5644
9 years ago
Phillip Webb ae249f7568 Merge branch '1.3.x' 9 years ago
Phillip Webb d7e56abdf3 Don't apply `null` ServerProperties from customize
Update ServerProperties so that `null` values are not applied when
customizing the EmbeddedServletContainerFactory. Primarily changed to
stop `server.undertow.accesslog.enabled` from being blindly applied.

Fixes gh-5515
9 years ago
Phillip Webb 2364bcc117 Polish 9 years ago
Stephane Nicoll fbe53be6c1 Polish Hibernate 5 support
Closes gh-2763
9 years ago
Stephane Nicoll 4e4ea4b51f Polish 9 years ago
Phillip Webb 6550bb4cf1 Polish 9 years ago
Andy Wilkinson 436da1d5fd Polish contribution 9 years ago
Yogesh Lonkar dc8685a927 Allow embedded Mongo's storage to be configured via the environment
Closes gh-5617
9 years ago
Johnny Lim 3b5ecbd066 Polish
Closes gh-5627
9 years ago
Andy Wilkinson e5a253e689 Improve diagnostics when OnBeanCondition type deduction fails
When @ConditionalOnBean or @ConditionalOnMissingBean are used on a
@Bean method, they will, in the absence of any other configuration,
attempt to deduce the bean's type by examining the method's return
type. This deduction can fail. See gh-4841, gh-4934, and gh-5624
for some examples of possible failure causes. Previously, this
failure was only logged as a debug message leaving the user with a
misleading message suggesting that the @ConditionalOnBean or
@ConditionalOnMissingBean annotation was not configured correctly.

This commit improves the diagnostics by mention the possibility of
type deduction in the exception message and including the exception
that caused deduction to fail as the cause.

Closes gh-4934
9 years ago
Dave Syer 9b121dcbaa Make MustacheViewResolver extend AbstractTemplateViewResolver
The Mustache support should still be usable outside a web application
because the properties only use web stuff in that context and don't
have any field or method signatures that depend on web.

Fixes gh-5626
9 years ago
Phillip Webb 9f1466c9a3 Refine Narayana log directory logic
Refine the log directory logic used by Narayana so that it is consistent
with Atomikos and Bitronix.

See gh-5552
9 years ago
Phillip Webb 48800f1818 Polish contribution 9 years ago
Gytis Trikleris a2adc5a130 Add Narayana JTA support
Add support for JBoss Narayana.

Fixes gh-5552
9 years ago
Phillip Webb 01c9d72644 Polish 9 years ago
Johnny Lim a55315b5b5 Polish
Closes gh-5614
9 years ago
Mohamed Gazal 3623eeda0c Add Liquibase rollback file support
Add a `liquibase.rollback-file` property which can be used to write
a rollback file when migrations occur.

Fixes gh-1826
Closes gh-5535
9 years ago
Phillip Webb 0db1194007 Upgrade to Hibernate 5.1
Upgrade to Hibernate 5.1, whilst still retaining compatibility with
Hibernate 4.3. This commit introduces the following changes:

* Add SpringPhysicalNamingStrategy to provides lowercase/underscore
  table names support. This should be equivalent to the previous
  SpringNamingStrategy that was used with Hibernate 4. No
  ImplicitNamingStrategy is provided since the Hibernate 5 defaults
  appear to be roughly equivalent to the conventions used in Spring
  Boot 1.3
  spring.jpa.hibernate.naming.

* Migrate  `spring.jpa.hibernate.naming-strategy` to
  `spring.jpa.hibernate.naming.strategy` and provide additional
  properties for physical and implicit.

* Add `spring.jpa.hibernate.use-new-id-generator-mappings` property and
  default to `false` when on Hibernate 5 to retain back compatibility.

See gh-2763
9 years ago
Andy Wilkinson d27e280759 Merge branch '1.3.x' 9 years ago
Stephane Nicoll 520448cd9c Add support for publisher confirms/returns
Closes gh-3945
9 years ago
Andy Wilkinson ffe21175ca Upgrade to Logback 1.1.7
Closes gh-5568
9 years ago
Stephane Nicoll 05ef0818f8 Polish contribution
Closes gh-5511
9 years ago
Huang YunKun 6a2ff3f02a Upgrade elasticsearch to 2.2.0
Closes gh-5443
9 years ago
Andy Wilkinson 487f7310fd Polish contribution 9 years ago
Quinten De Swaef 34eb3695e4 Allow Tomcat's minimum threads to be configured via the environment
Closes gh-5572
9 years ago
Phillip Webb b398b3319c Rename @SpringApplicationTest -> @SpringBootTest
Rename @SpringApplicationTest to SpringBootTest and
@SpringApplicationContextLoader to @SpringBootContextLoader.

Fixes gh-5562
9 years ago
Phillip Webb 4d404b214c Migrate away from @SpringApplicationConfiguration
Refactor internal tests to no longer use @SpringApplicationConfiguration

See gh-5562
9 years ago
Phillip Webb adb42ed966 Polish 9 years ago
Andy Wilkinson 15cbef3df0 Update JpaBaseConfiguration to use constructor injection
This change was missed as part of the work done in 19d8c5e6.

See gh-5306
Closes gh-5543
9 years ago
Andy Wilkinson 611d441763 Polishing 9 years ago
Dave Syer 416ce1a6f4 Make FixedAuthoritiesExtractor more liberal in what it accepts
In particular it now accepts a list of maps containing
"authority" keys (which is what you get from a standard JSON
decoding of a Spring Security Authentication).

Fixes gh-5482
9 years ago
Andy Wilkinson f55066464d Merge branch '1.3.x' 9 years ago
Andy Wilkinson 33f0ea3480 Rework SpringApplicationTest to support web modes
Rework the new testing support so that @SpringApplicationTest can be
used for standard integration tests, web integration tests with a
mock Servlet environment and web integration tests with an embedded
servlet container. This means that it a replacement for 1.3's
@IntegrationTest and @WebIntegrationTest and allows all
SpringApplication testing to be configured using a common annotation.

The old @IntegrationTest and @WebIntegrationTest along with their
supporting classes have been reinstated to their previous form (while
remaining deprecated). This should ensure that they continue to work
in 1.4 exactly as they did in 1.3 giving users a smooth path to
@SpringApplicationTest.

See gh-5477
9 years ago
Phillip Webb 893a6c32f3 Upgrade to checkstyle 6.17
Fixes gh-5547
9 years ago
Johnny Lim a28dd9d9e6 Polish
Closes gh-5532
9 years ago
Phillip Webb 39140945b5 Polish 9 years ago
Stephane Nicoll 6dd84159f5 Restore JMX property to IntegrationJmxConfiguration
Closes gh-5309
9 years ago
Stephane Nicoll 54bea72554 Polish Jersey integration tests 9 years ago
Stephane Nicoll c752fac5c0 Expose load-on-startup for Jersey
This commit adds a `spring.jersey.filter.load-on-startup` property used to
customize the startup priority of the Jersey servlet.

Closes gh-5100
9 years ago
Stephane Nicoll 33967927db Polish contribution
Closes gh-5512
9 years ago
Rob Baily 971a7194d8 Add check for non empty list of factories
It was seeen that if a different plugin was used to package Spring Boot
that the project would load but no autoconfiguration actually took
place and many features were mysteriously not working.  Adding a check
to ensure that some factories are always loaded as this is expected.

Closes gh-5465
9 years ago
Stephane Nicoll 1e0873c86e Polish contribution
Closes gh-5498
9 years ago
Eddú Meléndez 4912b989a5 Add useAlwaysMessageFormat configuration key
Allow to configure the `useAlwaysMessageFormat` attribute of
`MessageSource` via configuration.

Closes gh-5483
9 years ago
Stephane Nicoll abd86e50e0 Merge branch '1.3.x' 9 years ago
Stephane Nicoll ae095b2c1b Disable JMX Integration support if necessary
This commit fixes `IntegrationAutoConfiguration` to actually rely on the
auto-configured `MBeanServer` rather than attempting to create it again.

If JMX support is disabled, no attempt to register integration-related
MBeans is made.

Closes gh-5309
9 years ago
Johnny Lim 51bbe5e37a Polish
Closes gh-5508
9 years ago
Phillip Webb a3bfc29e6e Fix warnings 9 years ago
Phillip Webb 609704a3bf Polish 9 years ago
Phillip Webb c68e5f12ff Formatting 9 years ago
Stephane Nicoll fd437797b6 Polish contribution
This commit polihes the original Neo4j contribution in several areas.

Rather than providing the packages to scan, this commit rearranges the
`EntityScan` and `EntityScanRegistrar` so that the logic can be shared
for other components. If no package is provided, scanning now defaults to
the "auto-configured" package(s) and a `@NodeEntityScan` annotation
allows to override that.

The configuration has also been updated to detect the driver based on the
`uri` property. If the embedded driver is available we use that by
default. If it is not available, we're trying to connect to a Neo4j
server running on localhost. It is possible to disable the embedded mode
or set the `uri` parameter explicitly to deviate from these defaults.

The sample no longer relies on the embedded driver for licensing reason:
rather it expects an instance running on localhost (like other
data-related samples) and gracefully ignore any connection error. A
README has been added in the sample to further explain the available
options;

Closes gh-5458
9 years ago
Michael Hunger 0658cc8aee Add Neo4j support
See gh-5458
9 years ago
Phillip Webb 4167469781 Attempt to work around couchbase CI failures 9 years ago
Phillip Webb e5f224118b Print AutoConfigureReport on test failures
Add a TestExecutionListener to print the auto-configuration report
when a test cannot load.

See gh-4901
9 years ago
Phillip Webb fb70a56c79 Support override enable auto-configuration
Provide a way for full auto-configuration to be disabled
programmatically. Primarily added to allow special test annotations to
take over partial auto-configuration but still load
@SpringBootApplication classes.

See gh-4901
9 years ago
Phillip Webb 47f801d535 Make @ImportAutoConfiguration a meta-annotation
Update `@ImportAutoConfiguration` so that it can be used as a
meta-annotation. Also relocate it from the `test` package.

Fixes gh-5473
9 years ago
Phillip Webb 0829a1bde8 Drop superfluous annotations
Update internal tests to drop annotations that can now
be inferred.

Fixes gh-5470
9 years ago
Phillip Webb 513dec718f Add TestExcludeFilter for component scanning
Add a new TypeFilter specifically for excluding candidate components.
The filter is applied to `@SpringBootApplication` and allows tests to
dynamically contribute exclude filters so that specific classes of
component can be excluded.

See gh-5295
See gh-4901
9 years ago
Phillip Webb 965dd33ec8 Introduce @SpringBootConfiguration annotation
Add a new @SpringBootConfiguration annotation that can be used to
indicate the primary application configuration. The new annotation is
primarily indented to allow test automatically code to find the main
configuration class.

See gh-5295
9 years ago
Phillip Webb c28f552883 Migrate SpringJUnit4ClassRunner to SpringRunner
Replace all existing SpringJUnit4ClassRunner references with the new
SpringRunner alias.

Fixes gh-5292
9 years ago
Phillip Webb 2f815a907a Migrate existing tests from deprecated package
Update the existing tests to use the relocated `spring-boot-test`
classes. Restructuring was achieved using the following command:

find . -type f -name '*.java' -exec sed -i '' \
-e s/org.springframework.boot.test.ConfigFileApplicationContextInitializer/\
org.springframework.boot.test.context.ConfigFileApplicationContextInitializer/g \
-e s/org.springframework.boot.test.EnvironmentTestUtils/\
org.springframework.boot.test.util.EnvironmentTestUtils/g \
-e s/org.springframework.boot.test.IntegrationTest/\
org.springframework.boot.test.context.IntegrationTest/g \
-e s/org.springframework.boot.test.IntegrationTestPropertiesListener/\
org.springframework.boot.test.context.IntegrationTestPropertiesListener/g \
-e s/org.springframework.boot.test.OutputCapture/\
org.springframework.boot.test.rule.OutputCapture/g \
-e s/org.springframework.boot.test.SpringApplicationConfiguration/\
org.springframework.boot.test.context.SpringApplicationConfiguration/g \
-e s/org.springframework.boot.test.SpringApplicationContextLoader/\
org.springframework.boot.test.context.SpringApplicationContextLoader/g \
-e s/org.springframework.boot.test.SpringBootMockServletContext/\
org.springframework.boot.test.mock.web.SpringBootMockServletContext/g \
-e s/org.springframework.boot.test.TestRestTemplate/\
org.springframework.boot.test.web.client.TestRestTemplate/g \
-e s/org.springframework.boot.test.WebIntegrationTest/\
org.springframework.boot.test.context.web.WebIntegrationTest/g {} \;

See gh-5293
9 years ago
Phillip Webb aef7f4bcb1 Restructure spring-boot-test packages
Create a new package structure for `spring-boot-test` and deprecate
existing classes.

Fixes gh-5293
9 years ago
Phillip Webb 47fb614bde Set "proxy target class" for transaction managers
Update `@EnableTransactionManagement` so that `proxyTargetClass` is
set to true. This ensures that @Transactional beans that aren't
interface based can still be proxied.

Fixes gh-5423
9 years ago
Andy Wilkinson 19d8c5e6f6 Complete the move to constructor injection in configuration classes
This is a follow-on from the work done in 5009933. Now that SPR-14015
has been fixed, constructor injection can also be used for parameterised
dependencies, including optional dependencies that are injected via
an ObjectProvider.

Closes gh-5306
9 years ago
Stephane Nicoll cb2ad7fb87 Prevent Thymeleaf to be configured with Thymeleaf 3
Spring Boot does not support Thymeleaf 3 yet. This commit prevents the
auto-configuration to activate if Thymeleaf 3 is available on the
classpath.

Closes gh-5371
9 years ago
Stephane Nicoll 93f392134a Polish 9 years ago
Phillip Webb 7942d9f787 Polish 9 years ago
Stephane Nicoll d8c972c27e Merge branch '1.3.x' 9 years ago
Stephane Nicoll b1b84a358d Fix Artemis embedded mode condition
This commit prevents the Artemis embedded mode to kick-in if the
`EmbeddedJMS` class it not in the classpath. The previous condition would
match if only `artemis-server` was on the classpath while
`artemis-jms-server` is actually required.

Closes gh-5452
9 years ago
Stephane Nicoll 96b7419916 Polish contribution
Closes gh-5455
9 years ago
Eddú Meléndez 2fc2ec457b Auto-configure Redis repositories
Closes gh-5448
9 years ago
Stephane Nicoll bca83bde5b Polish contribution
Closes gh-5417
9 years ago
Marten Deinum ec8b94f13c Support setting webAllowOthers for the H2 Web Console
This commit adds a configuration option for the webAllowOthers option
for the H2 WebServlet. It will only be added it the
spring.h2.console.webAllowOthers is set to true, else it will be
ignored.

Closes gh-5416
9 years ago
Stephane Nicoll 3d4a9d9c84 Polish contribution
The properties exposed by the ActiveMQ pooled connection factory are
quite specific and I felt it was arbitrary to expose some and not others.

However, the number of connections and the timeouts seem the most useful
so they have been kept and a `configuration` nested namespace can be
used to configure any additional settings.

The core properties have been renamed to be less "raw" and more compliant
with the structure of other properties. The documentation on fields has
also been aligned.

Closes gh-5372
9 years ago
n27 e41d42171b Improve ActiveMQ connection pool configuration
Closes gh-1598
9 years ago
Stephane Nicoll fa84b179a8 Allow to customize the Couchbase environment
Closes gh-5403
9 years ago
Stephane Nicoll caf11e4445 Add Couchbase cache support
This commit updates the cache auto-configuration to provide a
`CouchbaseCacheManager` if a `Bucket` has been configured.

The global customizer infrastructure allows to further tune the cache
manager if necessary.

Closes gh-5176
9 years ago
Stephane Nicoll 9c733128ac Use ConditionalOnSingleCandidate when appropriate
This commit updates various auto-configuration to use
`@ConditionalOnSingleCandidate` rather than assuming that at most one
bean of a given type will be available.

Closes gh-2784
9 years ago
Stephane Nicoll 25f00b9bb8 Polish contribution
Closes gh-5341
9 years ago
Gary Russell 08732fe4c8 Add Retry Config: Template and Listener
Also add requeue rejected to listener config and
timeouts to RabbitTemplate config.

Closes gh-5340
9 years ago
Stephane Nicoll 2526a54e31 Polish contribution
Closes gh-5337
9 years ago
Anand Shah f6a32a1d5a Add `@LocalServerPort`
Closes gh-5262
9 years ago
Stephane Nicoll e67f2e2983 Separate Couchbase setup from Spring Data
This commit separates the basic setup of Couchbase from Spring Data so
that a `Bucket` and `Cluster` bucket beans are exposed even if Spring
Data is not available.

A basic setup happens if `spring.couchbase.bootstrap-hosts` is specified,
configuring the `default` bucket with no authentication unless specified
otherwise.

If Spring Data is available, those beans are re-used by default to
configure the `CouchbaseTemplate` and other repository-related beans.

Closes gh-5347
9 years ago
Stephane Nicoll dddea70985 Collect and display build information
This commit updates the Maven plugin to generate a
`META-INF/boot/build.properties` file with various build-specific
settings (group, artifact, name, version and build time). Additionally,
the plugin can be configured to write an arbitrary number of additional
properties.

A new `BuildProperties` bean is automatically exposed when such a file is
present. If that bean is present, an `InfoContributor` is automatically
created to expose that information under the `build` key.

As for the git contributor, it is possible to only display the core
settings or everything using the `management.info.build.mode` property.

See gh-2559
9 years ago
Stephane Nicoll 3e6b584953 Add Date as a support property type
Rather than exposing a raw String with the epoch time, GitProperties
now exposes the actual `java.util.Date`. `InfoProperties` has been
improved to return such data type when the raw value is an epoch time.
9 years ago
Stephane Nicoll b906b18655 Initiate GitProperties
This commit polish the new info contributor infrastructure by migrating
`GitInfo` to `GitProperties`. `InfoProperties` provides an abstraction
that exposes unstructured data in an immutable way.

The `GitInfoContributor` now accepts a "mode" that determines if all data
should be exposed or only a sub-set of known keys.

Closes gh-2644
9 years ago
Phillip Webb b260c20df0 Support JsonSerializer/JsonDeserializer Beans
Add a `@JsonComponent` annotation that can be used to indicate that a
Bean is a JsonSerializer and/or JsonDeserializer that should be
registered with Jackson.

Support is provide via a new `JsonComponentModule` which is
auto-configured in `JacksonAutoConfiguration`.

Also add `JsonObjectSerializer` and `JsonObjectDeserializer` classes
which provided as a convenient base for serializers that work with
Objects.

Fixes gh-3898
9 years ago
Phillip Webb a3f3de223f Polish 9 years ago
Stephane Nicoll 9bbde5b340 Properly guard validation support
Prevent the validation support to kick in if the Validation API is not
available.

Closes gh-5353
9 years ago
Andy Wilkinson 86d87f6b8a Deprecate support for Velocity
Support for Velocity has been deprecated in Spring Framework 4.3 with
the plan being to remove it in 5.0. This commit deprecates Spring
Boot's support in 1.4, with the plan being to remove it in 2.0.

Closes gh-5276
9 years ago
Stephane Nicoll ad53f09ed4 Improve Couchbase repository support
Previously, if Couchbase was available on the classpath but not
configured, Spring Boot would attempt to scan the project for
repositories anyway.

This commit makes sure that it only happens if an infrastructure
bean required is present. The tests have also been rewritten to better
reflect what would happen in practice.

Closes gh-5349
9 years ago
Stephane Nicoll d6bc3f0bc6 Fix build
Assert using epoch time
9 years ago
Stephane Nicoll 76edaa7e1e Fix build
Add TimeZone in date assertion
9 years ago
Stephane Nicoll f11fa0c309 Use `java.util.Date` rather than a raw String
This commit updates `GitInfo` to use a proper `java.util.Date` rather
than a raw String. Because the Maven and Gradle plugin do not agree on a
format, `ProjectInfoAutoConfiguration` now registers a `Converter` that
is taking care of translating the raw `String` to a `Date`.

See gh-2484
9 years ago
Andy Wilkinson 5009933788 Move to constructor injection in simple configuration classes
This commit updates "simple" configuration classes to use constructor
injection. Simple means that there are no optional dependencies
(@Autowired(required=false) is not used), and none of the dependencies
use generics.

Configuration classes that are not simple will be updated in a second
pass once https://jira.spring.io/browse/SPR-14015 has been fixed.

See gh-5306
9 years ago
Stephane Nicoll 398aed7fdb Missing entry for ProjectInfoAutoConfiguration 9 years ago
Phillip Webb 73cbb2f40a Polish 9 years ago
Stephane Nicoll d04155fcae Polish contribution
Closes gh-5303
9 years ago
Gary Russell c0cb813a01 Add Cache Properties for RabbitMQ
Closes gh-3502
9 years ago
Stephane Nicoll 0f820afa86 Auto-configure GitInfo
This commit moves `GitInfo` to a general "project info" area that will be
further improved with others project related information.

Deprecate `spring.git.properties` in favour of `spring.info.git.location`

Closes gh-2484
9 years ago
Johnny Lim a6c83787ef Polish
Closes gh-5318
9 years ago
Andy Wilkinson ef5087c5ee Upgrade to Jackson 2.7.2
Closes gh-5081
9 years ago
Andy Wilkinson 355860fd09 Remove @Autowired from constructors where class has single constructor
Closes gh-5226
9 years ago
Stephane Nicoll 813d86e5e0 Auto-configure Rabbit MessageConverter
If a `MessageConverter` bean is available, we now associate it to the
created `RabbitTemplate` and `RabbitListenerContainerFactory`. That way,
registering a custom `MessageConverter` is all that's needed.

The Rabbit auto-configuration is now using the new `ObjectProvider` that
offers a nicer API to detect if a primary candidate is available for
optional collaborators.

Closes gh-5088
9 years ago
Stephane Nicoll 360caf3d97 Polish 9 years ago
Stephane Nicoll bfa9ae13e7 Polish 9 years ago
Stephane Nicoll d13b9a98c5 Auto-configure JMS MessageConverter
If a `MessageConverter` bean is available, we now associate it to the
created `JmsTemplate` and `JmsListenerContainerFactory`. That way,
registering a custom `MessageConverter` is all that's needed.

The JMS auto-configuration is now using the new `ObjectProvider` that
offers a nicer API to detect if a primary candidate is available for
optional collaborators.

Closes gh-4282
9 years ago
Stephane Nicoll d9f4d6ce91 Allow custom CacheResolver
Previously, if a bean of type `CacheResolver` was present in the context
the whole cache auto-configuration would back off. If said
`CacheResolver` hasn't been defined via the `CachingConfigurer`
infrastructure, the application context would fail with a rather
unpleasant error message.

It can be quite common to define custom `CacheResolver` beans as the cache
annotations allow to defines custom cache resolvers per operation. This
commit makes sure that the cache auto-configuration will back-off only if
the `CacheResolver` is named `cacheResolver`.

Closes gh-5201
9 years ago
Stephane Nicoll 6741f05af1 Polish contribution
Closes gh-4903
9 years ago
Eddú Meléndez 98cc68364a Add Caffeine cache support
See gh-4899
9 years ago
Spring Buildmaster 225d877ab9 Next Development Version 9 years ago
Stephane Nicoll ebf82e4c20 Fix hazelcast schema location
Closes gh-5237
9 years ago
Phillip Webb 023a09bcf6 Merge branch '1.3.x' 9 years ago
Phillip Webb 936a96746a Fix missing Javadoc @param 9 years ago
Phillip Webb 17c9fc585f Polish 9 years ago
Phillip Webb c93ea54ea3 Merge branch '1.3.x' 9 years ago
Phillip Webb 4fd778fed8 Polish CacheManagerCustomizers 9 years ago
Andy Wilkinson ccf7de904c Upgrade to Infinispan 8.1.2.Final
Closes gh-5245
9 years ago
Andy Wilkinson fcb5f03146 Upgrade to Hazelcast 3.6
Closes gh-5237
9 years ago
Stephane Nicoll 78f19ef852 Polish 9 years ago
Stephane Nicoll 7457596b15 Merge branch '1.3.x' 9 years ago
Stephane Nicoll ad57d99fe5 Cleanup HazelcastInstance in test
If a JCache provider is started with hazelcast and the default settings,
the underlying `HazelcastInstance` is disposed at the end of the
process, not when the `CacheManager` is closed.

This commit fixes the only test that use such setup.

See also https://github.com/hazelcast/hazelcast/issues/7606

Closes gh-5209
9 years ago
Stephane Nicoll 416b689359 Enable prefix by default on RedisCacheManager
An overhaul of the `RedisCacheManager` is expected in Hopper (to be
consumed by Spring Boot 1.4). One of those changes is to make sure every
key have a decent prefix by default.

This commit enables the use of prefix as it is disabled by default.

Closes gh-5175
9 years ago
Andy Wilkinson 44ddfcc7fa Upgrade copyright headers of all files changed in 2016 9 years ago
Andy Wilkinson b6c509bd75 Merge branch '1.3.x' 9 years ago
Andy Wilkinson 6075682e64 Polishing
- Code formatting
 - Javadoc warnings
 - Deprecation warnings
9 years ago
Stephane Nicoll 0e43f4204f Merge branch '1.3.x' 9 years ago
Stephane Nicoll 5febd497da Support customization of CacheManager
This commit allows to customize the auto-configured `CacheManager` by
exposing a bean of type `CacheManagerCustomizer`. The implementation may
reference the type of a `CacheManager` to determine in which case it has
to be invoked.

Several implementations can be provided and ordered using the regular
`Ordered` interface and `@Order` annotation.

Closes gh-5039
9 years ago
Stephane Nicoll 2da9f6d91c Merge branch '1.3.x' 9 years ago
Stephane Nicoll c4205d04b3 Rework ListenerContainerFactory configurers
Rework commit b726974 to avoid exposing setters that would permit anyone
to change Spring Boot's defaults. Also, since these are configurers of a
specific instance, they should be named accordingly.

Closes gh-5138
9 years ago
Andy Wilkinson cc4562f96a Merge branch '1.3.x' 9 years ago
Andy Wilkinson b4cda625c4 Break cycle caused by JndiDataSourceAutoConfiguration
There's a long cycle when Spring Data REST, Data JPA and Actuator
are used in an app that retrieves its DataSource from JNDI. The cycle
is:

- WebMvcAutoConfiguration
- HttpMessageConverters
- MappingJackson2HttpMessageConverter (needs an ObjectMapper)
- SpringBootRepositoryRestMvcConfiguration
- ObjectMapper
- RepositoryResourceMappings (part of a custom Jackson module)
- Repositories
- EntityManagerFactory (Triggered by application's Spring Data JPA repository)
- HibernateJpaAutoConfiguration
- JndiDataSourceAutoConfiguration
- MBeanExporter (Used to prevent export of DataSource MBean that's already in JMX)
- EndpointMBeanExportAutoConfiguration
- ObjectMapper (Used to format JSON produced by the exported endpoints)

Spring Data Rest caused the ObjectMapper to depend on JPA. JPA depends
on the DataSource. JnidDataSourceAutoConfiguration depends on the
MBeanExporter. Actuator's MBeanExporter requires an ObjectMapper to
produce JSON strings.

This commit breaks the cycle by making JndiDataSourceAutoConfiguration
access the MBeanExporter lazily. Rather than using `@Lazy`. which does
not work with `@Autowired(required=false)`, the application context
is injected and the MBeanExporter is retrieved manually when it is
needed.

Closes gh-4980
9 years ago
Stephane Nicoll 7df05c7d6d Merge branch '1.3.x' 9 years ago
Stephane Nicoll 094f7aa20e Fix Hazelcast Cache auto-configuration ordering
Spring Boot supports the automatic configuration of an additional
HazelcastInstance if one already exists and an explicit property has been
set to use a different configuration for caching. So three cases are
supported really: no `HazelcastInstance` exists so we need to create one
anyway or an `HazelcastInstance` already exists; in that latter case, we
should either reuse it or create a new one.

Unfortunately, the conditions that checked those three use cases were
not ordered consistently and we could easily get in a situation where
both conditions were evaluated.

This commit makes sure that we  first check if an `HazelcastInstance`
exists and then (and only then) we create the missing `HazelcastInstance`
used for caching. The tests have also been improved to validate the
proper `HazelcastInstance` is used for caching.

Closes gh-5181
9 years ago
Phillip Webb 89b7704977 Extract spring-boot-test.jar
Relocate the `org.springframework.boot.test` package from the
`spring-boot.jar` to `spring-boot-test.jar`.

Fixes gh-5184
9 years ago
Phillip Webb 4b55144d80 Polish 9 years ago
Phillip Webb c6c2959aa3 Merge remote-tracking branch '1.3.x' 9 years ago
Phillip Webb a9afe0a944 Formatting 9 years ago
Andy Wilkinson d6e0b5a165 Use @DirtiesContext to avoid unwanted context caching in the tests
We rarely use the same configuration in multiple test classes, but
Spring’s Test framework caches each context by default. For projects
with large numbers of integration tests, this can lead to tens of
contexts being cached. This increases memory usage, live thread count,
etc for no benefit.

This commit adds @DirtiesContext to the integration tests in
spring-boot, spring-boot-autoconfigure, and spring-boot-actuator so
that the context is closed once the test class has completed.

See gh-5141
9 years ago
Stephane Nicoll a95568d3e8 Polish contribution
Closes gh-5128
9 years ago
Christoph Strobl fc22731420 Add Redis Cluster support
Introduce configuration options for "spring.redis.cluster.nodes" and
"spring.redis.cluster.max-redirects". Properties such as "timeout" and
others remain available via "spring.redis.timeout" and do not have to be
configured on the cluster itself.

See gh-5128
9 years ago
Stephane Nicoll 888270bd03 Polish contribution
Closes gh-5171
9 years ago
Brian Clozel 4ca04abcb2 Add configuration key for GzipResourceResolver
This commit adds a new key that configures a GzipResourceResolver
in the resource handling chain.

Configuring an application with the following will add that resolver,
which checks for gzipped resources in the configured locations:

```
spring.resources.chain.gzipped=true
```

This means that if a resource "style.css" is requested, the
GzipResourceResolver will look for resources named "style.css.gz", which
should be a gzipped variant of the "style.css" file. Note that this
resolver only checks for variants if the client supports the "gzip"
encoding, as defined in the "Accept-Encoding" HTTP request headers.

Fixes #4683
9 years ago
Andy Wilkinson 4189e145bb Polishing
- Remove usages of deprecated APIs
 - Remove redundant version on dependency declaration
9 years ago
Stephane Nicoll d5732afa67 Add missing configuration entry 9 years ago
Stephane Nicoll 90f0fc6ce3 Harmonize JTA properties
Previously, both Atomikos and Bitronix were bound on the `spring.jta`
namespace which makes very hard to figure out which property belong to
which implementation. Besides, `AtomikosProperties` only exposed public
setter which does not generate any useful meta-data.

This commit moves the external configuration for Atomikos and Bitronix to
`spring.jta.atomikos.properties` and `spring.jta.bitronix.properties`
respectively. It also improves the meta-data support for those two
namespaces.

Closes gh-5165
9 years ago
Stephane Nicoll ff5b05fed9 Override default consistency for Couchbase
Spring Data Couchbase 2.0 sets the default consistency to "update-after"
which is good for performance reason but can be quite confusing. Since
the team has decided to switch to "read-your-own-writes" in 2.1, Spring
Boot already offers the improved default right now.

This commit exposes an additional property that can be used to change
the Couchbase's default consistency.

Closes gh-5159
9 years ago
Stephane Nicoll 64a5cad09a Improve couchbase support
Expose an `auto-index` property that controls if views and indexes
should be created automatically.

Update the sample so that it uses this new property, lowering the manual
steps to make it working on a vanilla couchbase server.

See gh-3498
9 years ago
Stephane Nicoll da3b49e024 Polish contribution
Closes gh-3499
9 years ago
Eddú Meléndez 76f1ca4188 Add Couchbase support
Closes gh-3498
9 years ago
Andy Wilkinson ecf11e0230 Merge branch '1.3.x' 9 years ago
Andy Wilkinson d69e0486c1 Allow Thymeleaf's LayoutDialect to be overridden
Closes gh-5151
9 years ago
Stephane Nicoll b205e02e33 Upgrade to Spring Data Hopper M1
Closes gh-5120
9 years ago
Stephane Nicoll 85cc885fd1 Merge branch '1.3.x' 9 years ago
Stephane Nicoll b726974bca Allow to easily customize ListenerContainerFactory
Previously, if one wants to create a custom `JmsListenerContainerFactory`
or `RabbitListenerContainerFactory`, a bunch of code from the auto-
configuration must be duplicated.

This commit introduces two services to configure such factory for JMS
and AMQP with the same sensible defaults that were applied by the
auto-configufrations.

Closes gh-5138
9 years ago
Andy Wilkinson 3f0686fa7e Merge branch '1.3.x' 9 years ago
Andy Wilkinson fc2e51a773 Preserve ordering when auto-configuring WebSocket MessageConverters
Previously, WebSocketMessagingAutoConfiguration added a single
additional converter. This was a MappingJackson2MessageConverter
configured with the auto-configured ObjectMapper.
AbstractMessageBrokerConfiguration places additional converters before
any of the default converters. This meant that the auto-configuration
had the unwanted side-effect of changing the ordering of the
converters. A MappingJackson2MessageConverter was now first in the
list, whereas, by default, it's last in the list after a
StringMessageConverter and a ByteArrayMessageConverter.

This commit updates WebSocketMessagingAutoConfiguration so that it
switches off the registration of the default converters and registers
a StringMessageConverter, ByteArrayMessageConverter and
MappingJackson2MessageConverter in that order. A test has been
added to verify that the types of these three converters match
the types of the default converters. A second test that verifies
that String responses are converted correctly has also been added
alongside the existing test that verified the behaviour for JSON
responses.

Closes gh-5123
9 years ago
Stephane Nicoll b3069e4d43 Merge branch '1.3.x' 9 years ago
Stephane Nicoll c10943c653 Polish Javadoc
Closes gh-4936
9 years ago
Kazuki Shimizu 4e177eeed7 Auto-configure ResourceUrlEncodingFilter when using FreeMarker
Closes gh-5126
9 years ago
Stephane Nicoll 1f106ddf8c Enable connection validation by default
Hikari and Commons DBCP2 are already validating that the connection is
valid before borrowing it from the pool. This commit makes that behaviour
consistent by enabling that feature for the Tomcat and Commons DBCP data
sources.

Since a validation query is required in those cases, the infrastructure
of `DataSourceHealthIndicator` has been merged in a single place: the
`DatabaseDriver` enum provides not only the driver class names but also
the validation query, if any.

Closes gh-4906
9 years ago
Stephane Nicoll eb7b1ec33c Merge branch '1.3.x' 9 years ago
Stephane Nicoll 2a8a3741f5 Merge DriverClassNameProvider in DatabaseDriver
DriverClassNameProvider is unused but was probably restored by a merge
commit at some point. It wasn't obvious and updated that class rather
than `DatabaseDriver`.

This commit updates `DatabaseDriver` and deletes
`DriverClassNameProvider`.

Closes gh-5076
9 years ago
Phillip Webb 2b18e99ac7 Polish 9 years ago
Stephane Nicoll a27176807f Polish contribution
Closes gh-4188
9 years ago
Eddú Meléndez 5776d6a8d7 Add support of Jackson in Jersey
If Jackson is configured for the project, the `ObjectMapper` is now
reused and added in the Jersey's context.

Closes gh-4131
9 years ago
Phillip Webb a5ae81c1c1 Use AssertJ in spring-boot-autoconfigure
See gh-5083
9 years ago
Phillip Webb 516afcd2ca Polish 9 years ago
Phillip Webb ed01ae9ebf Use deterministic DataSource config import order
Update DataSourceAutoConfiguration so that pooled datasource
configurations are only loaded via an @Import. If left as nested
classes, the load order is JVM specific and can result in the wrong
configuration being loaded.

Closes gh-2183
9 years ago
Phillip Webb 3d0355434c Drop unneeded version tag from POM.xml 9 years ago
Phillip Webb a80ada64c3 Formatting 9 years ago
Vedran Pavic 1bc3eb8f0a Fix MariaDB driver class name
Closes gh-5075
9 years ago
Stephane Nicoll 34d87df425 Clarify use of the `spring.datasource` prefix
Previously, Spring Boot mapped both `DataSourceProperties` and the actual
`DataSource` implementation to the same prefix. This results in a huge
amount of keys in the `spring.datasource` namespace  with no way to
identify those that are valid for the pooled data source in use.

This commit maps the four pooled data sources we support in four isolated
namespace, keeping `spring.datasource` only for the common settings.

These are `spring.datasource.tomcat`, `spring.datasource.hikari`,
`spring.datasource.dbcp` and `spring.datasource.dbcp2` for the Tomcat,
Hikari, Commons DBCP and Commons DBCP2 implementations respectively.

Closes gh-2183
9 years ago
Phillip Webb 26dfbeb8f4 Share MetadataReaderFactory
Add SharedMetadataReaderFactoryContextInitializer to ensure that a
shared caching MetadataReaderFactory is used between configuration
classes and auto-configure sorting.

Fixes gh-4993
9 years ago
Phillip Webb f276ff4bd0 Polish 9 years ago
Stephane Nicoll b02073b455 Polish 9 years ago
Stephane Nicoll 217f825d3d Clarify DataSourceAutoConfiguration
The `DataSource` auto-configuration in Spring Boot supports two modes:
regular pooled DataSource and embedded database (via the
`EmbeddedDatabase` infrastructure provided by `spring-jdbc`. These were
previously named `NonEmbedded` and `Embedded` respectively.

This commit clarifies those mode and in particular that a pooled
`DataSource` can also handle an embedded database.

Closes gh-4634
9 years ago
Stephane Nicoll 762097ef29 Refactor logic from DataSourceProperties
Introduce dedicate method to determine the actual value to use based on
the configuration and the environment.

Closes gh-1436
9 years ago
Stephane Nicoll 3562026e9a Polish contribution
Closes gh-4574
9 years ago
Patrick Bray 3bf6c2fe1f Support for SendGrid ApiKey
See gh-4574
9 years ago
Stephane Nicoll 58751a43c1 Polish contribution
Closes gh-4590
9 years ago
Eddú Meléndez c68ffa5ba0 Add Thymeleaf's Java8TimeDialect
Closes gh-4576
9 years ago
Stephane Nicoll 854a67588e Remove reference to spring.view.*
Closes gh-3278
9 years ago
Stephane Nicoll 8e3d63ab6a Polish contribution
Closes gh-4632
9 years ago
Huang YunKun d796845664 Remove deprecated use of spring.mvc.*
Closes gh-4086
9 years ago
Stephane Nicoll cafe1dc4c6 Polish contribution
Fix additional use of \n

Closes gh-4707
9 years ago
mnhock e0ec607735 Use a platform-specific line separator
See gh-4707
9 years ago
Stephane Nicoll 4ff5afc636 Polish contribution
Removing all deprecated code

Closes gh-4905
Closes gh-4917
9 years ago
Eddú Meléndez 7b9cd20e98 Remove deprecated code
See gh-4905
9 years ago
Phillip Webb fbaf209240 Move master to 1.4.0.BUILD-SNAPSHOT 9 years ago
Johnny Lim 9a31e02806 Polish
Closes gh-5013
9 years ago
Spring Buildmaster 504d3e97ba Next development version 9 years ago
Phillip Webb e520c47c4f Refine `messages.properties` detection
Update `ResourceBundleCondition` to only enable the messages source
if `messages.properties` (and not `messages*.properties`) exists. This
operation is much faster that performing a pattern match since a full
jar entry scan is not required.

Since adding `messages.properties` is good practice and this change
allows us to delete the custom `PathMatchingResourcePatternResolver`
it seems like a fine compromise to make.

Fixes gh-4930
See gh-4811
9 years ago
Phillip Webb cf93f84e87 Polish 9 years ago
Phillip Webb 93c3b22bb4 Merge branch '1.2.x' 9 years ago
Phillip Webb c71aa32fbb Polish 9 years ago
Phillip Webb af36bf6864 Remove TODO in FlywayAutoConfiguration
Now tracked by gh-4995
9 years ago
Stephane Nicoll 44f508208a Merge branch '1.2.x' 9 years ago
Stephane Nicoll 58ebfdcbd3 Polish contribution
Closes gh-4973
9 years ago
Jacques-Etienne Beaudet a749855cb5 Allow indexed access of `flyway.locations`
This commit allows to use the `flyway.locations` in an indexed fashion
(i.e. typically in YAML configuration).

See gh-4973
9 years ago
Andy Wilkinson e33221aae1 Configure existing Jersey servlet registration created by the SCI
When a Jersey app is deployed to a standalone container, Jersey’s
ServletContainerInitializer will run and register a servlet for a class
annotated with @ApplicationPath. If Jersey’s ServletContainerInitializer
runs before Spring’s, this servlet will take precedence over the
servlet registered by JerseyAutoConfiguration and will therefore not be
configured with any init parameters specified using spring.jersey.init

For the case where Jersey’s SCI runs first, this commit updates
JerseyAutoConfiguration to examine the servlet context for an existing
registration of Jersey’s servlet (Jersey names the registration using
the fully-qualified name of the ResourceConfig subclass). If a
registration is found its init parameters are configured using the
configuration provided by spring.jersey.init.

For the case where Spring’s SCI runs first, this commit updates
JerseyAutoConfiguration so that it names its registration using the
fully-qualified name of the ResourceConfig sub-class. This allows
Jersey’s SCI to find the existing registration rather than attempting
to configure its own.

Closes gh-2471
9 years ago
Stephane Nicoll 9f728b3d59 Fix wrong import 9 years ago
Stephane Nicoll ea8e0cfc48 Support for simple numeric Flyway version
While Flyway's `MigrationVersion` is a String value, a simple "0" is
also a valid number. When such value is not wrapped in YAML, an integer
is injected rather than a String which leads to a failure as we can't
convert it.

This commit updates the `StringToMigrationVersionConverter` to also
supports conversion from a Number. This is a convenience for users
using YAML for configuration

Closes gh-4981
9 years ago
Andy Wilkinson 6f8d4c77e6 Handle multiple ContextRefreshedEvents in BackgroundPreinitializer
The same initializer will receive multiple ContextRefreshedEvents
when their is an application context hierarchy. This commit updates
the initializer to correctly handle multiple ContextRefreshedEvents
and only act upon the first that it receives.

See gh-4871
9 years ago
Andy Wilkinson 992e90f43d Ensure that background preinit has completed before refresh returns
This commit is a continuation of the changes made in b85b608. It
addresses an additional problem when testing applications where two
contexts are refreshed in quick succession. In this scenario, it
was possible, theoretically at least, for the first context’s background preinitialization to still be in progress and creating loggers when the
second is refreshed and resets the logger context.

This commit updates BackgroundPreinitializer so that, upon receipt of
a ContextRefreshedEvent, it waits for preinitialization to have
completed. In the scenario described above, this ensures that
preinitialization has completed before the call to refresh() for the
first context returns, thereby preventing it from running in parallel
with the refresh of the second context.

Closes gh-4871
9 years ago
Stephane Nicoll 179467bdd9 Make HazelcastJpaDependencyAutoConfiguration public
If Both Hazelcast and Hibernate are available, Spring Boot takes the
opinion that Hazelcast can be used for 2nd level caching and therefore
need to start before Hibernate.

Unfortunately, some users require Hibernate in some of their hazelcast
use case so the link is actually reversed. One way for such user is to
disable the auto-configuration that deals with this link. This class is
now public so that users can locate them and exclude them if necessary.

Closes gh-4960
9 years ago
Andy Wilkinson b85b60828c Perform background preinitialization after logging system setup
Previously, BackgroundPreinitializer would kick off preinitialization
on a separate thread in response to an ApplicationStartedEvent. This
work would then race with the logging system being set up in response
to an ApplicationEnvironmentPreparedEvent. When Logback’s being used
this race is problematic. As part of Logback’s setup,
LoggerContext.stop() is called. This calls LoggerContext.reset() which
can fail with a ConcurrentModificationException if another thread tries
to create a Logger at the same time. This is a known bug in Logback [1].

This commit updates BackgroundPreinitializer to respond to
an ApplicationEnvironmentPreparedEvent and to order itself so that it’s
called after LoggingApplicationListener has responded to the same event
by initializing the logging system.

Closes gh-4871

[1] http://jira.qos.ch/browse/LOGBACK-397
9 years ago
Andy Wilkinson 112b707b67 Ensure that MongoClient is not created with a null credentials list
Mongo’s 2.x driver allowed the credentials list to be null, however
the 3.x driver requires an empty list instead. The behaviour of the 2.x
driver is the same whether the client is created with a null credential
list or an empty credential list.

This commit aligns with the requirements of the 3.x driver by ensuring
that we never pass in a null credential list when creating the client.

Closes gh-4076
9 years ago
Stephane Nicoll 7d975ecd2e Polish 9 years ago
Stephane Nicoll af5d765a08 Enable resource chain if webjars locator is present
Webjars locator is a good hint that the resource chain should be
enabled. The sole presence of the library now enables the resource chain
unless the configuration states otherwise.

Closes gh-4403
9 years ago
mnhock 8f1f8dd680 Use entrySet() rather than using keySet() and then calling get(key)
Closes gh-4813
9 years ago
Andy Wilkinson 1107079683 Merge branch '1.2.x' 9 years ago
Andy Wilkinson b56eef236e Close Reader used by MustacheViewResolver when compiling a Template
Previously, MustacheViewResolver would create an InputStreamReader
that wraps the template Resource's InputStream but would fail to close
the Reader. When the InputStream was a FileInputStream, this caused
the resolver to leak file handles.

This commit updates the resolver to close the Reader once the Template
has been compiled, thereby allowing any underlying resources to be
cleaned up immediately, rather than having to wait for the JVM to exit.

Closes gh-4921
9 years ago
Andy Wilkinson 24fd503743 Merge branch '1.2.x' 9 years ago
Andy Wilkinson b99739212a Correct the name of MySQL's XADataSource implementation
Closes gh-4942
9 years ago
Andy Wilkinson 27a81e1463 Complete static final logger changes that were started in ec2f33f9
This commit completes the changes to consistently used static final
fields for Log instances that were started in ec2f33f9. Specifically it:

 - Removes this. when accessing logger fields that are now static
 - Renames some fields from log to logger
 - Makes some logger fields static

See gh-4784
9 years ago
Andy Wilkinson 150a6f0f5c Switch off Security Filter auto-config when spring-security-config is absent
SecurityFilterAutoConfiguration uses SecurityProperties which uses
SessionCreationPolicy from spring-security-config. This commit makes
SecurityFilterAutoConfiguration conditional on SessionCreationPolicy,
thereby preventing a startup failure if spring-security-web is on the
classpath but spring-security-config is not.

Closes gh-4919
9 years ago
Phillip Webb d2fed8bb07 Polish 9 years ago
Stephane Nicoll 72754c27b2 Allow to override BasicBatchConfigurer
Issue #4533 was supposed to make BasicBatchConfigurer public again but
unfortunately only the class visibility was changed. This commit makes
sure it can be overridden.

Closes gh-4888
9 years ago
Stephane Nicoll b1c2226e23 Merge branch '1.2.x'
# Conflicts:
#	spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfiguration.java
9 years ago
Stephane Nicoll 12cefd2c2b Only enable Tomcat's websocket support on Java7+
Tomcat's websocket support requires Java7 or later. That commit makes
sure to register its support only when such requirement is met.

Closes gh-4846
9 years ago
Spring Buildmaster 8db59059a5 Next Development Version 9 years ago
Stephane Nicoll bb736e255b Fix SNAPSHOT version 9 years ago
Phillip Webb 945b42588b Refine server.server-header documentation
Fixes gh-4461
9 years ago
Kirill Vlasov ec2f33f986 Make loggers private static final
Apply consistency across all static loggers.

Closes gh-4784
9 years ago
Kirill Vlasov 786aacf2e9 Use Collections.isEmpty() instead of .size() == 0
Ensure that Collections.isEmpty() is used to check if there are no
elements in a collections. This is more explicit and can be faster than
calling .size().

Closes gh-4783
9 years ago
Andy Wilkinson 3352e60631 Remove use of diamond operator in tests so that they’re Java 6 compatible
See gh-4163
9 years ago
Andy Wilkinson 037a27e257 Add a workaround for DATACMNS-776
Spring Data’s web support includes a handler method argument resolver,
ProxyingHandlerMethodArgumentResolver, that inaccurately claims that it
can handle all interface handler method arguments. This causes problems
for handler methods that take Spring Mobile’s Device as an argument as
the proxied Device instance does not behave correctly.

This commit works around the problem by assigning an order to the 
WebMvcConfigurerAdapter that registers Spring Mobile’s argument resolver
with Spring MVC. This ordering ensures that Spring Mobile’s resolver
takes precedence over Spring Data’s for Device arguments.

Closes gh-4163
9 years ago
Jacob Swanson ae565b805a Fix mail connection test exception message
Closes gh-4780
9 years ago
Artur Konczak 786f025818 Auto-configure Elasticsearch converter and context
Extend ElasticsearchDataAutoConfiguration to also configure an
ElasticsearchConverter and SimpleElasticsearchMappingContext both
of which are required for Spring Data REST.

Closes gh-3847
9 years ago
Andy Wilkinson bcaee0ebee Perform initialization in foreground if BackgroundPreinitializer fails
Google App Engine probits the creation of new threads. This leads to a
failure in BackgroundPreinitializer when the single thread executor
attempts to create its single thread.

This commit enhances the existing fail safety of
BackgroundPreinitializer by catching any exceptions thrown while
creating the executor and submitting the tasks to it. Any initialisation
that has not performed in the background will be performed in the
foreground instead.

Closes gh-4662
9 years ago
Phillip Webb 543a746de7 Fix checkstyle issues
See gh-4763
9 years ago
Phillip Webb 5719fab142 Merge branch '1.2.x' 9 years ago
Phillip Webb edb16a13ee Protect against SpEL injections
Prevent potential SpEL injection attacks by ensuring that whitelabel
error view SpEL placeholders are not recursively resolved.

Fixes gh-4763
9 years ago
Andy Wilkinson 5cb9b9a9e9 Merge branch '1.2.x' 9 years ago
Andy Wilkinson 7d5cc3da63 Stop ActiveMQ pooled connection factory when context is closed
Previously, ActiveMQ's pooled connection factory was not closed as
part of the application context being closed. This would leave
non-daemon threads running which could cause shutdown to hang unless
the JVM itself was shutting down (in which case a shutdown hook would
stop the pool).

This commit configures each pooled connection factory bean with a
custom destroy method so that the pool is stopped as part of the
application context being closed. To allow the destroy method to only
be declared when the connection factory is pooled, the bean method
has been split into two; one for pooled and one for non-pooled. This
is a partial backport of the changes made in bedf2edf.

Closes gh-4748
9 years ago
Eddú Meléndez 1b81d9f0b5 Add support for server.server-header property
Add a `server.server-header` property which can be used to override the
`server` header usually sent back automatically by Tomcat/Jetty or
Undertow.

See https://www.owasp.org/index.php/Securing_tomcat for background.

Fixes gh-4461
Closes gh-4504
9 years ago
mnhock fcf6e5d6eb Prefer valueOf() to create Number values
Update Long/Integer constructor calls with `valueOf` which can make use
of global caches.

Closes gh-4688
9 years ago
Andy Wilkinson 0bb4de490d Allow any ExitCodeGenerator bean to switch of auto-configured bean
In bedf2edf, the return type of the auto-configuration method that
creates batch's ExitCodeGenerator was changed from ExitCodeGenerator
to JobExecutionExitCodeGenerator but the on missing bean condition
was left unchanged. This means that the auto-configured bean can
only be switched off by a JobExecutionExitCodeGenerator bean, rather
than any bean that implements ExitCodeGenerator.

This commit corrects the use of @ConditionalOnMissingBean to allow any
ExitCodeGenerator bean to switch off the auto-configured one.

Closes gh-4752
9 years ago
Phillip Webb 0489a3b4de Polish 9 years ago
Andy Wilkinson 4f7752d467 Merge branch '1.2.x' 9 years ago
Andy Wilkinson ce541bebcf Align BasicErrorController’s HTML response status with non-HTML status
Previously, BasicErrorController would return the response status
set in the javax.servlet.error.status_code request attribute when
serving JSON but would also return a 200 OK response when serving
HTML. This didn’t cause much trouble when a person was browsing, but
proved problematic for machine clients that request text/html and care
about the response status. For example, the success handler would be
driven for an XHR request even though the response was really an error.

This commit updates BasicErrorController to set the response status for
text/html responses to match the status that it would use in an
application/json response.

Closes gh-4694
9 years ago
mnhock 9775d40822 Fix possible null pointer dereference
Closes gh-4685
9 years ago
Johnny Lim ec7fed1ecc Polish
Closes gh-4677
9 years ago
Andy Wilkinson 91674b2c94 Don’t use Java 7 API in EmbeddedMongoAutoConfiguration
Closes gh-4630
9 years ago
Andy Wilkinson c58ebae419 Bind embedded Mongo to configured host or loopback address
Previously, the auto-configuration for embedded Mongo did not specify
a bind IP so Mongo was started without one. This would lead to Mongo
binding to all available network interfaces. This caused some friction
with the Windows firewall as it would ask for permission every time
embedded Mongo was launched.

This commit updates the auto-configuration to use
spring.data.mongodb.host to configure the bind IP for embedded Mongo.
If spring.data.mongodb.host is null, the auto-configuration will use
the loopback address instead.

Closes gh-4630
9 years ago
Andy Wilkinson 007ec9e46b Make SecurityFilterAutoConfig work when SecurityAutoConfig is disabled
Previously, disabling SecurityAutoConfiguration could cause
SecurityFilterAutoConfiguration to fail if Spring Security’s filter
chain bean existing in the context. SecurityFilterAutoConfiguration
relies on SecurityProperties which is created by
SecurityAutoConfiguration. When SecurityAutoConfiguration is disabled,
there’s no SecurityProperties bean so SecurityFilterAutoConfiguration
would fail due to the missing dependency.

This commit updates SecurityFilterAutoConfiguration to create a
SecurityProperties bean if one does not already exist.

Closes gh-4525
9 years ago
Andy Wilkinson ffd6e8d7eb Handle null security filter dispatcher types gracefully
See gh-4505
9 years ago
Andy Wilkinson f47449c800 Remove Servlet API dependency from SecurityProperties
A dependency on the Servlet API (the filter's dispatcher types) causes
a failure when Spring Security is used in a non-web application.

This commit removes the dependency on javax.servlet.DispatcherType
in favour of using a Set of Strings. SecurityFilterAutoConfiguration,
which is only enabled for web applications, is the responsible for
converting each String to a DispatcherType.

Closes gh-4505
9 years ago
Andy Wilkinson 4260b0c765 Remove ignoreUnknownFields accidentally added in 524a328 9 years ago
Andy Wilkinson 524a32879f Allow security filter's dispatcher types to be configured via env
This commit adds a new property, security.filter-dispatcher-types
that can be used to configure the dispatcher types of Spring
Security's filter chain. The default remains unchanged.

Closes gh-4505
9 years ago
Stephane Nicoll fc5e3d6441 Refine exception message
Closes gh-4569
9 years ago
Andy Wilkinson 40427cdb82 Separate Jersey WebApplicationInitializer from auto-configuration class
Previously, JerseyAutoConfiguration was a WebApplicationInitializer.
This was problematic as auto-configuration classes should not be ordered
(they should use AutoConfigureBefore etc instead) but the web
application initializer needs to be ordered so that it can run early and
configure Jersey before it runs.

This commit has moved the WebApplicationInitializer implementation into
a separate class so that it can be ordered independently of the
auto-configuration class. Note that the new class must be public for
the servlet container (Tomcat at least) to be able to instantiate it.

Closes gh-4527
9 years ago
Dave Syer 521ae35f56 Do not set order of ResourceServerConfiguration instances
The need to set the order of ResourceServerConfiguration was
a bad assumption. The value of the order seems strange as well
(-10), and a comment explaining it makes no sense (a resource
server normally wants its filter *after* not *before* the existing
auth server filter). Removing the bean post processor didn't
fail any tests.

In case there are multiple resource servers in the same context
there was also a problem that they ended up with the same order.
9 years ago
Stephane Nicoll 9d29ab73a4 Fix customization of database name
Previously, the `spring.datasource.name` property was ignored when Spring
Boot configures an embedded data source with a connection pool.

`EmbeddedDatabaseConnection` is now aligned to the purely embedded case
to take that property into account.

Closes gh-4586
9 years ago
Dave Syer cccc3867eb Allow users to customize authentication entry point in OAuth2 SSO
The SsoSecurityConfigurer that gets added when a user has a custom
WebSecurityConfigurer with @EnableOAuth2Sso is quite opinionated, and
this is preventing users from custimizing the exception handling in the
customized UI security. This change makes it less opinionated, using
request matchers to configure the default instead of ovewriting the
single authentication entry point.

Also adds an entry point responding with a 401 for XHR clients (just like
the vanilla HTTP Basic auth).

Fixes gh-4629
9 years ago
Jean de Klerk 91a10e12b6 BasicBatchConfigurer is public again
Closes gh-4533
Closes gh-4608
9 years ago
Stephane Nicoll 0c387a82b7 Add datasource meta-data for Commons DBCP2
Closes gh-4562
9 years ago
Johnny Lim efff4a0051 Polish
Closes gh-4554
9 years ago
Dave Syer 8708a07a98 Ensure RestTemplate interceptors remain mutable
Fixes gh-4553
9 years ago
Johnny Lim 36ed0f5c20 Polish
Closes gh-4537
9 years ago
Johnny Lim da16d6d306 Polishing
Closes gh-4503
9 years ago
Spring Buildmaster 3f6f57a80e Next Development Version 9 years ago
Phillip Webb c4f653e8e3 Upgrade to Jackson 2.6.3
Closes gh-4170
9 years ago
Stephane Nicoll 0c8d302a98 Polish
See gh-4448
9 years ago
Eddú Meléndez 066533de7e Add `spring.mvc.static-path-pattern` property
Add a `spring.mvc.static-path-pattern` property which can be used to
configure the path pattern used to serve static resources.

Fixes gh-4444
Closes gh-4448
9 years ago
cornelcreanga@yahoo.com 190b0d4fe9 Add Cassandra username/password properties
Allow Cassandra credentials to be specified using properties.

Fixes gh-4431
Closes gh-4432
9 years ago
Johnny Lim 12a9a6e195 Remove redundant assertions
Closes gh-4428
9 years ago
Phillip Webb 287a62c8f3 Update Johannes Edmeier author attribution
Congratulations to Johannes Edmeier on getting married!
9 years ago
Bohuslav Burghardt 88cf65427f Make OPTIONS/TRACE request handling configurable
Add properties to WebMvcProperties allowing control of if TRACE/OPTIONS
requests should go through the regular dispatching chain.

Closes gh-4300
9 years ago
Phillip Webb a8b23f9deb Fix import order 9 years ago
awgtek deaa9051bc Switch MongoCredential method
Update MongoProperties to use `MongoCredential.createCredential` rather
than `MongoCredential.createMongoCRCredential`. This allows connections
to Mongo 3.0 servers to authenticate using the SCRAM-SHA-1 mechanism.

Closes gh-4237
9 years ago
Johnny Lim 83e8bfedb2 Use Ordered.HIGHEST_PRECEDENCE constants
Use Ordered.HIGHEST_PRECEDENCE rather than Integer.MIN_VALUE.

Closes gh-4335
9 years ago
Johnny Lim 8540d80b84 Remove unused parameter in Security configuration
Update SecurityFilterAutoConfiguration.securityFilterChainRegistration
to remove unused ApplicationContext parameter.

Closes gh-4399
9 years ago
Phillip Webb e06198e9cb Polish 9 years ago
Stephane Nicoll 2c4f88e221 Fix Hazelcast auto-configuration ordering
Make sure that the general Hazelcast auto-configuration is processed
before the cache auto-configuration. This was supposed to be fixed and
tested in 721b5a2 but unfortunately the `@AutoConfigureAfter` annotation
was placed on a regular `@Configuration` class (which has no effect).

The tests were passing because the ordering is actually hardcoded in the
test. The relevant tests now use `ImportAutoConfiguration` that simulates
the same order as the one use by the actual application.

Closes gh-4389
9 years ago
Stephane Nicoll 157c0b6cae Register hazelcast post processor only when necessary
Commit 8e0a94f introduced a post processor that adds an explicit link
between the `HazelcastInstance` and the `EntityManagerFactory` so that
Hazelcast is fully initialized before Hibernate actually kicks in.

Unfortunately, the conditions that were implemented to register this post
processor are wrong and any app that has both JPA and Hazelcast support
blows up if no bean with name `hazelcastInstance` is defined.

This commit fixes the situation and reworks the configuration in a
separate auto-configuration that runs after the Hazelcast and JPA support
and check both the presence of an `EntityManagerFactory` and a bean of
name `hazelcastInstance`. If any of those conditions does not apply the
post processor is no longer registered.

Closes gh-4158
9 years ago
Stephane Nicoll 6dbdd575a5 Polish 9 years ago
Phillip Webb d88210f626 Improve performance with BackgroundPreinitializer
Add a BackgroundPreinitializer to trigger early initialization in a
background thread of time consuming tasks. By moving certain
initialization tasks to background thread and triggering them early
we can improve the critical path when the application starts. For
example, Tomcat's MBeanFactory class parses several XML files when
first loaded. If we trigger the load in a background thread it completes
before Tomcat actually needs to use it.

The initial set of initializers included with this commit are:

- Tomcat MBeanFactory
- javax.validation
- Spring's AllEncompassingFormHttpMessageConverter

See gh-4252
9 years ago