Commit Graph

890 Commits

Author SHA1 Message Date
Stephane Nicoll 65e9d6a6e0 Add property description
Set the field javadoc of many properties that are managed via
configuration so that the "description" field is available in the
meta-data.

Closes gh-1808
2014-11-27 14:23:27 +01:00
Andy Wilkinson 40a7445fec Merge branch '1.1.x' 2014-11-26 17:51:56 +00:00
Andy Wilkinson 64599261a5 Allow mongo port, host, and credentials to be configured individually
Previously, the host had to have a custom value for the configuration
of the port or credentials (username and password) to take effect. This
meant, for example, that you couldn’t just set the port or just set the
username and password while using the default host.

This commit allows the port or username and password to be configured
without also configuring the host. The default host (localhost) and
port (27017) are retained.

Fixes gh-2008
2014-11-26 17:34:21 +00:00
Oliver Gierke 123b90fa64 Register all packages where @EnableAutoConfiguration is used
Previously, when @EnableAutoConfiguration was used in multiple packages,
the last @EnableAutoConfiguration that was processed would
win and only its package would be stored as an auto-configuration
package.

This commit updates AutoConfigurationPackages to allow multiple package
name registrations. AutoConfigurationPackages.set(…) has been altered to
augment the constructor arguments of the BeanDefinition registered for
the initial call to the method so that the packages handed to the method
call will be added to the bean definition and not replace the previous
ones. The method has been renamed register(…) to reflect the changed
behavior.

Closes gh-1994
2014-11-26 11:21:58 +00:00
Andy Wilkinson d5b7f49f83 Merge branch '1.1.x' 2014-11-26 10:22:06 +00:00
Andy Wilkinson 9270303a9a Remove double “and” from DataSourceInitializer’s javadoc 2014-11-26 10:21:57 +00:00
Andy Wilkinson d5ad502d31 Disable Undertow auto-config if required XNIO classes are unavailable
Fixes gh-1986
2014-11-24 10:46:11 +00:00
Dave Syer 9f7bd0cddc Inject ResourceConfig instance (not class) into Jersey
If you inject the class (via a servlet parameter) it seems that
Jersey tries to create all the beans for you (and fails). I thought
it was supposed to work (according to the docs), so I'm a bit confused
but the sample now has Spring DI and the tests pass.

Fixes gh-1981
2014-11-22 17:17:53 +00:00
Phillip Webb 2a9a749329 Polish 2014-11-21 13:27:19 -08:00
Dave Syer 5b044356dc Clarify the deprecation status of HttpMapperProperties 2014-11-21 09:19:32 +00:00
Phillip Webb 70a1438c6f Don't replace MappingJackson2HttpMessageConverter
Guard against Spring Data REST TypeConstrained Jackson converters
replacing the default MappingJackson2HttpMessageConverter.

Fixes gh-1968
2014-11-20 17:36:55 -08:00
Phillip Webb bf0629522c Only use Gson if Jackson is missing
Update HttpMessageConvertersAutoConfiguration to only register Gson
support when Jackson is not on the classpath.

Fixes gh-1967
2014-11-20 17:21:25 -08:00
Phillip Webb 2b57c5a4dd Rename spring.data.mongo.repositories.enabled
Rename mongo to mongodb.

Fixes gh-1966
2014-11-20 14:57:49 -08:00
Phillip Webb 670ba33bec Improve MongoDataAutoConfiguration
Update MongoDataAutoConfiguration to provide easier configuration of
CustomConversions, the MappingMongoConverter, MongoMappingContext
and an authentication database.

Fixes gh-1619
Fixes gh-1730
2014-11-20 14:55:19 -08:00
Phillip Webb 2a8579026f Polish 2014-11-20 10:16:33 -08:00
Stephane Nicoll 11894a5412 Fix manual metadata format inconsistency
Fixes gh-1961
2014-11-20 13:58:39 +01:00
Dave Syer 12a7df6c40 Be defensive about classloader in MessageSourceAutoConfiguration
Fixes gh-1960
2014-11-20 12:29:16 +00:00
juzer 428d2caac1 Fixed potential ClassCastException getting error
Update DefaultErrorAttributes to expect a `Throwable` ERROR_ATTRIBUTE
rather than an `Exception`.

