Commit Graph

1037 Commits

Author SHA1 Message Date
Phillip Webb
c71aa32fbb Polish 2016-01-21 10:53:25 -08:00
Phillip Webb
af36bf6864 Remove TODO in FlywayAutoConfiguration
Now tracked by gh-4995
2016-01-21 10:42:33 -08:00
Stephane Nicoll
58ebfdcbd3 Polish contribution
Closes gh-4973
2016-01-21 14:10:35 +01:00
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
2016-01-21 14:08:39 +01:00
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
2016-01-15 11:19:24 +00:00
Andy Wilkinson
b99739212a Correct the name of MySQL's XADataSource implementation
Closes gh-4942
2016-01-14 15:53:00 +00:00
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
2015-12-28 13:49:12 +01:00
Stephane Nicoll
bb736e255b Fix SNAPSHOT version 2015-12-17 14:15:14 +01:00
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
2015-12-14 18:49:59 +00:00
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
2015-12-14 16:49:18 +00:00
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
2015-12-10 13:40:16 +00:00
Phillip Webb
9432ee6a6b Polish 2015-11-05 00:19:58 -08:00
Dave Syer
124574e345 Add mediaTypes (extension to media type mapping) in MVC resources
Allows users to configure "allowed" file extensions for controller
mappings, so that browsers will not switch to downloading "f.txt"
(part of the recent RFD attack fixes in Spring MVC).

See gh-4220
2015-11-05 08:10:07 +01:00
Phillip Webb
cfbac20807 Ensure ErrorControllers work when using AOP
Add a BeanFactoryPostProcessor to set PRESERVE_TARGET_CLASS_ATTRIBUTE
to true on all ErrorController bean definitions. Without this attribute
AOP advice on @Controllers causes ErrorController beans to be created
as JDK proxies (since they implement a single valid looking interface)
and therefore not get found by Spring MVC.

Fixes gh-4236
2015-10-20 13:42:38 -07:00
Phillip Webb
a79131f8d2 Organize imports with new settings
See gh-4234
2015-10-19 12:55:44 -07:00
Spring Buildmaster
2b38a861e3 Next Development Version 2015-10-16 05:57:24 -07:00
Andy Wilkinson
c236db04ef Ignore parent contexts in message source auto-configuration
This commit applies the changes made in 68b55ad to 1.2.x (it was
originally only made in 1.0.x and master). It also adds some tests.

Closes gh-3803
2015-10-16 11:07:39 +01:00
Phillip Webb
94736719f1 Reformat package-info.java files with Eclipse Mars 2015-10-09 13:32:57 -07:00
Phillip Webb
6ab376e2e8 Reformat code use Eclipse Mars 2015-10-07 23:32:31 -07:00
Andy Wilkinson
a94f3a0cbf Only try to auto-configure Jetty when jetty-webapp is on the classpath
Closes gh-4089
2015-10-05 11:41:23 +01:00
Phillip Webb
87a515f6a0 Fix TemplateAvailabilityProvider binding issues
Update all TemplateAvailabilityProvider implementations to use the
relaxed property binder. Also fix FreeMarkerTemplateAvailabilityProvider
to use `template-loader-path` rather than `path`.

Fixes gh-4085
2015-10-02 15:39:43 -07:00
Phillip Webb
891faa9d35 Fix test cleanup to reset commons logging 2015-10-02 15:04:04 -07:00
Stephane Nicoll
8978f54cc3 Use spring.velocity.charset for template encoding
Previously `spring.velocity.charset` only controlled the output encoding
with the templates being loaded with the default encoding. We now
consistently set the same value for both the input and output encodings.

It is still possible to override it to a different value using
`spring.velocity.properties.input.encoding`

Closes gh-3994
2015-10-02 16:12:42 +02:00
Spring Buildmaster
9409c49c10 Next development version 2015-09-16 09:00:17 -07:00
Pei-Tang Huang
a5430d8a0c Catch more general Hibernate 4.2 LinkageError
Update HibernateJpaAutoConfiguration to catch LinkageError rather than
NoClassDefFoundError. Required due to the fact that JBoss EAP 6 wraps
NoClassDefFoundErrors.

