Commit Graph

783 Commits

Author SHA1 Message Date
Phillip Webb 88f8eb7fa4 Merge branch '1.1.x' 2014-09-17 10:46:30 -07:00
Phillip Webb 611f978181 Make all @Bean methods public
Fixes gh-1571
2014-09-17 10:45:23 -07:00
Phillip Webb 4f610fa5a1 Merge branch '1.1.x'
Conflicts:
	spring-boot-samples/spring-boot-sample-tomcat-ssl/pom.xml
	spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/SampleTomcatSslApplicationTests.java
	spring-boot/src/main/java/org/springframework/boot/context/embedded/ConfigurableEmbeddedServletContainer.java
	spring-boot/src/main/java/org/springframework/boot/context/embedded/Ssl.java
2014-09-17 10:11:30 -07:00
Phillip Webb 62a5ce52d0 Backport Jetty/Tomcat SSL support
Fixes gh-1570
Cherry-picked from 0960908 and 258c6f1
2014-09-17 10:08:05 -07:00
Phillip Webb c0f69d28d3 Remove inadvertently committed debug System.out 2014-09-17 10:08:05 -07:00
Dave Syer 5946ade199 Merge branch '1.1.x' 2014-09-17 10:20:03 +01:00
Dave Syer 95c15733bc Use ErrorController.getErrorPath() to ignore the error path for security
Fixes gh-1548 again
2014-09-17 10:19:18 +01:00
Andy Wilkinson e8ce93715a Merge branch '1.1.x' 2014-09-16 17:20:35 +01:00
Andy Wilkinson eed58eecb4 Improve error handling in EnableAutoConfigurationImportSelector
Previously, EnableAutoConfigurationImportSelector assumed that it
would always find auto-configuration attributes from an
@EnableAutoConfiguration annotation. This assumption does not hold
true in certain circumstances, although exactly what those
circumstances are is unclear. It could occur if the import selector
were used directly, but it's package-private making that unlikey. In
such circumstances a NullPointerException was being thrown.

This commit asserts that the attributes are non-null and, should the
assertion fail, produces an error that is more helpful than an NPE.

Closes gh-1512
2014-09-16 15:56:22 +01:00
Andy Wilkinson 284e7b2091 Merge branch '1.1.x' 2014-09-16 15:40:23 +01:00
Andy Wilkinson 468b6cb1f7 Add support for configuring RemoteIpValve’s internalProxies
Closes gh-1522
2014-09-16 15:40:18 +01:00
Andy Wilkinson 4b25b0e7a2 Allow Jackson features to be configured via the environment
Enhance JacksonAutoConfiguration to configure features on the
ObjectMapper it creates based on the following configuration
properties:

spring.jackson.deserialization.* = true|false
spring.jackson.generator.* = true|false
spring.jackson.mapper.* = true|false
spring.jackson.parser.* = true|false
spring.jackson.serialization.* = true|false

The final part of each property name maps onto an enum. The enums are:

deserialization: com.fasterxml.jackson.databind.DeserializationFeature
generator: com.fasterxml.jackson.core.JsonGenerator.Feature
mapper: com.fasterxml.jackson.databind.MapperFeature
parser: com.fasterxml.jackson.core.JsonParser.Feature
serialization: com.fasterxml.jackson.databind.SerializationFeature

Closes gh-1227
2014-09-16 09:59:59 +01:00
Phillip Webb 26ac68df05 Polish Redis sentinel support 2014-09-15 13:09:02 -07:00
Phillip Webb b129bc261a Polish 2014-09-15 13:08:56 -07:00
Phillip Webb 565e449d89 Merge branch '1.1.x'
Conflicts:
	spring-boot-docs/src/main/asciidoc/howto.adoc
2014-09-15 11:37:50 -07:00
Phillip Webb 5ba86a103d Polish 2014-09-15 11:35:16 -07:00
Andy Wilkinson c02804931f Merge branch '1.1.x' 2014-09-15 15:39:41 +01:00
Andy Wilkinson 6f9f335ea1 Add additional class conditions for JTA auto-configuration
Previously, JTA auto-configuration would fail with a variety of
ClassNotFoundExceptions and NoClassDefFoundErrors if it was used with
an “incomplete” classpath. This commit adds a number of classes to
@ConditionalOnClass annotations so that the auto-configuration backs
off gracefully in the absence of certain classes.

Specifically, the following now work as expected:

 - Deploying an app to a server with JTA available via JNDI when the
   app does not use transactions
 - Auto-configuration of Atomikos without JMS
 - Auto-configuration of Bitronix without JMS