Fixes gh-1931
2014-11-19 13:36:57 -08:00
Phillip Webb c34cfb27a3 Polish 2014-11-19 10:52:26 -08:00
Phillip Webb 3a4d62fb3a Gracefully ignore placeholder exceptions
Update BeanTypeRegistry to gracefully ignore LoadBeanClassException and
BeanDefinitionStoreException exceptions in the same way as
DefaultListableBeanFactory.doGetBeanNamesForType() does.

Fixes gh-1955
2014-11-19 09:59:14 -08:00
Dave Syer 7fa0ea7c3b Add support for spring.jersey.type=filter
Fixes gh-1756
2014-11-19 16:51:55 +00:00
Dave Syer 3a4f1f6f39 Attempt to get Jersey working as filter 2014-11-19 15:57:31 +00:00
Andy Wilkinson 90af8bf54a Add auto-configuration for Jetty 9's WebSocket support
Closes gh-1269
2014-11-19 14:44:54 +00:00
Phillip Webb b583262211 Use SmartInitializingSingleton when possible
Switch implementations of ApplicationListener<ContextRefreshEvent> for
SmartInitializingSingleton when possible.

Fixes gh-1939
2014-11-18 13:50:49 -08:00
Andy Wilkinson 7a783f5a18 Merge branch '1.1.x' 2014-11-18 21:31:19 +00:00
Andy Wilkinson 863c099161 Add missing copyright headers 2014-11-18 21:29:54 +00:00
Andy Wilkinson 1864d79077 Polish Undertow contribution
Closes gh-1779
2014-11-18 21:20:34 +00:00
sopov.ivan c501b889af Add support for using Undertow as an embedded container
See gh-1779
2014-11-18 21:20:34 +00:00
Andy Wilkinson f43d6925c5 Apply spring.jackson.* config to HypermediaAutoConfiguration’s ObjectMapper
Previously, HypermediaAutoConfiguration would trigger the creation of
an ObjectMapper bean named _halObjectMapper. This bean did not have the
spring.jackson.* configuration applied to it, however its presence
would revent JacksonAutoConfiguration from creating its
ObjectMapper. This left the user with an ObjectMapper that did not
honour the spring.jackson.* configuration.

This commit updates HypermediaAutoConfiguration to use the
Jackson2ObjectMapperBuilder that may have been created by
JacksonAutoConfiguration. If the builder exists it is used to configure
the _halObjectMapper bean.

Fixes gh-1949
2014-11-18 15:51:30 +00:00
Andy Wilkinson 35b7ba5cda Deprecate http.mappers.* properties
The http.mappers.* configuration properties assumed that the mapping
was JSON (on of the property names was jsonPrettyPrint) and also only
exposed a small subset of the configuration options supported by
Jackson (and GSON). The property names implied that it would configure
all HTTP mapping, however it was ignored by GsonAutoConfiguration.

This commit deprecates the support for http.mappers.* in favour of
configuring Jackson or Gson instead. Jackson can be configured
declaratively using the spring.jackson.* properties or programtically.
Gson can be configured programatically by using a GsonBuilder to
create a Gson instance with the desired configuration.
gh-1946 has been opened to add support for declarative configuration
of Gson.

Closes gh-1945
2014-11-18 13:51:48 +00:00
Andy Wilkinson 6cfd6cad64 Merge branch '1.1.x' 2014-11-18 13:16:45 +00:00
Andy Wilkinson 9eae29938c Test that http.mappers props are applied by JacksonAutoConfiguration
Closes gh-1919
2014-11-18 11:47:29 +00:00
Nicolás J. García f51b304c2a Update JackonAutoConfiguration to apply all http.mappers properties
Previously, only the http.mappers.json-sort-keys property was applied
by JacksonAutoConfiguration. This commit updates it to also apply the
http.mappers.json-pretty-print property as well.