Fixes gh-3605
2015-09-10 14:58:26 -07:00
Phillip Webb
b7e9f805c9 Set ignoreUnknownFields=true on ServerProperties
Update ServerProperties so that unknown SERVER_* environment properties
do not cause startup failures.

Fixes gh-3903
2015-09-10 14:49:41 -07:00
Phillip Webb
15686ed4fd Reformat code 2015-09-08 14:07:06 -07:00
Phillip Webb
0f6b60d8c8 Organize imports 2015-09-08 14:05:00 -07:00
Barry Lagerweij
8d75aa0ea9 Fix Oracle XA datasource class name
Closes gh-3846
2015-09-02 16:44:29 +02:00
Andy Wilkinson
a2f4c1cc4a Add support for configuring allowSessionOverride via the environment
This commit adds support for using the environment to configure the
Freemarker and Velocity view resolvers to allow session overrides.

Closes gh-3410
2015-08-10 16:58:17 +01:00
Andy Wilkinson
905346d0cd Consider @Bean methods with args to determine type created by factory
Previously, BeanTypeRegistry would only look for a @Bean method
with no arguments when trying to determine the type that will be
created by a factory bean. This meant that the type produced by a
factory bean declared via a @Bean that has one or more arguments would
be unknown and any on missing bean conditions look for a bean of the
type produced by the factory bean would match in error.

This commit updates BeanTypeRegistry to, where possible, use the
factory method metadata for the bean definition when determining the
type that will be created. This allows it to determine the type for
factory bean created by @Bean methods that take arguments and also
avoids the use reflection to find the factory method. Where factory
method metadata is not available, the existing reflection-based
approach is used as a fallback.

