622 Commits

Author SHA1 Message Date
Phillip Webb
96d479c3d9 Make RequestMappingHandlerMapping @Primary
Update WebMvcAutoConfiguration so that the RequestMappingHandlerMapping
bean is @Primary. Prior to this commit a NoUniqueBeanDefinitionException
would be thrown then using the MvcUriComponentsBuilder.

Fixes gh-2237
2014-12-26 11:42:10 -08:00
Spring Buildmaster
63e6a25097 Next development version 2014-12-10 18:06:30 -08:00
Phillip Webb
fcad7c4fde Guard for null BeanFactory in @ConditionalOnBean
See gh-2080
2014-12-08 09:25:12 -08:00
Andy Wilkinson
3b78aa9493 Make Security auto-config conditional on spring-security-config
SecurityAutoConfiguration, via its import of
AuthenticationManagerConfiguration, requires spring-security-config
to be on the classpath as AuthenticationManagerConfiguration extends
GlobalAuthenticationConfigurerAdapter from spring-security-config.

This commit makes SecurityAutoConfiguration conditional on the
presence of GlobalAuthenticationConfigurerAdapter so that the
auto-configuration will be disabled in its absence rather than causing
an app to fail to start.

Closes gh-2046
2014-12-02 11:18:23 +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
Andy Wilkinson
9270303a9a Remove double “and” from DataSourceInitializer’s javadoc 2014-11-26 10:21:57 +00:00
Andy Wilkinson
863c099161 Add missing copyright headers 2014-11-18 21:29:54 +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
Spring Buildmaster
46b7738334 Next development version 2014-11-11 17:12:24 -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
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
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
e2dd659dd1 Include condition's location (class or method name) in message
Closes gh-1787
2014-10-29 17:51:17 +00:00
Phillip Webb
41b2e58476 Polish 2014-10-21 13:13:39 -07:00
Andy Wilkinson
9a2d654eba Rename test classes so that their tests are run by Maven 2014-10-15 16:35:48 +01:00
Andy Wilkinson
fff94733ef Rename class so Maven runs its tests
Maven is configured to run tests found in classes ending in Tests.
This meant that the tests in BasicErrorControllerIntegrationTest (note
the missing s) were not being run.

This commit renames the test class so that it's picked up by Maven.
2014-10-15 16:05:25 +01:00
Dave Syer
ecee19057c Add some precautionary tests for documenting AuthenticationManager config 2014-10-15 11:31:44 +01:00
Spring Buildmaster
3e71a21b30 Next development version 2014-10-10 15:19:47 -07:00
Phillip Webb
6009f41782 Polish 2014-10-09 12:58:55 -07:00
Dave Syer
3135c7f8ae Escape strings in whitelabel error page (HTML) 2014-10-09 16:10:57 +01:00
Phillip Webb
d0990c06a6 Fix typo in HttpMessageConverters auto-conf Tests 2014-09-25 22:03:30 -07:00
Spring Buildmaster
edb4b7ed7d Next development version 2014-09-25 21:02:37 -07:00
Phillip Webb
bff39e954e Add server.tomcat.port-header support
Update Tomcat ServerProperties to support the RemoteIpValve portHeader
property.

Fixes gh-1616
2014-09-25 13:04:12 -07:00
Phillip Webb
0dc46a2fe7 Drop protocolHeader and remoteIpHeader defaults
The `protocolHeader` and `remoteIpHeader` no longer have default values
and must be opt-in.

Fixes gh-1624
2014-09-25 12:58:23 -07:00
Phillip Webb
258059ea08 Fix failing ThymeleafAutoConfigurationTests
Remove accidental addition of a 1.2 test.
2014-09-25 10:27:05 -07:00
Dave Syer
304920df07 Make Thymeleaf @ConditionalOnWebApplication
If user creates a Thymeleaf app with a parent-child context then the
child should contain all the web-specific pieces (and they are likely
to fail fast if they need to be ServletContextAware, or slower if they
try to locate a WebApplicationContext at runtime). This can't happen
if the view resolver is being added to the parent.

Freemarker and Velocity already have similar tests because it is assumed
that they should be usable outside a web app, so this change just does the
same for Thymeleaf.

Fixes gh-1611
2014-09-25 09:54:50 -07:00
Phillip Webb
0b50fe4eff Support String to char[] bindings
Update RelaxedConversionService to also support String to char[]
conversion. Primarily to support the `password` field in
MongoProperties.

Fixes gh-1572
2014-09-24 16:03:51 -07:00
Andy Wilkinson
cf22e28ddc Add tests to verify that ActiveMQAutoConfiguration backs off
See gh-1599
2014-09-23 10:11:26 +01:00
Tomas Lin
38d8a5cda0 Fix typo in comment
Closes gh-1596
2014-09-23 09:42:03 +01:00
Phillip Webb
468db03aef Formatting 2014-09-19 22:41:10 -07:00
Dave Syer
d6165d97dd A few tweaks that might improve performance on startup
... or couldn't hurt anyway.

1. Extends the definition of a web application for @ConditionalOnWebapp
so that a StandardEnvironment can be used (cutting out JNDI failures
for Environment properties)

2. Doesn't bother using StandardServletEnvironment in integration tests

3. Make the NON_ENUMERABLE_ENUMERABLES in PropertySourcesPropertyValues
static so they only get initialized once (not a huge issue at all)
2014-09-19 16:11:10 +01:00
Andy Wilkinson
6dcaec2fef Make all @Bean methods public
This is a continuation of the changes made in 611f978. It makes some
more @Bean methods public and adds tests to spring-boot-actuator and
spring-boot-autoconfigure to prevent against non-public methods being
introduced in the future

Closes gh-1571
2014-09-17 19:39:39 +01:00
Phillip Webb
611f978181 Make all @Bean methods public
Fixes gh-1571
2014-09-17 10:45:23 -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
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
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
468b6cb1f7 Add support for configuring RemoteIpValve’s internalProxies
Closes gh-1522
2014-09-16 15:40:18 +01:00
Phillip Webb
5ba86a103d Polish 2014-09-15 11:35:16 -07: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
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
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
Spring Buildmaster
d63e4b4329 Next development version 2014-09-04 12:15:18 -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
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
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