See #1919
2014-11-18 11:40:29 +00:00
Andy Wilkinson b8d6b34038 Test that HttpMapper properties are only used when they’re defined
Closes gh-1923
2014-11-18 11:17:07 +00:00
Sebastien Deleuze c053540b03 Use HttpMapper properties only if defined
See gh-1923
2014-11-18 11:16:04 +00:00
Andy Wilkinson 05cf686713 Allow servlet context parmeters to be configured via declaratively
Previously, configuration of a ServletContext init parameter required
the use of a ServletContextInitializer bean. This commmit adds
support for declarative configuration via the environment using
server.context_parameters.<name>=<value>.

Closes gh-1791
2014-11-17 20:20:08 +00:00
Stephane Nicoll 16e2130896 Add missing properties metadata
Fixes gh-1829
2014-11-17 15:58:08 +01:00
Stephane Nicoll fba69821cc Fix typo 2014-11-17 14:45:13 +01:00
Spring Buildmaster 46b7738334 Next development version 2014-11-11 17:12:24 -08:00
Stephane Nicoll 630c145645 Fix order of JMS auto configuration
Add additional @AutoConfigureAfter elements to ActiveMQAutoConfiguration
and HornetQAutoConfiguration to ensure that they are configured after
JndiConnectionFactoryAutoConfiguration.

The possible sources for a JMS ConnectionFactory are:

1. JNDI
2. HornetQ (embedded broker or an external broker)
3. ActiveMQ (embedded broker or an external broker)

The last two auto configurations must run after JTA auto-configuration
has completed as it may register additional beans that are necessary to
enable XA.

Previously, the HornetQ embedded broker would start regardless of the
presence of a ConnectionFactory as a ConditionalOnMissingBean was
missing. Furthermore, there was no order condition for the JNDI
auto-configuration so it may just run after one of the broker has been
found.

JNDI takes now precedence to be consistent with the regular DataSource
auto configuration.

Fixes gh-1821
2014-11-11 15:32:47 -08:00
Phillip Webb 8cac63e239 Drop hibernate-jpa-2.0-api managed dependency
Fixes gh-1898
2014-11-11 13:03:25 -08:00
Phillip Webb b947d6001d Polish 2014-11-11 09:47:54 -08:00
Andy Wilkinson f9221e24ef Polish method name in HibernateJpaAutoConfiguration 2014-11-11 12:37:34 +00:00
Stephane Nicoll 109c3a3439 Auto configure CharacterEncodingFilter
Provide a default UTF-8 encoding for HTTP requests and responses unless
specified otherwise.

Fixes gh-1182
2014-11-11 12:01:15 +01:00
Phillip Webb 143a62b6bf Polish 2014-11-10 23:03:15 -08:00
Phillip Webb 3e1841a53b Remove JpaBaseConfiguration.configure() method
Remove the JpaBaseConfiguration.configure() method since it is no
longer called.

Fixes gh-1865
2014-11-10 21:53:24 -08:00
Phillip Webb 5811f6e3f5 Merge branch '1.1.x' 2014-11-10 19:01:59 -08:00
Phillip Webb 4f67a20214 Ensure JpaUserDetailsTests closes embedded DB
Fixes gh-1712
2014-11-10 18:43:46 -08:00
Phillip Webb b79934a7a4 Detect existing MultipartResolver beans
Update MultipartAutoConfiguration to detect any MultipartResolver beans
rather than just StandardServletMultipartResolvers.

Fixes gh-1857
2014-11-10 17:21:21 -08:00
Phillip Webb 8023ddd0c2 Rename AbstractBasicTemplateViewResolverProperties
Rename AbstractBasicTemplateViewResolverProperties to
AbstractViewResolverProperties.

See gh-1835
2014-11-07 09:24:07 -08:00
Stephane Nicoll 6d9abdc8ca Harmonize view resolver properties
Move shared properties to avoid duplication in GroovyProperties

Fixes gh-1835
2014-11-07 13:19:40 +00:00
Phillip Webb e76a571dd3 Add @SpringBootApplication annotation
Add a new @SpringBootApplication which is equivalent to @Configuration,
@EnableAutoConfiguration and @ComponentScan.

See gh-1842
2014-11-06 22:49:10 -08:00
Phillip Webb 96a031cf20 Default spring.datasource.jmx-enabled to false
Change the default value of spring.datasource.jmx-enabled to false
to prevent InstanceAlreadyExistsException problems when using the
Spring Test Framework.

