Commit Graph

622 Commits

Author SHA1 Message Date
Dave Syer 77eaa9b24e Defensive on startup with Multipart config 2014-06-02 22:30:01 +01:00
Dave Syer 1f82ef4deb Ensure JPA/Security are not fighting with each other on startup
This is *really* nasty (and led me to discover a related bug
https://jira.spring.io/browse/SPR-11844), but fortunately easy to
hide from users once you have a test case.

The problem is that Spring Security registers a `BeanPostProcessor`
to handle `GlobalAuthenticationConfigurerAdapters`, and Boot
registers a `BeanPostProcessor` to handle injecting the packages
to scan into an `EntityManagerFactory` from `@EntityScan`. The
clash comes because the `EntityScanBeanPostProcessor` wants to be
postprocessed by the Security postprocessor, but if the Security
configuration depends on JPA it won't be ready in time.

The fix (or workaround) depending on how you look at it is to
prevent the other bean post processors from taking an interest in
`EntityScanBeanPostProcessor` at all (mark it as synthetic).

Fixes gh-1008
2014-06-02 19:32:17 +01:00
Dave Syer 49a09c807c Defer SQL initialization to fit with JPA better
Added 2 new spring.datasource.* properties ("data" like
"schema", and "deferDdl" like the "spring.jpa.hibernate.*"
flag). The SQL scripts are then run separately and the "data"
ones are triggered by a new DataSourceInitializedEvent,
which is also published by the Hibernate DDL schema export.

Fixes gh-1006
2014-06-02 13:10:50 +01:00
Dave Syer efcbb32788 Remove some compiler warnings 2014-06-02 10:56:12 +01:00
Phillip Webb 738d195587 Create JMS sub-packages
Reorganize the `jms` package into `hornetq` and `activemq` sub-pacakges.

Fixes gh-1005
2014-06-01 13:49:41 +01:00
Phillip Webb e5cda040b0 Restore test classes
Restore test classes accidentally deleted and ignored in c43fd04f3e.
2014-06-01 13:11:25 +01:00
Phillip Webb c43fd04f3e Add Elasticsearch tests
Add unit tests for elasticsearch packages. Also refactor some
of the existing tests to prevent Repository clashes.

See gh-408
2014-06-01 12:54:42 +01:00
Artur Konczak 99940337a9 Add support for Elasticsearch
Add auto-configuration and starters for Elasticsearch.

Fixes gh-408
2014-06-01 12:54:42 +01:00
Stephane Nicoll 5a69bb9267 Add HornetQ JMS support
Provide auto-configuration support for HornetQ JMS broker, along with
an additional starter POM.

The connection factory connects to a broker available on the local
machine by default. A configuration switch allows to enable an embedded
mode that starts HornetQ as part of the application.

In such a mode, the spring.hornetq.embedded.* properties provide
additional options to configure the embedded broker. In particular,
message persistence and data directory locations can be specified. It is
also possible to define the queue(s) and topic(s) to create on startup.

Fixes: gh-765
2014-05-30 23:26:07 +01:00
Phillip Webb 67beba9464 Switch HSTS enum to upper case.
Since the RelaxedBinder now supports it.
2014-05-30 16:47:30 +01:00
Dave Syer ef7390d3f0 Add extra @Conditional to be defensive in Social autoconfig
Older versions of Spring Social will not have the SocialConfigurerAdapter
so making social autoconfig conditional on that class makes sense (since it
all extends from it).

Fixes gh-986
2014-05-30 15:11:24 +01:00
Dave Syer 29cb21c322 Be lenient with prefix and add period if missing 2014-05-30 15:11:24 +01:00
Dave Syer b0579c1cf3 Ensure JPA vendor properties are period separated
If you bind to Map<String,Object> you get a nested Map instead
of period-separated keys. This change just makes JpaProperties
expose a Map<String,String> so the keys are sane.

Fixes gh-988
2014-05-30 10:25:01 +01:00
Phillip Webb 11a093bdc0 Polish 2014-05-30 00:31:11 +01:00
Dave Syer 5e3cc95ccf Adjust security.basic.enabled=false behaviour
Actually the web-secure sample is misusing
security.basic.enabled=false (IMO) - it should be a flag
to say that you want to temporarily disable the basic security
fallback on application endpoins, not  way to disable all
security autoconfiguration.

Added test case to web-secure sample to ensure a user
can log in.

Fixes gh-979
2014-05-29 13:25:01 +01:00
Phillip Webb bdcb9407eb Restore commons-logging dependency for spring-boot
Restore the dependency on commons-logging (transitively via spring-core)
for spring-boot. This means that we are not tied directly to SLF4J, but
it is still an option that can be used via `jcl-over-slf4j`.

The `spring-boot-starter-parent` continues to replace `commons-logging`
with `jcl-over-slf4j`.

Fixes gh-981
2014-05-28 23:03:26 +01:00
Phillip Webb 5a5a7be477 Polish 2014-05-28 22:05:23 +01:00
Andy Wilkinson 7a8be3d600 Use Spring Framework bom and fully exclude commons-logging
Closes #955
Closes #978
2014-05-28 20:12:29 +01:00
Phillip Webb 7fd26a556d Fix social property binding
Update Spring Social auto-configurations to read properties using
the `dashed` notation and with the appropriate prefixes. This allows
properties to be specified in any of the relaxed forms.

Also minor refactor to extract common logic to a new
SocialAutoConfigurerAdapter base class.

See gh-941
2014-05-28 17:36:07 +01:00
Andy Wilkinson 47e3a72390 Source code formatting 2014-05-28 13:38:03 +01:00
Craig Walls 5e1913576e Document Spring Social support 2014-05-28 13:30:41 +01:00
Craig Walls f006b1231c Add Spring Social autoconfiguration 2014-05-28 13:30:41 +01:00
Phillip Webb 6381fdcb49 Polish 2014-05-26 21:48:19 +01:00
Dave Syer 43481725b9 Fix bug in DataSourceBuilder 2014-05-26 10:06:18 +01:00
Dave Syer 32295b9bdc Add options for Flyway to have its own DataSource
Either set flyway.[url,user,password] or create a DataSource
@Bean and mark it @FlywayDataSource.

Fixes gh-807
2014-05-26 08:55:28 +01:00
Roy Clarkson 9f52a0dbd7 Add Spring Mobile SitePreferenceAutoConfiguration
New feature in Spring Mobile (user preferences per site).

Fixes gh-946
2014-05-26 07:00:03 +01:00
Dave Syer 68448a8c68 Use the ServerProperties to add prefixes to paths
when server.servletPath is set we need to add prefixes to
the security filter paths.

Fixes gh-945
2014-05-24 08:33:14 +01:00
Phillip Webb 28f88562f2 Make AutoConfigurationPackages.set public
Open up AutoConfigurationPackages.set(...) to allow programmatic
configuration of base packages.

Fixes gh-924
2014-05-23 22:13:25 +01:00
Phillip Webb a6b94e7cef Fix typo in warning 2014-05-23 18:31:52 +01:00
Andy Wilkinson f21151e594 Dont’t auto-configure FreeMarker and Velocity without context-support
Boot’s auto-configuration for FreeMarker and Velocity relies on Spring’s
support for them that’s packaged in spring-context-support. Only
auto-configure them if their respective Spring classes are on the
classpath

Fixes #940
2014-05-23 11:36:25 +01:00
Dave Syer 4999d41145 Add test for servletMapping() 2014-05-23 11:05:29 +01:00
Dave Syer 660d9e24dc Add servlet path to /error if it is customized
In addition I added some convenience methods to ServerProperties
(servletMapping() and servletPrefix()) for manipulating the
servlet path as provided by the user (e.g. normalizing it into
a valid Servlet mapping path for the DispatcherServlet).

Fixes gh-939, see also gh-936
2014-05-23 10:48:34 +01:00
Phillip Webb 0897cfb51b Deprecate and warn on namingstrategy
Deprecate setNamingstrategy() and log a warning letting people know
that they should use `naming-strategy`.

Issue #928
2014-05-23 10:01:09 +01:00
Andy Wilkinson aaa5b9ddf1 Continue to support spring.jpa.hibernate.namingstrategy
In 1.0, the property spring.jpa.hibernate.namingstrategy could be
used to configure Hibernate's naming strategy. This was at odds with
most other configuration where binding to namingStrategy would require
a property with some indication that it was two separate words, for
example: naming-strategy, naming_strategy, or namingStrategy

This commit adds a new setter, setNamingstrategy, to JpaProperties so
that an app that was using namingstrategy in 1.0 continues to work
in 1.1.

Issue #928
2014-05-22 21:24:50 +01:00
Phillip Webb 1a475102de Polish 2014-05-22 20:33:08 +01:00
apoplexy dfc1979ea2 Allow the tomcat maxHttpHeaderSize to be changed in external config
Prevents large SPNEGO headers from causing server errors for example.
Added the property to ServerProperties.

Fixes gh-931
2014-05-22 17:43:09 +01:00
Andy Wilkinson e45ef06b56 Polish Spring Data Solr integration 2014-05-22 17:29:12 +01:00
Christoph Strobl 6ed69709d7 Add auto configuration support for Spring Data Solr
Registers required components in application context if not available to
set up environment for usage with Spring Data Solr. Will listen on
SolrServer and SolrRepositories for configuration.

By default an HttpSolrServer is registered unless a zkHost (zookeeper
host) is defined. In that case an instance of CloudSolrServer will be
created.

By default multicore support is enabled, creating instances of
SolrServer for each core defined via @SolrDocument.
2014-05-22 17:29:12 +01:00
Dave Syer 146a337b53 Ensure Mongo autoconfig is easy to exclude 2014-05-21 12:53:35 +01:00
Dave Syer e9d594c693 Add conditional processing option for unhelpful FactoryBeans
OnBeanCondition has some issues with FactoryBean object types where
the FactoryBean is not generic (i.e. you have to instantiate it to
get its object type). This is a known issue (see tests in
ConditionalOnMissingBeanTests), but we can provide some help for
library authors who know the type in advance. The approach we have
taken here is to check the BeanDefinition for an attribute called
"factoryBeanObjectType" (OnBeanCondition.FACTORY_BEAN_OBJECT_TYPE)
which, if it exists, can be used as a tie-breaker. Its value should
be a Class<?> instance.

Fixes gh-921
2014-05-21 12:47:53 +01:00
Dave Syer 86ff5315b4 Update to Jedis 2.4.1 means commons-pool2
Fixes gh-918
2014-05-21 11:30:43 +01:00
Andy Wilkinson 00b18b114a Merge branch '1.0.x' 2014-05-21 09:14:07 +01:00
Phillip Webb 8bcda1bcbe Polish 2014-05-20 18:26:56 +01:00
Dave Syer 233a2e8fb5 Fix ordering problem with Mongo autoconfig 2014-05-20 17:17:21 +01:00
Andy Wilkinson eeefbdd5f8 Polish dependency management
- Remove dependency management for projects that Boot does not have a
  runtime dependency upon
- Provide dependency management for all of Spring Batch’s modules
2014-05-20 13:48:47 +01:00
Dave Syer e118515d7a Use Flyway to bind flyway.*
Since Flyway has bean properties (with getters and setters)
it can be used to bin directly to the Environment (instead of
copying all the properties into FlywayProperties).

Fixes gh-806
2014-05-20 11:28:56 +01:00
Dave Syer 7787b2ef6a Make Groovy templates work with Groovy 2.2
Fixes gh-890
2014-05-19 18:23:47 +01:00
Dave Syer e964b9eb34 Improved integration with Groovy 2.3.1
Groovy 2.3.1 has a new template loader abstraction that handles
compiler caching (better performance by factor of 10).
2014-05-19 18:23:03 +01:00
Dave Syer 85ac8f6b05 Add config hint to template error messages 2014-05-19 18:22:25 +01:00
Dave Syer 93a33f0197 Fix test 2014-05-19 12:27:24 +01:00
Andy Wilkinson 2378fe0900 Add support for using Velocity templates 2014-05-19 12:01:20 +01:00
Maciej Walkowiak b33eb95dd2 Added DriverClassNameProvider used for providing jdbc driver class based on jdbc url
Uses known databases from org.flywaydb.core.internal.util.jdbc.DriverDataSource

Fixes gh-824, fixes gh-809
2014-05-19 11:52:27 +01:00
Dave Syer a5543f18b9 Add callback for modifying or inspecting LocalContainerEntityManagerFactoryBean
A callback is added in autoconfig, so that if users inject the EntityManagerFactoryBuilder
into their app and use it to create multiple EntityManagerFactories, they all get the
same deferred DDL behaviour. The deferred DDL can also be disabled by setting
spring.jpa.hibernate.deferDdl=true.

Fixes gh-894
2014-05-19 11:08:11 +01:00
Dave Syer f2e3d94fa1 Use Hibernate native APIs to defer processing DDL
The EntityManagerFactory will happily process the DDL on startup, but
that happens too early (because of LoadtimeWeaverAware processing). We
can defer it to a more civilised stage, e.g. ContextRefreshedEvent by
using the Hibernate native APIs directly.

It makes the JpaProperties slightly more complex because they need
to distinguish between the early init and late processing versions
of the Hibernate properties.

Not ready for prime time yet because there is no way to deal with
multiple EntityManagers.

Fixes gh-894
2014-05-19 11:08:11 +01:00
Dave Syer 2cc5bdfa09 Hack to force Flyway to initialize early 2014-05-19 11:08:11 +01:00
Dave Syer 53ff50adb6 Map oracle->oracle10g for Batch schema initialization
Fixes gh-892
2014-05-17 06:51:38 +01:00
Dave Syer 586b52faf5 Fix Groovy template URLs 2014-05-16 13:47:28 +01:00
Dave Syer c8ca2495de Use URLs for groovy template resources 2014-05-16 13:04:00 +01:00
Dave Syer 7c7d1f55e0 Add RequestContext to Groovy template view model 2014-05-16 09:41:50 +01:00
Dave Syer f572992c5d Relax requirement for groovy template directory to exist
Since groovy-templates is included with groovy-all it is unreasonable
to expect anyone who has it on their classpath to have resolvable templates.
We may need to revisit this decision, but since the origain feature
that drove this was thymeleaf and idaiotic users having it on their
classpath but not using it, maybe we don't need to.
2014-05-15 22:12:27 +01:00
Dave Syer 15303a2de6 Add GroovyTemplates to autconfig 2014-05-15 18:42:44 +01:00
Dave Syer da2e25f90d Add Groovy template engine support for Spring MVC apps
Default suffix .tpl. If groovy-templates is on the classpath user
can now add templates and get them rendered and resolved in an MVC
app.

TODO: Macro helpers for message rendering etc.

See gh-878
2014-05-15 17:42:53 +01:00
Phillip Webb 938609fdc0 Merge branch '1.0.x'
Conflicts:
	spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java
	spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java
2014-05-15 16:35:43 +01:00
Phillip Webb 0b4e2b3667 Polish revisted JMS support
- Add createConnectionFactory method on ActiveMQProperties
- Change getBrokerUrl to return the broker URL and add new deduce method
- Move static methods to end of class
- Apply source formatting
2014-05-15 16:32:30 +01:00
Phillip Webb fa7da5925b Remove checked exceptions from @PostConstructs
Update all @PostConstruct methods to ensure that they don't throw
checked exceptions. Required to allow deployment of Spring Boot
applications on Glassfish.

Fixes gh-868
2014-05-15 15:47:44 +01:00
Stephane Nicoll e695e5d637 Revisit JMS support
Since ActiveMQ 5.8.0, the modules structure has been revisited and
activemq-core no longer exists. The activemq-broker is required to
create an embedded broker. Since Boot creates such broker by default
if ConnectionFactory is present, a condition has been added to do so
only when the necessary classes are present in the classpath.

The default embedded broker is now configured to disable message
persistence altogether as this requires an extra jar since 5.8.0, i.e.
activemq-kahadb-store.

Split the ActiveMQ auto configuration from the JmsTemplate auto
configuration so these are totally independent.
ActiveMQAutoConfiguration has been created to detect and configure
the ActiveMQ broker if necessary.

The brokerUrl parameter was ignored as long as the inMemory parameter
was true. The actual brokerUrl to use is now determined by the user
defined values of those parameters: if the brokerUrl is set, it is always
used. If no brokerUrl is set, the value of inMemory determines if an
embedded broker should be used (true) or a tcp connection to an
existing local broker (false).

JmsTemplateAutoConfiguration now creates a JmsTemplate only if a
ConnectionFactory is available.

Fixes gh-872, gh-882, gh-883
2014-05-15 16:18:41 +02:00
Dave Syer 0a11459c3e path->templateLoaderPath 2014-05-15 15:03:51 +01:00
Phillip Webb aaf50a768c spring.freemarker.templateLoaderPath -> path
Fixup tests and documentation following the rename of
spring.freemarker.templateLoaderPath to spring.freemarker.path
2014-05-15 14:54:14 +01:00
Dave Syer d2112e27a3 Add FreeMarkerProperties instead of raw Environment access
It's better for readability and tooling. Changed
templateLoaderPath -> path (simpler and unlikely to clash)
2014-05-15 13:10:53 +01:00
Dave Syer 6a10df0933 Fix freeMarker->freemarker 2014-05-15 12:39:37 +01:00
Dave Syer aca0d38f08 Make OnExpressionCondition package private
(consistent with the other Condition implementations)
2014-05-15 10:16:46 +01:00
Phillip Webb 01fcf61140 Polish 2014-05-15 09:51:16 +01:00
Dave Syer 7454c4866b Support for @ConfigurationProperties in JPA
Adds JpaProperties to bind to spring.jpa.* (making those
properties easier to reason about and visible in the
/configprops endpoint).

Also allows easy configuration of multiple EntityManagerFactories via new
EntityManagerFactoryBuilder. JpaBaseConfiguration has a @Bean of that type
so users can inject it to create new or additional EntityManagerFactories.
This also simplifies the Hibernate autoconfiguration.

Also renames the DataSourceFactory to DataSourceBuilder (since that's what it
is).
2014-05-15 09:18:38 +01:00
Dave Syer 5249f54c5a Integrate @ConfigurationProperties @Beans with DataSource configuration
We now have a much simpler DataSourceAutoConfiguration that binds to whatever
DataSource concrete type it finds at runtime. To be able to quickly switch between
Hikari and the other types of DataSource there's a minute shim for translating
the common properties (username, password, url, driverClassName), but actually
only url is different. The shim and also DataSource initialization is supported
through DataSourceProperties, but the other native properties get bound directly
through the concrete runtime type of the DataSource.

The /configprops endpoint works (and is exposed in the actuator sample).

Fixes gh-840, fixes gh-477, see also gh-808.
2014-05-13 16:46:04 +01:00
Dave Syer 1b284a0619 Add RelaxedDataSourceFactory 2014-05-13 16:45:48 +01:00
Christian Dupuis 9e56c38b7a Rename DefaulErrorAttributes to DefaultErrorAttributes
fixes #853
2014-05-13 17:43:28 +02:00
Christian Dupuis d8ec2719d7 Fix RedisAutoConfiguration with pool config
fixes #850
2014-05-13 17:32:53 +02:00
Phillip Webb 30ac768cbf Remove @ControllerAdvice from BasicErrorController
Update the BasicErrorController so that it no longer needs to implement
@ControllerAdvice or have an @ExceptionHandler method.

A new ErrorAttributes interface is now used to obtain error details,
the DefaultErrorAttributes implementation uses a
HandlerExceptionResolver to obtain root exception details if the
`javax.servlet.error.*` attributes are missing.

This change also removes the need for the extract(...) method on
ErrorController as classes such as WebRequestTraceFilter can
now use the ErrorAttributes interface directly.

See gh-839, gh-538
Fixes gh-843
2014-05-12 19:46:57 +01:00
Dave Syer 59a899a4da Add @ResponseStatus handler to global exception handler
We might need to revisit this to allow more fine-grained
control by users, but it seems like a sensible default.
The BasicErrorController now uses both of the deafult strategies
(ResponseStatusExceptionResolver and DefaultHandlerExceptionResolver)
from Spring MVC to try and determine an appropriate response.

Fixes gh-839
2014-05-12 09:02:28 +01:00
Lukasz Kryger 254b175c0a Read data-{platform}.sql in addition to data.sql
Update DataSourceAutoConfiguration to read platform specific `data.sql`
files in the same way as `schema.sql` files.

Fixes gh-837
2014-05-10 22:49:49 +01:00
Phillip Webb dac03fdb7b Extract WebMvcProperties
Extract WebMvcProperties from WebMvcAutoConfiguration and also
update conditionals to use @ConditionalOnProperty.
2014-05-10 00:25:49 +01:00
Phillip Webb 1c0cce441d Add spring.resources.add-mappings property
Add `spring.resources.add-mappings` allowing users to configure if
resource mappings should be added or not.

Fixes gh-804
2014-05-10 00:23:13 +01:00
Phillip Webb 4b51b6f9df Support relaxed names with ConditionalOnProperty
Update ConditionalOnProperty to optionally support relaxed form names.

Fixes gh-835
2014-05-10 00:23:05 +01:00
Maciej Walkowiak b79132ceff Update @ConditionalOnProperty to not match false
Update @ConditionalOnProperty so that properties that are present but
contain the value `false` are not considered a match.

Fixes gh-812
2014-05-08 16:17:38 +01:00
Maciej Walkowiak 56b8faf31b Add @ConditionalOnProperty annotation
Add @ConditionalOnProperty which enables conditional bean creation when
all required properties are defined in the Environment.

Fixes gh-812
2014-05-08 15:12:45 +01:00
Dave Syer 14d3b46809 Add constants to SecurityProperties and ManagementServerProperties
For the convenience of users who want to selectively override the
access rules in an application without taking complete control of the
security configuration we now have some constants:

* SecurityProperties.ACCESS_OVERRIDE_ORDER for overriding just the
application endpoint access rules

* ManagementServerProperties.ACCESS_OVERRIDE_ORDER for overriding the
application endpoint and management endpoint access rules

Fixes gh-803
2014-05-08 05:32:43 -07:00
Dave Syer f04f265515 Remove some compiler warnings 2014-05-08 05:32:43 -07:00
Andy Wilkinson f02a21f3fb Use the official JMS spec artifact 2014-05-08 12:13:04 +01:00
Andy Wilkinson 62ac51eead Upgrade to the Spring Data Dijkstra release train
In addition to the upgrade to Dijkstra (#743) Spring HATEOAS has been
upgraded to 0.11.0 (#801) and Mongo's Java driver has been upgraded to
2.12.1 (#689). In both cases this is the same version as is used by
Dijkstra RC1.

The new version of Mongo's Java driver changes the exception that's
thrown when Mongo isn't running and a connection attempt fails. The
Mongo sample has been updated accordingly.

RepositoryRestMvcAutoConfiguration has been updated to be configured
before JpaRepositoriesAutoConfiguration. This ensures that the
former's transitive import of SpringDataJacksonConfiguration takes
precedence over the latter's import of the same. This is necessary as
RepositoryRestMvcConfiguration requires a bean that's declared by
SpringDataJacksonConfiguration and, if JpaRepositoriesAutoConfiguration
is processed first, its conditions may cause the import
SpringDataJacksonConfiguration to be skipped causing instantiation
of RepositoryRestMvcConfiguration to fail.

Closes #689
Closes #743
2014-05-07 13:44:28 +01:00
Greg Turnquist 5eb08dc32e Upgrade to ActiveMQ 5.9.1
Closes #397 and #717
2014-05-07 10:21:57 +01:00
Stephane Nicoll 33082fd56d Harmonized maven dependency management
This commit harmonizes the dependency management of internal modules
so that versions can be omitted everywhere. Update the maven coordinates
to provide the full groupId for consistency
2014-05-05 14:29:01 +01:00
Stephane Nicoll a330cb9b8a Improve remote shell security documentation
Previous to this commit, the remote shell security configuration
described that a default password will be generated with no extra
configuration. Actually, when Spring Security is configured for the
application, the remote shell reuses that configuration by default.

It turns out that the default log message is confusing as it was
referring to "application endpoints". Updated that log to a more
generic log message and updated doc accordingly.

Fixes gh-779
2014-05-05 11:12:27 +02:00
Marcel Overdijk 0f738be114 Add specifying (fixed) date format via application properties
Fixes gh-778, Fixes gh-755
2014-05-04 11:53:11 +01:00
Dave Syer 41395d08e3 Upgrade flyway to 3.0
Fixes gh-771
2014-05-02 15:52:08 +01:00
Phillip Webb 5127614d59 Restore freeMarkerConfiguration for web
Restore `freemarker.template.Configuration` bean for the
FreeMarkerWebConfiguration. The @Bean method no longer uses a
@Condition since `FreeMarkerConfig` must already exist.
2014-05-02 13:07:52 +01:00
Phillip Webb 761b6e3229 Combine FreeMarkerAutoConfigurationTests
Combine and polish FreeMarkerAutoConfigurationTests and
FreeMarkerNonWebappTests
2014-05-02 13:07:52 +01:00
Phillip Webb b5451d54ee Polish 2014-05-02 13:07:52 +01:00
Dave Syer b04304b691 Add @since 2014-05-02 11:22:19 +01:00
Dave Syer 799f9edb0b Harmonize enabled flags for flyway and liquibase 2014-05-02 11:15:38 +01:00
Dave Syer 2cd7b13096 Drop 'spring' from 'spring.[liquibase,flyway]' 2014-05-02 11:15:37 +01:00
Dave Syer 5548b24c4c Add autoconfig support for Flyway migrations
Flyway starts up with its default settings if it is on the classpath.
You can also ask Boot to barf if the migration scripts are missing.

Fixes gh-730
2014-05-02 11:15:33 +01:00
Marcel Overdijk 68e33b25c1 Added liquibase autoconfiguration for database migrations
If Liquibase is on the classpath it will fire up on startup. Various
config options are available (as well as the option to disable it).
Liquibase uses a YAML format for changes (in classpath:db/changelog).
2014-05-02 11:12:12 +01:00
Dave Syer ed64640ea4 Switch from @Bean to protected method 2014-05-02 09:47:42 +01:00
Phillip Webb 4248665fcd Remove freemarkerConfiguration bean
Remove `freemarkerConfiguration` from the FreeMarkerAutoConfiguration
since it should not be needed for most applications.

The previous code also caused problems since it included a
@ConditionalOnBean annotation on a bean that was created in the same
configuration.
2014-05-01 21:36:44 +01:00
Phillip Webb 2fe256a8aa Polish 2014-05-01 21:21:00 +01:00
Dave Syer 0540cecbd4 Fix test in FreeMarker support 2014-05-01 13:40:22 +01:00
Dave Syer cb1b3481be Add support for FreeMarker in non-webapp
The existing freemarker support only works in a webapp. This
change adds a FreeMarker Configuration bean (in both web- and
non webapps) so it can be used to load a Template and render it
(e.g. with Spring's FreeMarkerTemplateUtils).

See gh-679
2014-05-01 11:46:27 +01:00
Artem Bilan ce3aafa7a9 Upgrade to Spring Integration 4.0
Closes #751
2014-05-01 10:07:17 +01:00
Phillip Webb 6025f45aa0 Polish 2014-04-30 21:53:24 +01:00
Phillip Webb fb13bf9016 Move TemplateAvailabilityProvider
Move TemplateAvailabilityProvider from the spring-boot project to
spring-boot-autoconfigure
2014-04-30 21:38:17 +01:00
Phillip Webb decee8d871 Polish templates code 2014-04-30 21:36:09 +01:00
Dave Syer 537b0c3ff3 Use enum for MessageCodesResolver format
Fixes gh-670
2014-04-30 16:00:01 +01:00
Marcel Overdijk 1cbef02236 Add messagecode resolver format based on application property 2014-04-30 16:00:01 +01:00
Stephane Nicoll e26e06d5dd Fix build
Two modules are still relying on the spring-boot test-jar but it was
not generated anymore. Adding the generation of test-jar again as
a workaround until we completely removes the use of it.
2014-04-30 16:39:54 +02:00
Dave Syer 030f00c36d Convert actuator-ui sample to FreeMarker
See gh-679
2014-04-30 13:04:19 +01:00
Dave Syer 50190a4de7 Add support for HikariDataSource
We still prefer Tomcat if it is available (that can change
if the community asks loudly enough). Hikari is supported
via the same spring.datasource.* properties as Tomcat (and
DBCP), with some modifications:

* The validation and timeout settings are not as fine-grained
in Hikari, so many of them will simply be ignored. The most
common options (url, username, password, driverClassName) all
work as expected.

* The Hikari team recommends using a vendor-specific DataSource
via spring.datasource.dataSourceClassName and supplying it with
Properties (spring.datasource.hikari.*).

Hikari prefers the JDBC4 isValid() API (encapsulates vendor-
specific queries) which is probably a good thing, but we
haven't provided any explicit support or testing for that yet.

Fixes gh-418
2014-04-30 11:52:47 +01:00
Dave Syer f46d281b22 Upgrade to Reactor 1.1
Fixes gh-706
2014-04-30 11:27:29 +01:00
Andy Wilkinson 7c91176186 Add FreeMarker support
This commit adds auto-configuration and a starter,
spring-boot-starter-freemarker, for using FreeMarker view templates in
a web application.

A new abstraction, TemplateAvailabilityProvider, has been introduced.
This decouples ErrorMvcAutoConfiguration from the various view
technologies that Spring Boot now supports, allowing it to determine
when a custom error template is provided without knowing the details of
each view technology.

Closes #679
2014-04-29 19:46:09 +01:00
Dave Syer ef4e83a879 Move ErrorController to autoconfig 2014-04-29 15:23:29 +01:00
Andy Wilkinson b6cd2c970c Use Jedis rather than Lettuce as preferred Redis client
Salvatore has indicated that Jedis is his Java Redis client of choice.
This commit updates the auto-configuration support, actuator and
Redis starter accordingly.

Completes #745
2014-04-28 14:06:40 +01:00
Dave Syer b20262c1a7 Backout couchbase changes 2014-04-28 12:21:58 +01:00
Dave Syer e433eb20a6 Align couchbase more with other data-* support 2014-04-28 11:01:24 +01:00
sopov.ivan 174b654faf minor test fixes
Reverting arguments in assertEquals where constant was placed on
the "actual" place. Replacing assertEquals with assertFalse, assertTrue
and assertNull where applicable.

Fixes gh-735
2014-04-26 14:14:05 +01:00
Dave Syer 477b199cd6 Add ApplicationEventPublisher explicitly to security publisher
For some reason the exception mappings are only created with the
publisher is initialized in the constructor of DefaultAuthenticationEventPublisher.
Changed SpringBootWebSecurityConfiguration to do that rather then
relying on the ApplicationEventPublisherAware behaviour to inject it.

Fixes gh-719
2014-04-26 12:15:30 +01:00
Dave Syer 6ac85c1759 Add username/password and MongoClientOptions to Mongo config
The username/password option stil lonly works for a single host (to
connect to a cluster I suspect you need to set the URI). Also added
a MongoClientOptions (if a bean of that type exists it will be
used to populate the options that aren't in the URI).

Fixed gh-536
2014-04-26 12:09:23 +01:00
Phillip Webb 5dabd7fb41 Rename MongoTemplateAutoConfiguration
Rename MongoTemplateAutoConfiguration to MongoDataAutoConfiguration
since it now configures more than just the template.
2014-04-25 15:57:44 +01:00
Phillip Webb a7f5cbf7d0 Polish mongo changes
Restore formatting and fixup doc comments.
2014-04-25 15:57:44 +01:00
Phillip Webb 2adf30950e Polish couchbase support
Polish couchbase support to:
- Extract properties into its own class
- Remove unnecessary inner configuration class
- Add since tags
- Format code and add `this.` references
2014-04-25 15:57:44 +01:00
Phillip Webb fba08e7811 Polish 2014-04-25 15:57:43 +01:00
Phillip Webb 1ae91a135c Polish MultipartConfigElement support
Polish MultipartConfigElement changes introduced in commit e8e59ea6
as follows:

- Fix javadoc formatting
- Fix tab/spaces formatting
- Fix asciidoc formatting
- Move creation of MultipartConfigElement into MultipartProperties
- Add @Since tags
- Restore random port in tests
2014-04-25 15:57:43 +01:00
sopov.ivan 10d82e28ff minor - correcting modifiers order 2014-04-25 18:20:09 +04:00
Dave Syer 94dd510b52 Merge GridFs with MongoTemplate configuration 2014-04-25 13:41:09 +01:00
Josh Long f36f2024e2 Update GridFsTemplateAutoConfiguration.java
improved documentation.
2014-04-25 12:45:54 +01:00
Josh Long 330c95d6ab Update GridFsTemplateAutoConfigurationTests.java
improved documentation
2014-04-25 12:45:54 +01:00
Josh Long 0d53b9d9fa adding initial GridFS integration. 2014-04-25 12:45:53 +01:00
Michael Nitschinger 78ce06ccc7 Add support for spring-data-couchbase
Fixes gh-124
2014-04-25 12:05:15 +01:00
Stephane Nicoll c4ffe721c7 Fix JmsTemplate default pubSubDomain setting
Prior to this commit, a JmsTemplate bean created automatically by Boot
had its "pubSubDomain" flag enabled. It's far more usual to fallback on
queue rather than topic.

This commit flips the default value of the configuration property.
2014-04-25 11:16:27 +01:00
Rob Winch ae7098ae1d Add RepositoryRestMvcAutoConfiguration
Fixes gh-626
2014-04-25 11:13:31 +01:00
Dave Syer 63f2d6ab15 Remove compiler warnings related to Batch upgrade 2014-04-25 10:59:52 +01:00
Dave Syer 3173646635 Fix another test from gh-708 2014-04-25 10:57:12 +01:00
Dave Syer d597cc3387 Fix test broken in gh-708 2014-04-25 10:16:19 +01:00
Roy Clarkson 6ad7257baf Add auto-configuration for @EnableHypermediaSupport
If Spring HATEOAS is on the class path, then @EnableHypermediaSupport
will be auto-configured with HAL support.
2014-04-25 09:52:27 +01:00
Josh Long e8e59ea657 MultipartConfigElement autoconfig support.
Fixes gh-708
2014-04-25 09:33:43 +01:00
Phillip Webb 64a835e91a Move master to 1.1.0.BUILD-SNAPSHOT 2014-04-24 12:45:20 +01:00
Spring Buildmaster d3954a1703 Next development version 2014-04-24 02:24:28 -07:00
Phillip Webb 4119ef5cf4 Use random ports for tests
Update remaining tests to use random ports.

Fixes gh-337
2014-04-23 19:11:54 +01:00
Phillip Webb fad5ce45db Polish 2014-04-23 12:35:33 +01:00
Dave Syer 3304dd1cc9 Add spring.datasource.separator (default ";")
Fixes gh-715
2014-04-22 17:34:54 +01:00
Dave Syer f7c16764e6 Add setter for security.user.role
Fixes gh-700
2014-04-21 14:42:34 +01:00
Marcel Overdijk f78f836fc0 Add fixedlocaleresolver based on application property
If the user sets spring.mvc.locale and doesn't provide a @Bean
of type LocaleResolver then a FixedLocaleResolver will be provided.

Fixes gh-697, fixes gh-669
2014-04-19 19:38:51 -07:00
Dave Syer 0b89402240 Add spring.thymeleaf.contentType (defaults to HTML)
User can specify the content type in external properties now, optionally
ommitting the charset (since that is duplicated). If charset is not
appended by user Spring will do it.

Fixes gh-671
2014-04-15 07:10:08 -07:00
Spring Buildmaster a5864ebcd0 Next development version 2014-04-06 22:43:18 -07:00
Phillip Webb 2bb0f744e0 Polish 2014-04-06 21:49:12 -07:00
Jean Detoeuf 5077b6cc65 Added ActiveMqCredentials (optional)
Fixes gh-618
2014-04-03 14:48:17 +01:00
Dave Syer 5ed49462c4 Add spring.messages.cacheSeconds to global config
Fixes gh-625
2014-04-03 14:07:55 +01:00
Dave Syer 97adb5c1b3 Ensure ddl-auto=none for non-embedded database
A more thorough check is needed to avoid the false assumption
that the DataSource is embedded just because an embedded database
is on the classpath. You really have to try and look in the connection
metadata, so that's what we now do.

Fixes gh-621, fixes gh-373
2014-04-02 17:21:14 +01:00
Spring Buildmaster 15e9dbe98b Next development version 2014-04-01 03:05:51 -07:00
Phillip Webb 1e68b7e0a9 Remove superfluous <packaging> tags from POMs 2014-04-01 02:07:43 -07:00
Phillip Webb 0af7f7e347 Add missing POM info 2014-04-01 02:07:42 -07:00
Phillip Webb 488b03387f Polish POM formatting 2014-04-01 02:07:36 -07:00
Phillip Webb 6f9bb233ad Revert "Next development version"
This reverts commit b67bb70ee3.
2014-04-01 00:38:48 -07:00
Spring Buildmaster b67bb70ee3 Next development version 2014-03-31 22:38:42 -07:00
Phillip Webb ac4cdd33c3 Revert "Next development version"
This reverts commit 1d0eea12eb.
Returning to 1.0.0.BUILD-SNAPSHOT for an updated release.
2014-03-31 17:14:30 -07:00
Spring Buildmaster 1d0eea12eb Next development version 2014-03-28 11:47:09 -07:00
Phillip Webb beaddb2362 Polish 2014-03-26 13:29:26 -07:00
Dave Syer 006d7b6931 Move MongoTemplateAutoConfiguration to mongo package 2014-03-26 09:00:12 +00:00
Phillip Webb 44d708ef7a Polish 2014-03-25 14:33:27 -07:00
Phillip Webb c11d94105a Log AutoConfigurationPackages warnings just once
Update AutoConfigurationPackages to log warnings on the first access,
rather than during setup. This works around the fact that the CLI
currently add multiple @EnableAutoConfiguration annotations.

Fixes gh-579
2014-03-25 14:33:27 -07:00
Dave Syer e059d0cd5f Re-order security auto configuration so the fallback can be applied
The management security autoconfiguration wanted to come last in the chain
but that won't suit the fallback that was already in place for gh-568. This
change re-orders the autoconfig so that @EnableWebSecurity is still added
if the user sets security.basic.enabled=false and includes the actuator
endpoints.

Fixes gh-568
2014-03-25 17:03:10 +00:00
Dave Syer 59124d07c4 Switch on @EnableTransactionManagement by default
Fixes gh-576
2014-03-25 16:32:06 +00:00
Dave Syer 809a5a711f Add a @EnableWebSecurity if it looks like the user needs one
If the user explicitly disables the basic security features and forgets to
@EnableWebSecurity, and yet still wants a bean of type
WebSecurityConfigurerAdapter, he is trying to use a custom
security setup and the app would fail in a confusing way without
this change.

Fixes gh-568
2014-03-25 12:19:56 +00:00
Dave Syer a821092bbd Log a warning if repository autscan is set to default package
Fixes gh-572
2014-03-25 10:25:17 +00:00
Stephane Nicoll 87321edf36 Support Tomcat uri encoding (with UTF-8 default)
Introduce an extra `server.tomcat.uri-encoding` property used to
configure the URI encoding for the embedded tomcat container.

Defaults to `UTF-8` instead of the usual tomcat default of `ISO-8859-1`.

Fixes gh-540
2014-03-24 23:50:13 -07:00
Phillip Webb d42bedf295 Rename @ConfigurationProperties attributes
Rename `name` to `prefix` and `path` to `locations`.
2014-03-24 11:44:52 -07:00
Dave Syer 770c115d88 Allow Batch configuration without DataSource
If the user provides a JobExplorer and a BatchConfigurer that
don't require a DataSource we can back off on configuring ours
(and anything else that needs a DataSource).

Fixes gh-561
2014-03-24 15:23:43 +00:00
Dave Syer 86054a9c53 Use reflection to setup Websocket SCI so it works in Tomcat 8
Annoyingly this is necessary if we want to support Tomcat 7 and 8
since the package name changed.

Fixes gh-554
2014-03-24 09:04:21 +00:00
Dave Syer 3496f3f9dc Add marker interface for non-embedded servlet container
ErrorPageFilter is itself an EmbeddedServletContainerFactory
but it runs in a non-embedded container. Any component that assumes
the presence of an EmbeddedServletContainerFactory implies we are
running embedded is therefore invalid. WebSocketAutoConfiguration
had that problem.

Fixes gh-551
2014-03-23 21:45:54 +00:00
Dave Syer 373e2c5156 Allow user to opt out of ContentNegotiatingViewResolver
The bean ID for the ContentNegotiatingViewResolver is now
"viewResolver" (it is the *one*). The conditions have been changed
so that a user only has to define a bean of the same name to switch
it off.

Fixes gh-546
2014-03-22 14:44:30 +00:00
Dave Syer 4637c2a8f7 Accept viewNames and excludedViewNames for ThymeleafViewResolver
(via spring.thymeleaf.*).

Fixes gh-548
2014-03-22 14:25:51 +00:00
Dave Syer e472e7ccca Use forward:/index.html for home page
Fixes gh-549
2014-03-22 14:20:53 +00:00
Phillip Webb 03667c7ddc Rename a few `setup` methods to `configure`
Fixes gh-537
2014-03-21 11:25:31 -07:00
Phillip Webb 3193913899 Polish 2014-03-20 09:08:09 -07:00
Chris Savory 7be2d97d49 Allow multiple MessageSources that are comma separated.
Fixes gh-532, Fixes gh-506
2014-03-20 08:12:11 +00:00
Phillip Webb 798229f530 Document rabbit.addresses property 2014-03-18 11:15:15 -07:00
Dave Syer 01137b6fd6 Add "addresses" to RabbitProperties
If user sets addresses it supercedes anything that was set in host
or port (same as in the native ConnectionFactory).

Fixes gh-524
2014-03-18 17:57:55 +00:00
Piotr Maj 2e74251d1b Add support for sorting json keys
Add `jsonSortKeys` property to HttpMapperProperties.

Fixes gh-498
2014-03-18 10:38:00 -07:00
Phillip Webb c5ee3c7eba Remove duplicate documentation
Remove README files that have been since been migrated to the reference
documentation. Also updated remaining markdown files to asciidoctor to
save having a mix of different formats.

Fixed gh-503
2014-03-16 23:00:12 -07:00
Phillip Webb fcea565433 Polish javadoc formatting 2014-03-15 13:02:02 -07:00
Phillip Webb 80ac1fb0cd Polish 2014-03-15 13:02:01 -07:00
Phillip Webb 12d2331f4d Fix failing JMS test
Fix test failure caused by URL -> Url rename in
commit 22e397cda2
2014-03-13 13:59:54 -07:00
Phillip Webb 22e397cda2 Polish 2014-03-13 13:11:54 -07:00
Dave Syer 3d43771136 Register an AuthenticationManager in security autoconfig
This is quite a big step, but I think it helps a lot. Since Spring
Boot always creates an AuthenticationManager if it doesn't find one
already registered, it makes sense to also make it into a @Bean.
Spring Security does not register its AuthenticationManager by
default though, so we have to do that for it if the user has created
one with an @Autowired AuthenticationManagerBuilder, but not registered
it as a @Bean.

Having the @Bean (marked @Primary to prevent issues with @Autowired)
makes it easier to reason about what Spring Boot has done for you, and
easier to default in simple use cases to the boot-created
AuthenticationManager. For example, if I want an OAuth2 Authorization
Server with password grant, it makes total sense for the
AuthenticationManager for users to be the same as the @Primary one.
Now it is easy to set that up (just @Autowire it).
2014-03-13 12:02:34 +00:00
Dave Syer 85a56a79e4 Tidy up implementation of DispatcherServletAutoConfiguration
also adds another test.
2014-03-13 11:08:27 +00:00
Dave Syer 659d7b6df1 Extend DefaultDispatcherServletCondition to check for a registration
...bean with no explicit @Bean DispatcherServlet. We still have to check
by bean name (slightly unfortunate, but we need to avoid instantiating
too early) so there's now another magic
bean name for the registration bean ("dispatcherServletRegistration")
that the user has to replace if he wants the registration without
defining a servlet @Bean

Fixes gh-482
2014-03-13 09:33:29 +00:00
Dave Syer 14d52b6c18 Avoid creating a new EmbeddedServletContainerFactory for websockets
User can now also switch off and customize the websockets customizer by adding
a bean named "websocketContainerCustomizer".

Fixes gh-479
2014-03-12 09:21:07 +00:00
Piotr Maj 1b167f630c Support for maxWait, jdbcInterceptors and validationInterval
Fixes gh-470
2014-03-10 17:08:04 +00:00
Piotr Maj cb6739b4a5 Added testWhileIdle etc.
Fixes gh-463
2014-03-09 21:22:14 +00:00
Andy Piper 7b4fa22b40 Fix typo 2014-03-08 15:53:21 +00:00
Dave Syer c68902260e Change explicit bean type to concrete NamedParameterJdbcTemplate
Fixes gh-447
2014-03-07 11:06:58 +00:00
Josh Long 9453a6324a polishing documentation 2014-03-07 11:04:41 +00:00