Both XADataSourceAutoConfiguration and JndiDataSourceAutoConfiguration
have been updated to back off in the absence of spring-jdbc; a
dependency of DataSourceProperties which is used by both classes.

Error handling in AtomikosDependsOnBeanFactoryPostProcessor and
BitronixDependentBeanFactoryPostProcessor has been enhanced so that the
correct dependencies are established, even in the absence of JMS.

Fixes gh-1538
2014-09-15 15:03:11 +01:00
Dave Syer 6456f2a542 Add url,user,password to LiquibaseProperties
User can set those properties (optionally) to use a different
DataSource than the default.

Fixes gh-1558
2014-09-15 08:30:58 -05:00
Dave Syer 59ce634437 Use class name not value to support non-Hibernate JPA vendors
With this change I got a simple Eclipselink version of the data-jpa
sample working. I'll push that when I get time to research it a bit more
(I needed to set up a Java agent so either that might be a problem
for our integration tests if we can't work around it).

Fixes gh-1268. Cherry picked onto master after (apparently) a failed
merge of commit ac2ab39.
2014-09-15 10:51:14 +01:00
Dave Syer 049cd4b85b Merge branch '1.1.x' 2014-09-13 10:59:32 -05:00
Dave Syer 437fb75424 Add /error to ignored paths for security autoconfig
Protecting /error doesn't make a great deal of sense and if it is
protected you don't get the ErrorPageFilter for the attempt at loading
it, so Tomcat renders its own HTML error page (when deployed as WAR).

Fixes gh-1548
2014-09-13 10:55:39 -05:00
Dave Syer 389c4f3e0b Merge branch '1.1.x' 2014-09-13 06:44:03 -05:00
Dave Syer 9902f98a3d Ensure the AuthenticationManager is created when needed
There was too much state really in the old implementation of
AuthenticationManagerConfiguration, and it was leading occasionally
to null pointers when method A assumed that method B had already
been called and it hadn't. This change manages to concentrate all the
references to an AuthenticationManagerBuilder into a single method
call, removoing the need for storing it at all.

Fixes gh-1556
2014-09-13 06:42:46 -05:00
Dave Syer 0950072b5e Fix integration test (shared context by accident) 2014-09-12 16:03:22 -05:00
Christoph Strobl c8a4891441 Add support for Redis Sentinel configuration
Spring Data Redis 1.4.0 introduced Redis Sentinel support. When
specified, RedisConnectionFactory uses the Sentinel configuration to
determine the current master.

Sentinel configuration can be specified using two new properties:
spring.redis.sentinel.master and spring.redis.sentinel.nodes.

For example:

spring.redis.sentinel.master=mymaster # name of redis server
spring.redis.sentinel.nodes=127.0.0.1:26379,127.0.0.1:26380

Alternatively, a bean of type RedisSentinelConfiguration can be declared
and it will be used to configure the connection factory.

Note: At this time, Sentinel support is only available for Jedis

Closes gh-1337
2014-09-07 17:00:38 -05:00
Andy Wilkinson fbeb8c966c Upgrade to Spring Data Evans
The missing bean condition on the auto-configuration classes for
Elasticsearch, Jpa, Mongo and Solr repositories have been tightened to
look for ElasticsearchRepositoryFactoryBean, JapRepositoryFactoryBean,
MonoRepositoryFactoryBean, and SolrRepositoryFactoryBean respectively.

In Spring Data Evans, when there are multiple repository types on the
classpath, a strict mode is entered to prevent the different
repositories from trampling over each other. A side-effect of this is
that for the Mongo domain types in the tests to be discovered they
must be explicitly annotated with @Document.

Closes gh-1338
2014-09-07 16:04:04 -05:00
David Liu 8e9e502b6a Add support for auto-configuration of Commons DBCP2
Closes gh-1292
Closes gh-1477
2014-09-07 10:43:48 -05:00
Stephane Nicoll 02a8a9c07b Add auto configuration for Spring AMQP 1.4 features
This commit adds two additional auto-configuration items that are new
in Spring AMQP 1.4:

* A RabbitMessagingTemplate is automatically created if none is present
* A default RabbitListenerContainerFactory is automatically created if
none is present.

Besides @EnableRabbit is enabled automatically if the necessary classes
are present and a ConnectionFactory is available.

Fixes gh-1495
2014-09-05 17:52:07 +02:00
Phillip Webb 84249da941 Add @ConditionalOnBean to Thymeleaf dialect beans
Fixes gh-1507
2014-09-04 17:54:40 -07:00
Spring Buildmaster d63e4b4329 Next development version 2014-09-04 12:15:18 -07:00
Phillip Webb 4d27458fee Replace MongoProperties condition for spring-cloud
Replace @ConditionalOnBean(MongoProperties.class) on
MongoDataAutoConfiguration with @EnableConfigurationProperties since
MongoAutoConfiguration will not be applied in a cloud environment.

Fixes gh-1502
2014-09-04 10:41:32 -07:00
Phillip Webb 8bf1f9567a Apply eclipse formatting and cleanup rules 2014-09-04 09:49:13 -07:00
Andy Wilkinson 8399fc990c Verify that @EnableIntegrationMBeanExport can set custom JMX domain
Add a test to JmxAutoConfigurationTests which verifies that
@EnableIntegrationMBeanExport can be used on a @Configuration class
to customize the default domain used for MBeans created by Spring
Integration. See https://jira.spring.io/browse/SPR-12128.

Closes gh-1451
2014-09-04 16:48:52 +01:00
Phillip Webb 1697174cd8 Remove ExtendedPathMatchingResourcePatternResolver
Remove ExtendedPathMatchingResourcePatternResolver which is not required
with Spring 4.1

Fixes gh-1420
2014-09-03 18:44:02 -07:00
Phillip Webb f7cffce695 Allow custom JNDI ConnectionFactory lookup
Add a `spring.jms.jndi-name` property to allow a JMS ConnectionFactory
to be obtained from a custom JNDI location.

Fixes gh-1471
2014-09-03 18:35:45 -07:00
Phillip Webb 0326abfe01 Support for composed "any" condition
Add `AnyNestedCondition` which can be used to create a logical 'or' of
other conditions contained on nested classes. For example:

	static class OnJndiOrProperty extends AnyNestedCondition {

		@ConditionalOnJndi()
		static class OnJndi {
		}

		@ConditionalOnProperty("something")
		static class OnProperty {
		}

	}

Fixes gh-1490
2014-09-03 17:58:03 -07:00
Phillip Webb 236026a43a Support mixed XA/non-XA ConnectionFactory beans
Update ActiveMQ and HornetQ XA configurations to also expose non-xa
ConnectionFactory variants.

Fixes gh-1461
2014-09-02 13:00:59 -07:00
Phillip Webb ba5c3526da Merge branch '1.1.x' 2014-09-01 17:21:00 -07:00
Phillip Webb 34cbcf5e50 Support better HttpMessageConverters manipulation
Add additional constructor and a protected postProcessConverters method
to make it easier to manipulate the final converter list that will
be used.

Fixes gh-1482
2014-09-01 17:18:51 -07:00
Phillip Webb 5774e808c7 Fix HornetQ ClassNotFound issues when not embedded
Update HornetQConnectionFactoryConfiguration and
HornetQXAConnectionFactoryConfiguration so that they no longer depend
on the HornetQ EmbeddedJMS class. EmbeddedJMS beans are started
(when possible) from the HornetQConnectionFactoryFactory.

Fixes gh-1480
2014-09-01 14:08:52 -07:00
Phillip Webb 4c8d35db43 Rename CompositeDataSourcePoolMetadataProvider
Rename CompositeDataSourcePoolMetadataProvider to
DataSourcePoolMetadataProviders.
2014-09-01 12:38:30 -07:00
Phillip Webb a512bcf766 Always auto-configure pool metadata providers
Import DataSourcePoolMetadataProvidersConfiguration from
DataSourceAutoConfiguration so that PoolMetadataProviders are configured
even if actuator is not used.
2014-09-01 12:38:26 -07:00
Phillip Webb 69107cb1df Create metadata sub-package
Create `org.springframework.boot.autoconfigure.jdbc.metadata` package
and move DataSourcePoolMetadata classes.
2014-09-01 12:29:04 -07:00
Phillip Webb e56be6cf3d DataSourceMetadata -> DataSourcePoolMetadata
Rename DataSourceMetadata to DataSourcePoolMetadata
2014-09-01 12:29:01 -07:00
Phillip Webb e17769fc2f Polish DataSourceMetrics code 2014-09-01 12:27:03 -07:00
Phillip Webb adbded33ff Apply eclipse formatting rules to 3dc932db 2014-09-01 11:42:53 -07:00
Stephane Nicoll 53c4859a6a Reuse data source validation query in health endpoint
This commit improves DataSourceMetadata to expose the validation
query. This can be used by DataSourceHealthIndicator as the query
to use instead of "guessing" which query could be applied according
to the database type.

Fixes gh-1282
2014-08-29 14:58:01 +02:00
Stephane Nicoll 2694941b93 Fix DataSourceMetadata location
This commit complements 3dc932db8 and fix the package location of
DataSourceMetadata.

Fixes gh-1013
2014-08-29 14:35:20 +02:00
Phillip Webb 0143bec831 Polish 2014-08-28 16:58:37 -07:00
David Liu b1ceb8a43b Add database property to RedisProperties
Add database property to RedisProperties and use it in
RedisAutoConfiguration.

Fixes gh-1379
2014-08-28 16:52:01 -07:00
Phillip Webb f8a4df0838 Polish 2014-08-28 12:07:44 -07:00
Stephane Nicoll a0c316d392 Improve RepositoryRestConfiguration customization
This commit binds RepositoryRestConfiguration to the spring.data.rest
prefix so that any of its property can be customized through the
environment.

If a RepositoryRestMvcConfiguration is defined in the context, those
customization do not apply, as it was the case before.

Fixes gh-1171
2014-08-28 16:45:32 +02:00
Phillip Webb ff870de0f0 Fix a few JTA issues
- Search for ConnectionFactories in java:/JmsXA and
  java:/XAConnectionFactory
- Remove javax.transaction:jta managed dependency
- Removed unused JtaProperties argument

Fixes gh-947
2014-08-27 10:09:34 -07:00
Phillip Webb 1024d5d42a Polish 2014-08-27 10:09:34 -07:00
David Liu f4ccaa874a Provide auto-configuration for Gson
Closes #1339
2014-08-27 16:57:21 +01:00
Phillip Webb 239d19d38c Support JNDI for JTA and JMS.
Update auto-configuration for JMS and JTA to support a ConnectionFactory
and TransactionManager exposed via JNDI.

JTA configuration now attempts a simple JtaTransactionManager before
attempting Bitronix or Atomikos configuration.

The JMS auto-configuration also now attempts to find a ConnectionFactory
from JNDI before falling back to the previous strategies. If JNDI is
present a JndiDestinationResolver is also configured instead of the
default DestinationResolver.

See gh-947
2014-08-26 22:34:10 -07:00
Phillip Webb da88bb4791 Update JMS auto-configuration to support XA
Update JMS auto-configuration for ActiveMQ and HornetQ to support XA
transactions.

See gh-947
2014-08-26 22:33:58 -07:00
Phillip Webb 8219f2be4c Update DataSource auto-configuration to support XA
Update DataSource and JPA auto-configuration to consider XA datasources.

See gh-947
2014-08-26 22:33:57 -07:00
Josh Long 5ef136511f Add Atomikos and Bitronix JTA auto-configuration
Add auto-configuration for the Atomikos and Bitronix JTA libraries.

See gh-947
2014-08-26 22:33:51 -07:00
Josh Long 508bd14ad9 Add SpringJtaPlatform for Hibernate
Add SpringJtaPlatform Hibernate AbstractJtaPlatform implementation. Also
relocated SpringNamingStrategy to the `hibernate` sub-package.

See gh-947
2014-08-26 22:33:45 -07:00
Phillip Webb b3ce079ea1 Automatically apply @EnableJMS
Automatically apply @EnableJMS when spring-jms is on the classpath
and the annotation hasn't already been applied. This allow for Spring's
new @JmsListener annotation to just work.

Fixes gh-1425
2014-08-26 14:55:22 -07:00
Phillip Webb a4925dabf7 Add property for JNDI DataSource lookup
Add `spring.datasource.jndi-name` property to allow a DataSource to be
looked up from JNDI as an alternative to defining a URL connection.

Fixes gh-989
2014-08-26 11:44:38 -07:00
Phillip Webb c98713ba95 Inject PlatformTransactionManager bean for JMS
Update JmsAutoConfiguration to inject any PlatformTransactionManager
bean into the DefaultJmsListenerContainerFactory.

Fixes gh-1444
2014-08-26 11:44:27 -07:00
Phillip Webb 5b9d45b231 Inject any existing JMS DestinationResolver bean
Update JmsAutoConfiguration to inject any existing DestinationResolver
bean into JmsTemplate and DefaultJmsListenerContainerFactory.

Fixes gh-1443
2014-08-26 11:44:19 -07:00
Phillip Webb 7a5248e38c Polish 2014-08-26 09:43:27 -07:00
Dave Syer 3404850b2e Merge branch '1.1.x' 2014-08-26 09:19:38 +01:00
Dave Syer 95d65c2ff5 Add indirection to avoid runtime dependency on MVC in templates
Velocity and Freemarker share some common properties so the base class for
configuring their properties makes some sense. Unfortunately the implementation
pulls in Spring MVC at runtime because of the signature of one method (that
would never be called). We can fix that in a number of ways, but the least
disruptive is probably to change the signature of that method and only refer
to the concrete template view resolver type if the method is called.

Fixes gh-1437
2014-08-26 09:19:07 +01:00
Dave Syer 5fd9af23d6 Merge branch '1.1.x' 2014-08-25 17:18:36 +01:00
Dave Syer 607f78a779 Add secure sample with JDBC and data.sql
We can't easily solve the problem by not allowing Spring Security to
eagerly instantiate everything, but we can be defensive about data.sql
and make sure it is executed even if the listener isn't yet registered.

Fixes gh-1386
2014-08-25 17:16:32 +01:00
Phillip Webb 658dc10722 Merge branch '1.1.x' 2014-08-21 22:11:40 -07:00
Phillip Webb d515595ca1 Detect embedded DBs when deducing driver class
Fix DataSourceProperties getUsername() and getPassword() methods to
call getDriverClassName() rather than using `this.driverClassName` to
ensure than deduced driver classes can be used.

Fixes gh-1421
2014-08-21 22:06:01 -07:00
Phillip Webb e6c18a00a1 Polish 2014-08-21 22:03:19 -07:00
Phillip Webb 77bf558307 Relocate configuration prefix constant
Relocate DataSourceAutoConfiguration.CONFIGURATION_PREFIX to
DataSourceProperties.PREFIX.
2014-08-21 21:44:39 -07:00
Phillip Webb 3512f56c0a Polish spaces->tabs 2014-08-21 16:22:54 -07:00
Phillip Webb 059bf3aae1 Use org.hsqldb.jdbc.JDBCDriver HSQLDB Driver
Switch driver class to the more conventionally named
`org.hsqldb.jdbc.JDBCDriver`.
2014-08-21 16:16:48 -07:00
Phillip Webb 49805661f0 Merge branch '1.1.x' 2014-08-21 12:44:02 -07:00
Phillip Webb 650e326ae7 Align MessageSource path search fix with SPR-12095
Update ExtendedPathMatchingResourcePatternResolver to use similar
code as the fix for SPR-12095.

Fixes gh-1378
2014-08-21 12:09:07 -07:00
Dave Syer 171b2e452b Make ServerProperties bean conditional on being a webapp 2014-08-20 09:09:19 +01:00
Phillip Webb 83bd36d8e0 Merge branch '1.1.x'
Conflicts:
	spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java
2014-08-18 13:02:44 -07:00
Phillip Webb eb721b1e9f Find 'messages*.properties' in all jar URLs
Update the the PathMatchingResourcePatternResolver used in the
MessageSourceAutoConfiguration condition to deal with the fact
that `classpath*:` patterns do not work with URLClassLoaders when
the pattern doesn't include a folder.

The ExtendedPathMatchingResourcePatternResolver works by searching
all classpath URLs when the `findAllClassPathResources` method is
called with an empty location.

Fixes gh-1378
2014-08-18 12:58:41 -07:00
Phillip Webb 6e6bc25c44 Polish 2014-08-18 09:57:03 -07:00
Dave Syer 91d3edc220 Tidy imports 2014-08-18 14:57:28 +01:00
Phillip Webb b3ba86390f Relax EntityManagerFactoryBuilder Map generic
Relax the generic signature on EntityManagerFactoryBuilder.properties
so that any object type can be added.

Fixed gh-1376
2014-08-15 11:49:25 -07:00
Phillip Webb ebd0d265f8 Polish 2014-08-15 11:49:13 -07:00
Phillip Webb 8476a79dd2 Add support for RelaxedDataBinder aliases
Update RelaxedDataBinder to support property aliases and change
DataSourceBuilder to use them.

Fixes gh-1384
2014-08-15 10:46:06 -07:00
Phillip Webb 45c8eca4f2 Add @ConditionalOnMissingBean(MongoDbFactory)
Update MongoAutoConfiguration to be conditional on a missing
MongoDbFactory bean. The assumption is that if the user has declared
a MongoDbFactory they will either use it directly, or they will also
register a Mongo bean.

If the MongoDbFactory class cannot be found the existing Mongo
auto-configuration still applies. This ensures that users that do
not have Spring Data can still access a Mongo bean.

Fixes gh-1341
2014-08-14 21:41:10 -07:00
Phillip Webb e0c3dd79f9 Add String type attribute to OnBean conditions
Fixes gh-1381
2014-08-14 21:02:35 -07:00
Ramnivas Laddad 912d5cf40b Add auto-configuration for Spring Cloud
Enable if all of the following are true:
- spring-cloud is on the classpath
- There is no Cloud bean present
  (usually done by extending AbstractCloudConfig)
- The "cloud" profile is active

Fixes gh-1302

Autoconfigure spring-cloud
2014-08-14 20:47:59 -07:00
Phillip Webb 21995cc85d Polish 2014-08-14 20:47:39 -07:00
Dave Syer 300910f7d5 Merge branch '1.1.x' 2014-08-11 17:43:14 -07:00
Dave Syer 0cf1c6f0e5 Refactor AuthenticationManagerConfiguration to make sure it works
if user also adds @EnableWebMvcSecurity. The problem is that the ordering
of the init() and configure() methods in the Spring Security configurers
can force things to happen too early unless we are careful. It's still a bit
twitchy I would say, but this relatively small change seems to fix the GS guide
and not break any existing tests.

I added a sample which mimic ths GS guide so we get an integration test that
executes the new code paths.

Fixes gh-1364
2014-08-11 17:42:30 -07:00
Phillip Webb acb621e84f Polish 2014-08-11 09:04:55 -07:00
Stephane Nicoll d089685935 Add auto configuration for Spring 4.1 JMS features
This commit adds two additional auto-configuration items that are new
in Spring 4.1

* A JmsMessagingTemplate is automatically created if none is present
* A default JmsListenerContainerFactory is automatically created if
  @EnableJms has been triggered and no default has been set manually

Fixes gh-1298
2014-08-11 11:52:24 +02:00
Stephane Nicoll 6217c1b095 polishing 2014-08-08 18:02:35 +02:00
Spring Buildmaster 74d0c5185a Next development version 2014-08-07 11:59:17 -07:00
Dave Syer 178386abc4 Merge branch '1.1.x' 2014-08-06 19:33:57 -07:00
Dave Syer 38f8d65756 Use ApplicationEvent to ensure that authentication event publisher is registered
There was a reference to an old (fixed) issue in Spring which led to some simplification
of the AuthenticationManager layering as well.

Fixes gh-1335
2014-08-06 19:30:27 -07:00
Phillip Webb 13bb23ac5a Merge branch '1.1.x' 2014-08-06 14:17:37 -07:00
Phillip Webb 88828f5097 Use MongoDbFactory to create GridFsTemplate
Update MongoDataAutoConfiguration to use the MongoDbFactory when
creating GridFsTemplate.

Fixes gh-1295
2014-08-06 14:16:18 -07:00
Andy Wilkinson ce02e86b89 Merge branch '1.1.x' 2014-08-06 15:07:33 +01:00
Andy Wilkinson 7d213950ad Never run data.sql scripts if spring.datasource.initialize is false
Previously, the data scripts were always run in response to the
publication of a DataSourceInitializedEvent, irrespective of
spring.datasource.initialize. While the event won't be published by
DataSourceInitializer if spring.datasource.initialize is false, it
will be published if spring.jpa.hibernate.hbm2ddl.auto has been set.

This commit updates DataSourceInitializer's handling of
DataSourceInitializedEvent to only run the data scripts if
spring.datasource.initialize is true.

Fixes #1336
2014-08-06 14:48:26 +01:00
Dave Syer 68582bbac2 Merge branch '1.1.x' 2014-08-04 08:34:49 -07:00
Dave Syer 6c5f8f9581 Add @Inherited to @EnableAutoConfiguration
Fixes gh-1328
2014-08-04 08:34:06 -07:00
Phillip Webb 8e0b3dd00a Rename some ConditionalOnProperty attributes
Rename the newly introduced @ConditionalOnProperty `match` and
`defaultMatch` attributes to `havingValue` and `matchIfMissing`.

Also added a new `name` attribute as an alternative to `value` to
aid readability.

Closes gh-1000
2014-07-29 09:13:58 -07:00
Phillip Webb 6825a7b42e Polish 2014-07-29 09:12:47 -07:00
Oliver Gierke 81cd11b4ec Improved detection of manual Spring Data repository configuration
The presense of store-specific RepositoryConfigurationExtension beans
is used to disable auto-configuration for JPA, Mongo, and Solr

Closes #1267
2014-07-29 15:56:26 +01:00
Max Bruchmann ee40fb8cf1 Add auto-configuration for Thymeleaf data dialect
Closes #1120
2014-07-29 11:12:02 +01:00
Phillip Webb 53d24301d1 Merge branch '1.1.x' 2014-07-28 15:41:42 -07:00
Phillip Webb f8bf0e2031 Polish 2014-07-28 15:40:40 -07:00
Phillip Webb 5e1552b718 Retain default order in HttpMessageConverters
The original fix for gh-1293 (commit 05e6af23) caused test failures due
to the fact that Spring Boot's MappingJackson2HttpMessageConverter was
added before Spring's default StringHttpMessageConverter.

This commit changes the HttpMessageConverters logic so that additional
converts are added just before any default converter of the same type.
This allows additional converters to be added whilst still retaining
the sensible ordering of the default converters.

Fixes gh-1293
2014-07-28 15:40:33 -07:00
Dave Syer 5ce4669055 Merge branch '1.1.x' 2014-07-28 09:32:58 -07:00
Dave Syer 05e6af23cf Prepend without replacing in HttpMessageConverters
It was incorrect to simply replace existing instances because you can't
tell from the instance which media types and java types it supports. This
fix just prepends the custom converters so they get higher priority.

Fixes gh-1293
2014-07-28 09:32:15 -07:00
Andy Wilkinson 0960908bd7 Add support for configuring SSL declaratively
Both Tomcat and Jetty can now be configured to use SSL via the
environment (typically application.properties or application.yml)

Closes #1084
2014-07-24 15:10:09 +01:00
Dave Syer ac2ab39a54 Use class name not value to support non-Hibernate JPA vendors
With this change I got a simple Eclipselink version of the data-jpa
sample working. I'll push that when I get time to research it a bit more
(I needed to set up a Java agent so either that might be a problem
for our integration tests if we can't work around it).

Fixes gh-1268.
2014-07-21 22:25:47 +01:00
Dave Syer 8cb90a5645 Merge branch '1.1.x' 2014-07-17 12:33:22 +01:00
Dave Syer 0c52817c88 Ensure order is preserved in Rabbit addresses
Using StringUtils.commaDelimitedListToSet() does not preserve order (why?),
so we have to use commaDelimitedListToStringArray().

Fixes gh-1262
2014-07-17 12:31:37 +01:00
Stephane Nicoll 120ad56a5c Replace @ConditionalOnExpression
This commit replaces @ConditionalOnExpression instances that are
checking for a specific value to @ConditionalOnPropertyValue
2014-07-17 11:50:13 +02:00
Stephane Nicoll 270809783c Merge @ConditionalOnPropertyValue
This commit merges the features of @ConditionalOnPropertyValue
to the existing @ConditionalOnProperty.

The "match" attribute provides the value to match against. By default,
the value should not be equal to "false" which is the existing default
of @ConditionalOnProperty. "defaultMatch" specifies if the value
should be present. The default matches also the existing behavior of
@ConditionalOnProperty.

Fixes gh-1000
2014-07-17 11:11:42 +02:00
Stephane Nicoll d7d77f3d06 Add OnPropertyValueCondition annotation
This commit adds a new conditional annotation that checks if a
property has a given value. This allows to replace constructs
such as

@ConditionalOnExpression("'${app.myProperty:foo}' == 'foo'")

to

@ConditionalOnPropertyValue(property="app.myProperty",
        value="foo", defaultMatch=true)

Which is definitely more verbose but has the following advantages:

1. Works by default if the actual property in the environment is
   a bit different (i.e. my-property)
2. Works if the value of the property has a diferent case (FoO or
   FOO would match)
3. Gives a precise reporting in the auto configuration report

The defaultMatch flag is meant to mention that the condition should
also match if the value is not set; the auto-config report would
also have an explicit report about it.

Fixes gh-1000
2014-07-16 16:00:43 +02:00
Stephane Nicoll 621b33f7ad Missing setter on spring.batch.job.names property
Relates to gh-1249
2014-07-14 11:36:18 +02:00
Stephane Nicoll 8f886e22ce Use @ConfigurationProperties for Thymeleaf
Add missing properties to complement 6568495

Fixes gh-1250
2014-07-14 11:18:36 +02:00
Stephane Nicoll 65684957ea Use @ConfigurationProperties for Thymeleaf
Fixes gh-1250
2014-07-14 11:08:16 +02:00
Stephane Nicoll 90cf722365 Use @ConfigurationProperties for Spring Batch
Fixes gh-1249
2014-07-14 11:04:21 +02:00
Stephane Nicoll 20e08494ae Fix typo 2014-07-11 16:02:08 +02:00
Stephane Nicoll d01154c212 Move Spring Social and Spring Mobile configuration
This commit uses dedicated Properties classes instead of accessing
the raw environment for Spring Social and Spring Mobile. This
improves the readability and the discovery of such properties.

Fixes gh-1238
2014-07-11 11:02:00 +02:00
Stephane Nicoll 249e09d9bc Switch master to 1.2.0.BUILD-SNAPSHOT 2014-07-11 10:44:05 +02:00
Dave Syer ede385d1b6 Modify @Condition for detecting existing message bundle resource
The problem with the old code is that it worces a ResourceBundle to
initialize with the default encoding (and that is then cached in the
JDK) during @Condition evaluation (so before the encoding is known).

Includes test for swedish messages

Fixes gh-1228
2014-07-10 12:42:02 +01:00
Spring Buildmaster 40327e1ae6 Next development version 2014-07-08 02:33:36 -07:00
Gary Russell ce0cbe05bf Restore AMQP vHost leading `/` support
Update RabbitProperties since vHosts have no restrictions requiring a
leading slash and can have any number of leading slashes.

Fixes gh-1206
2014-07-08 01:33:47 -07:00
Phillip Webb 4ede9cd1be Support websockets with Tomcat 8.0.8
Fixes gh-1210
2014-07-08 00:59:34 -07:00
Andy Wilkinson 6a0eb90007 Upgrade to Spring Batch 3.0.1
Due to a mistake in Spring Batch 3.0.0 it has been necessary to
introduce a breaking API change (the addition of
BatchConfigurer.getJobExplorer()) in the 3.0.1 release. This commit
updates Boot to use 3.0.1 and modifies the Batch auto-configuration
and associated tests to implement the new method.
2014-07-08 00:03:30 -07:00
Dave Syer aa38d33404 Support for setting credentials and vhost in rabbit addresses
User can now add credentials, vhost and protocol prefix (amqp://)
to any or all of the addresses, extending the format beyond that accepted
bu the rabbitmq client, but making it cloud friendly. Only one of
the addresses needs those properties and all are optional. Port
also defaults to 5672 in an address.
2014-07-07 19:56:50 +01:00
Phillip Webb fa88c481a5 Remote trailing whitespace 2014-07-02 15:17:14 -07:00
Toshiaki Maki e306cff4ff Fix typo in FlywayAutoConfiguration's javadoc
Closes #1183
2014-07-01 09:44:22 +01:00
Toshiaki Maki 9febd4a4cb Support sqlScriptEncoding in schema.sql
Fixes gh-1165, fixes gh-1164
2014-06-27 12:55:12 +01:00
Spring Buildmaster 981669b7c0 Next development version 2014-06-26 14:09:54 -07:00
Phillip Webb 200cd535c2 Revert "Next development version"
This reverts commit 67189477fe.
2014-06-26 11:03:09 -07:00
Spring Buildmaster 67189477fe Next development version 2014-06-26 10:51:35 -07:00
Phillip Webb 9632abf825 Formatting and cleanup 2014-06-26 09:41:15 -07:00
Dave Syer c0305ecbbb Take care registering DataSourceInitializer
The DataSourceInitializer is instantiated early by the
DataSourceInitializerPostProcessor, so it has to live in
isolation (in its own @Configuration) to prevent early
instantiation of the DataSourceAutoConfiguration.

Fixes gh-1166
2014-06-26 09:49:44 +01:00
Spring Buildmaster 542f3cbda8 Next development version 2014-06-24 13:53:56 -07:00
Dave Syer b2db3790de Improve test for JobLauncherCommandLineRunner (see gh-1125) 2014-06-24 10:39:28 +01:00
Phillip Webb c713c8091d Polish 2014-06-23 19:41:22 -07:00
Jonas Bergvall 078db8cb74 Separate the configuration/creation of the default ObjectMapper
bean from the registration of Jackson modules to avoid circular creation
of the default ObjectMapper bean (and thus failing to obtain the ObjectMapper
and registering the module(s)).

Fixes gh-1132
2014-06-22 09:57:53 +01:00
Phillip Webb bfe4240ed2 Polish 2014-06-20 10:29:04 -07:00
Phillip Webb 445589a5d2 Polish RabbitMQ Changes
Fix the formatting which was messed up in commit ad1636fd. Also
simplify the RabbitProperties.setVirtualHost logic a little

See gh-1128
2014-06-20 10:29:04 -07:00
Phillip Wirth ad1636fd34 RabbitMQ virtual hosts can how start with a slash
The autoconfig strips out slashes where necessary to make a valid
hostname

Fixes gh-1128
2014-06-20 17:46:54 +01:00
Dave Syer 1e5882b19c Make copy of job parameters before weeding out non-identifying ones
Fixes gh-1125
2014-06-19 18:15:44 +01:00
Dave Syer c6175073ae Be slightly more defensive in DataSource initialization
Adding an Order to the BeanPostProcessor and catching an exception
are enough to get a simple web app with @EnableGlobalMethodSecurity
and JDBC user details running. It actually doesn't solve an underlying
problem in Spring Security, but I'll deal with that separately.

See gh-1115
2014-06-19 14:26:22 +01:00