Fixes gh-1590
2014-11-06 21:38:07 -08:00
Phillip Webb 58d660d10d Allow DAO ExceptionTranslator to proxy classes
Update the auto-configured PersistenceExceptionTranslationPostProcessor
to proxy target classes as well as interfaces. Also provide a config
property to disable registration all together.

Fixes gh-1844
2014-11-06 19:13:50 -08:00
Michael Cramer f966b3b1b7 Provide Liquibase -> Commons Logging adapter
Add `CommonsLoggingLiquibaseLogger` implementation to adapt Liquibase's
`Logger` to Apache Commons Logging.

The `LiquibaseAutoConfiguration` class has also been updated to
automatically use the adapter

Fixes gh-1840
2014-11-06 13:26:06 -08:00
Phillip Webb ba0dd60de9 Rename charSet to charset
Rename AbstractTemplateViewResolverProperties.setCharSet/getCharSet to
setCharset/getCharset, deprecating the old method.

Fixes gh-1835
2014-11-05 16:57:05 -08:00
Phillip Webb b6bacd5e8a Upgrade to Servlet 3.1, Tomcat 8 and Jetty 9
Upgrade to latest versions of Tomcat and Jetty and to the latest Servlet
API whilst will remaining compatible with Tomcat 7 and Jetty 8.

Fixes gh-1832, gh-369
2014-11-05 16:35:34 -08:00
Phillip Webb edaed415fb Polish 2014-11-04 09:09:26 -08:00
Stephane Nicoll 9dec27e7bf Permit to disable JTA using a single property
Disable JTA auto-configuration altogether with a simple property. This
can be useful if the environment is JTA capable but the application does
not require it.

Fixes gh-1457
2014-11-04 16:53:54 +01:00
Stephane Nicoll 814803046a polishing 2014-11-04 16:31:37 +01:00
Stephane Nicoll 47cd9e0765 Fix ConditionalOnJndi evaluation
Enable ConditionalOnJndi evaluation and add tests that validate it works
as expected

Fixes gh-1820
2014-11-04 15:42:30 +01:00
Stephane Nicoll cbd3c39640 Override StringHttpMessageConverter with UTF-8
Override the default StringHttpMessageConverter provided by the standard
Spring MVC configuration so that is uses UTF-8 instead of the aging
default of the servlet spec (that is ISO-8859-1)

Fixes gh-1800
2014-11-04 13:12:19 +01:00
Phillip Webb 43c07e8b44 Protect against duplicate datasource MBeans
See gh-1590
2014-11-03 18:49:27 -08:00
Phillip Webb a973fd41f4 Polish 2014-11-03 18:49:20 -08:00
Dave Syer f304d46955 Add JMX MBean for Tomcat DataSource
If the DataSource is a Tomcat one we force it to register an MBean
if spring.jmx.enabled=true

Fixes gh-1590
2014-11-03 13:38:05 +00:00
Dave Syer 3e97cdbc3b Trim some fat from groovy templates
The old resolver class is deprecated already, and there's no reason
to continue to support the View and View resolver implementations
from Boot 1.1, so I removed those. Also there is no need to support
older versions of Groovy, so I removed a config class that was
conditional on a groovy version (by looking for the markup support).

Fixes gh-1578
2014-11-03 09:59:25 +00:00
Brian Clozel 18b8929335 Migrate to groovy templates from Spring 4.1
Update `GroovyTemplateAutoConfiguration` to use Spring 4.1 Groovy
Markup Template infrastructure instead of Boot's.

Fixes gh-1552
2014-11-03 09:59:25 +00:00
Stephane Nicoll a46396f691 Add @NestedConfigurationProperty meta-data support
Add a @NestedConfigurationProperty annotation which can be used to
customize how configuration mete-data is generated.

Prior to this commit only inner-classes where considered nested
(see Tomcat in ServerProperties). Using this new annotation, the Ssl
property in ServerProperties can be detected as well.

See gh-1001
2014-11-02 21:46:36 -08:00
Stephane Nicoll fbf8f56a97 Generate standard configuration meta-data
Update the `spring-boot`, `spring-boot-autoconfigure` and
`spring-boot-actuator` project to generate configuration meta-data
files during compilation.