Closes gh-3657
2015-08-04 11:34:53 +01:00
Pei-Tang Huang
3953baba81 Add SQLServer XA DataSource class name
Closes gh-3604
2015-07-27 14:58:10 +02:00
Dave Syer
ff79138aa5 Alternative fix for Rabbit listener transactions
Never inject a transaction manager (user can create his own
"rabbitListenerContainerFactory" bean if he wants an actual
non-JTA transaction manager.

See gh-3432
2015-07-13 15:00:40 +01:00
Dave Syer
67933ab01f Add boolean flag spring.rabbit.listener.useTransactionManager
If set *and* there is a transaction manager in the context, then the
listener container created by Spring Boot will use the transaction
manager to execute the listeners.

Fixes gh-3432 (by virtue of not requiring a JtaTransactionManager any
more).
2015-07-13 14:21:18 +01:00
Phillip Webb
7da808918f Fix Flyway and Liquibase JPA 'depends-on' setup
Ensure that FlywayAutoConfiguration and LiquibaseAutoConfiguration occur
after HibernateJpaAutoConfiguration so that the DependsOnPostProcessor
condition can correctly check for a LocalContainerEntityManagerFactory
bean.

Fixes gh-3437
2015-07-07 18:19:13 -07:00
Spring Buildmaster
7ce391db4f Next development version 2015-07-01 22:48:01 -07:00
Phillip Webb
04dfac1c6c Formatting 2015-07-01 19:29:25 -07:00
Stephane Nicoll
441049cf4e Auto-detect JMS sessionTransacted flag
If a JtaTransactionManager is present, it is associated with the
auto-created JmsListenerContainerFactory. However, if no such transaction
manager is present, local transaction support is not enabled.

This gives a default situation where the message is acknowledged even
before the listener is invoked. We now make sure to turn on local JMS
transactions if no JtaTransactionManager is present.

Fixes gh-3393
2015-07-01 12:59:11 -07:00
Andy Wilkinson
b1ad2c30eb Ignore type-constrained converter when auto-configuring Jackson converter
Previously, JacksonHttpMessageConvertersConfiguration would configure a
general-purpose MappingJackson2HttpMessageConverter only if there was
no existing MappingJackson2HttpMessageConverter in the application
context. This was problematic when a
TypeConstrainedMappingJackson2HttpMessageConverter bean was present.
Such a bean is only capable of performing conversion for a specific
type, and therefore is no substitute for a general purpose converter,
yet its presence was causing the auto-configuration of a general
purpose converters to be turned off. This would leave Spring MVC’s
default converter being used for application/json requests which would
not honour the user’s Jackson configuration.

This commit enhances @ConditionalOnMissingBean so that the annotation
can be used to specify one or more types that should be ignored when
searching for beans. This allows the
TypeConstrainedMappingJackson2HttpMessageConverter beans that are
published by Spring Data REST to be ignored such that the
general-purpose MappingJackson2HttpMessageConverter is still
auto-configured.

Fixes gh-2914
2015-07-01 14:28:19 +01:00
Phillip Webb
8ec10c8425 Use buildView() to create MustacheView
Update MustacheViewResolver so that buildView() is called to create
the MustacheView. This sets fields such as `contentType` and allows us
to remove explicit setApplicationContext() and setServletContext()
calls.

Fixes gh-3265
2015-06-30 14:51:48 -07:00
Andy Wilkinson
5a1e66b3d6 Make GzipFilterAutoConfiguration conditional on HttpMethod
GzipFilterProperties uses HttpMethod so GzipFilterAutoConfiguration,
which uses GzipFilterProperties, needs to be conditional on HttpMethod
being on the classpath.

Closes gh-3362
2015-06-30 12:32:29 +01:00
Andy Wilkinson
8681a8ad2a Map empty virtual host to "/" when parsed from an address
Previously, an address that ended in a "/" would result in the virtual
host being an empty string. This was inconsistent with setVirtualHost
which would map an empty string to "/".

This commit updates the address parsing logic to call setVirtualHost
rather than assigning the value directly to this.virtualHost. This
ensures that the special handling for an empty string is applied
consistently.

Closes gh-3304
2015-06-22 15:20:41 +01:00
Andy Wilkinson
01ba0f7571 Make RemoteIpValve's protocolHeaderHttpsValue configurable via the env
Closes gh-3289
2015-06-22 13:44:09 +01:00
Phillip Webb
cca0b76ac8 Support Velocity toolbox configurations from jar
Create an EmbeddedVelocityToolboxView which supports loading toolbox.xml
files from the application classpath as well as the ServletContext. The
VelocityAutoConfiguration class has been updated to use the new view.

This change allows the `spring.velocity.toolbox-config-location`
property to work with embedded servlet containers.

Fixes gh-2912
2015-06-15 18:08:17 -07:00
Phillip Webb
75ffd1b017 Polish 2015-06-15 11:19:47 -07:00
Phillip Webb
a83d999f27 Add missing MultipartProperties.enabled property
Fixes gh-3209
2015-06-15 11:18:01 -07:00
Phillip Webb
135e9d10a6 Polish 2015-06-15 10:52:02 -07:00
Stephane Nicoll
321a149297 Only associate JTA transaction manager
This is related to 38cca9c but for the Rabbit support. Update
RabbitAnnotationDrivenConfiguration to only associate a JTA transaction
manager, if any.

Closes gh-3222
2015-06-15 11:20:03 +02:00
Stephane Nicoll
dc94fafaaa Fix dependency of AmqpAdmin
AmqpAdmin does not require a CachingConnectionFactory. Using the more
general CachingConnectionFactory provides more flexibility.

Closes gh-3220
2015-06-14 10:04:06 +02:00
Andy Wilkinson
defceec90c Reinstate support for spring.groovy.template.configuration.*
Previously, spring.groovy.template.configuration.* was mapped onto both
GroovyTemplateProperties.configuration and GroovyMarkupConfigurer. The
former being a Map and the latter being specific type with getters and
setters. This clash caused problems with the IDE support.

GroovyTemplateProperties.configuration appeared to be dead code so it
was removed in 326bdf2. Unfortunately this broke the use of
spring.groovy.template.configuration.* properties as
GroovyTemplateProperties uses a prefix of spring.groovy.template and it
no longer had a configuration property.

This commit addresses the problem by updating GroovyTemplateProperties
to ignore unknown fields. This allows
spring.groovy.template.configuration.* properties to be used and bound
to GroovyMarkupConfigurer without reintroducing the clash which prompted
the initial change.

Closes gh-3198
2015-06-10 17:53:45 +01:00