See gh-1001
2014-11-02 21:46:36 -08:00
Phillip Webb 45b579c439 Improve OnBeanCondition Performance
Update OnBeanCondition to use a new BeanTypeRegistry which includes
optimized code when using a DefaultListableBeanFactory. The optimized
version calculates bean types only once per bean and caches the result.

Prior to this change the sample "pet clinic" application would spend
400-500 milliseconds evaluating OnBeanConditions, after this change it
spends around 120 milliseconds.

Fixes gh-1803
2014-11-02 13:55:06 -08:00
Phillip Webb a490aef888 Merge remote-tracking branch 'springsource/1.1.x'
Conflicts:
	spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java
2014-11-01 19:47:47 -07:00
Phillip Webb 8ba71c88f5 Polish 2014-11-01 19:46:04 -07:00
Dave Syer b20d02a31d Make a lazy AuthenticationManager if we think it's already configured
Instead of just blindly creating the default authentication manager, after
thic change we count the beans of type GlobalAuthenticationManagerConfigurer
and assume that if we detect more than we expect (one from Boot and one from
Spring Security) then the user is telling us they want to configure the
AuthenticationManager themselves.

Fixes gh-1801
2014-11-01 18:10:27 +00:00
Phillip Webb 8e16dfc951 Polish 2014-11-01 08:20:12 -07:00
Dave Syer f15cb7a720 Add tests for AuthenticationManager injected into security configurer
See gh-1801
2014-11-01 08:58:46 +00:00
Andy Wilkinson 36ffad2bb7 Merge branch '1.1.x' 2014-10-30 15:21:55 +00:00
Andy Wilkinson 0f17142366 Make GroovyWebConfiguration conditional on spring-webmvc's availability
GroovyWebConfiguration creates a GroovyTemplateViewResolver which is
a UrlBasedViewResolver sub-class. UrlBasedViewResolver is provided
by spring-webmvc. Previously, if a user configured a web application
but did not have spring-webmvc on the classpath, the application
would fail to start with a NoClassDefFoundError for
UrlBasedViewResolver.

This commit makes GroovyWebConfiguration conditional on
UrlBasedViewResolver being on the classpath so that it backs of in
the absence of spring-webmvc.

Fixes gh-1793
2014-10-30 15:18:39 +00:00
Andy Wilkinson 0cdb1d3f22 Make Spring Security's filter's order configurable and default to zero
Previously, Spring Security's filter had no configured order. Due to
the use of AnnotationAwareOrderComparater this meant that its order
defaulted to LOWEST_PRECEDENCE. This meant that a user had to declare
a FilterRegistrationBean for the filter and explicitly set its order
if they want another filter to run after Spring Security's.

This commit updates the security auto-configuration to assign a
default order of zero to Spring Security's filter, allowing filters
to be easily configured to run before it or after it. This default
value can overridden using the server.filter-order property. The
default order is also exposed as a constant on SecurityProperties,
allowing it to be referenced from other filter declarations.

Closes gh-1640
2014-10-30 14:11:45 +00:00
Phillip Webb d17b7c8195 Polish 2014-10-29 12:08:37 -07:00
Andy Wilkinson 466ed469eb Merge branch '1.1.x' 2014-10-29 17:52:30 +00:00
Andy Wilkinson e2dd659dd1 Include condition's location (class or method name) in message
Closes gh-1787
2014-10-29 17:51:17 +00:00
Andy Wilkinson 8a1e010d0a Allow multiple templateLoaderPaths to be configured for FreeMarker
Closes gh-1767
2014-10-29 17:42:48 +00:00
Andy Wilkinson ef2455938e Align new JavaMail dependencies with Spring IO Platform
Spring IO Platform already provides dependency management for JavaMail.
This commit updates Boot’s new JavaMail dependency management to align
with the Platform, thereby allowing the Platform to inherit Boot’s
dependency management instead of defining its own.
2014-10-29 17:05:48 +00:00
Stephane Nicoll 429da743f5 Add missing close 2014-10-29 15:44:53 +01:00
Stephane Nicoll ccc5e65779 Add email support
This commit adds a new starter to auto-configure a MailSender when the
necessary classes are present and when the property "spring.mail.host" is
set.

The auto-configuration also accepts any arbitrary properties that
JavaMail might need using the "spring.mail.properties" prefix.

Fixes gh-1760
2014-10-29 15:39:05 +01:00
Sebastien Deleuze 7546f10aad Fix a typo in error.whitelabel.enabled 2014-10-29 08:56:12 +01:00
Dave Syer 015377f9de Exclude log4j in a couple of places (see gh-1660)
also rename spring-cloud starter
2014-10-28 15:57:14 +00:00
Andy Wilkinson cebfd44d16 Upgrade to Spring AMQP 1.4.0.RC1 2014-10-28 13:49:52 +00:00
Dave Syer f39d4978c3 Fix tests for JSON error rendering
See gh-1762
2014-10-27 15:06:32 +00:00
Dave Syer 254ab55476 Re-arrange priority of error message 2014-10-27 11:08:53 +00:00
Dave Syer 7bac7370c8 Use request attribute if available for error message
Fixes gh-1762, gh-1731
2014-10-27 10:50:10 +00:00
Phillip Webb 2e7aa4685b Polish 2014-10-21 20:34:00 -07:00
Phillip Webb d1ce83e3c3 Merge branch '1.1.x' 2014-10-21 13:14:50 -07:00
Phillip Webb 41b2e58476 Polish 2014-10-21 13:13:39 -07:00
Stephane Nicoll d2198c417d Fix ConnectionFactory auto-configuration with XA
Previously, the regular jms connection factory was always overriding
the xaConnectionFactory when using ActiveMQ. While
ActiveMQAutoConfiguration is namely shielded with a condition on a
missing ConnectionFactory bean, said configuration class also imports the
XA and regular configuration classes that both can create the connection
factory.

This commit adds a ConditionalOnMissingBean in the second class that is
imported in case the XA configuration has already defined what it needs.

Fixes gh-1727
2014-10-21 18:28:26 +02:00
Andy Wilkinson 31874090b8 Fix ArrayStoreException caused by JerseyAutoConfiguration again
This is a follow-on from the changes made in 2b7bf3e. In addition to the
problematic use of @ConditionalOnClass that was addressed in 2b7bf3e,
JerseyAutoConfiguration also used @ConditionalOnBean referencing a 
Jersey class. This has the same problem when used on a class that
implements WebApplicationInitializer. Implementing
WebApplicationInitializer causes the class’s annotations to be
introspected during servlet container initialiser processing. If a
@ConditionalOnBean annotation references a Class that cannot be
loaded an ArrayStoreException occurs.

This commit updates JerseyAutoConfiguration to reference ResourceConfig
as a String. This allows it annotations to be introspected without
attempting to load a Jersey class that may not be on the classpath.

Fixes gh-1733
Fixes gh-1719
2014-10-20 10:14:53 +01:00
Brett Wooldridge 9984939c47 Update HikariCP to 2.1.0, compile against the Java 6-compatible artifact
For those running applications on Java 8, dependency management for the
Java 8-compatible artifact is also provided.

Closes gh-1721
2014-10-16 15:21:57 +01:00
Andy Wilkinson 01fd8cb8f3 Reinstate Bitronix's default server ID, provide property to override it
Previously, Bitronix's server ID was hard-coded to be
spring-boot-jta-bitronix. This created the possibility of multiple
transaction managers performing recovery on each other's behalf as
they would be unable to identify their own XIDs due to the common
server ID.

This commit reinstates the default (which is the IP address of the
machine on which Bitronix is running), and introduces a new
property, spring.jta.transaction-manager-id, that can be used to
configure the id for both Atomikos and Bitronix. A cautionary note
has also been added to the documentation for Atomikos and Bitronix
explaining the need to configure this property.

Closes gh-1548
2014-10-16 09:44:42 +01:00
Andy Wilkinson 261b3afca1 Apply spring.jackson.* config to Spring Data REST object mappers
Closes gh-1698
2014-10-15 16:57:06 +01:00
Andy Wilkinson 9a2d654eba Rename test classes so that their tests are run by Maven 2014-10-15 16:35:48 +01:00