Commit Graph

485 Commits

Author SHA1 Message Date
Dave Syer
32dff415c3 Rationalize the Reactor autoconfig
It didn't make sense not to do anything at all if a Reactor @Bean
was detected, so now we only back off creating the rootReactor if
one is present.
2014-06-05 12:52:23 +01:00
Stephane Nicoll
36e0d44eb2 Attempt to fix test failures on CI
This commit is an attempt to fix the build failures with the HornetQ
tests and relates to #1034
2014-06-05 11:14:42 +02:00
Stephane Nicoll
49697c7ad7 polishing 2014-06-05 10:15:45 +02:00
Dave Syer
0ccfba939e Switch to a matches-none filter for security.basic.enabled=false
There were some residual issues to do with the changes to the implementation
of security.basic.enabled=false. It was a good idea to have a filetr chain
triggered by the flag being off because it smooths the way for user-defined
filter chains to use the Boot AuthenticationManager (as a first step at least),
but it wasn't a goog idea to add any actual secuity features to that filter.
E.g. if it has HSTS then even an app like Sagan that has some secure endpoints
that it manages itself and the rest is unsecured has issues because it can't
accept connections over HTTP even on unsecure endpoints.

TODO: find a way for security.ssl_enabled=true to apply to only the user-
defined security filter (maybe not possible or worth the effort, since they
can inject a SecurityProperties if they need it?).

See gh-928
2014-06-05 07:04:07 +01:00
Stephane Nicoll
726991c144 Use an embed HornetQ broker by default
This commit changes the default behavior of the HornetQ auto
configuration. Prior to this commit, an embedded broker was only
started when it was requested explicitly by a configuration option.

This is inconsistent with the ActiveMQ support and boot favors the
easiest route. If the necessary classes are available, HornetQ is
embedded in the application by default.

Fixes gh-1029
2014-06-04 20:15:55 +02:00
Oliver Gierke
d6718025e6 Make HypermediaAutoConfiguration more lenient.
HypermediaAutoConfiguration didn't consider an @EnableHypermediaSupport 
annotation being present in the user configuration which could've caused 
it to be evaluated twice.

This is especially the case if both the auto-configuration for Spring 
HATEOAS and Spring Data REST kick in as Spring Data REST actively declares
@EnableHypermediaSupport. The double evaluation then causes injection
ambiguities as we now get multiple beans of e.g. LinkDiscoverers deployed.
2014-06-04 18:22:44 +01:00
Dave Syer
74166e770a Revert deferred DDL changes and re-oreder database migrations
Schema initialization now happens in @PostConstruct (effectively)
whether it is via the Hibernate EntityManagerFactory or the
Boot DataSourceInitialization (in addition or instead). The data.sql
script if it exists is still executed on an event fired from the
other places, so those tests are passing.

Flyway and liquibase have bean factory post processors (like
the one they use to order the audit aspect in Spring Data) that
enforce a dependency on those components from the EntityManagerFactory.
So Hibernate validation is still happy (and there are 2 tests to
prove it now as well).

Fixes gh-1022
2014-06-04 10:41:38 +01:00
Andy Wilkinson
f7d1aab9f3 Make ElasticSearchAutoConfiguration conditional on SD Elasticsearch
ElasticSearchAutoConfiguration depends on two Spring Data Elasticsearch
classes (TransportClientFactoryBean and NodeClientFactoryBean), however
it’s only conditional on Elasticsearch itself being on the classpath.
This lead to start up failures due to a ClassNotFoundException. Its
@ConditionalOnClass configuration has been updated so that the
auto-configuration will only be enabled if both Elasticsearch and Spring
Data Elasticsearch are on the classpath.

The dependencies on TransportClientFactoryBean and NodeClientFactoryBean
were ‘hidden’ in ElasticsearchProperties. The logic that uses these
types has been moved into ElasticSearchAutoConfiguration so that the
usage of the types and the related @ConditionalOnClass configuration
is in the same file.

Fixes #1023
2014-06-03 20:58:11 +01:00
Dave Syer
0def7644c2 Check for existence of ResourceBundle before creating MessageSource
Irritatingly a ResourceBundleMessageSource never gives up trying to
create a resource bundle for every message resolution, so to stop
it logging all those warnings (and probably sucking performance-wise)
we need to disable the MessageSource if a bundle is not provided.

Fixes gh-1019
2014-06-03 15:53:46 +01:00
Dave Syer
740c132c23 pool -> pool2 2014-06-03 10:33:52 +01:00
Dave Syer
251dbddc6e Use null instead of 'none' for ddlAuto
Fixes gh-1012
2014-06-03 10:30:36 +01:00
Dave Syer
56e70ca585 Introduce subpackages for Spring Data autoconfig
(If we ever want to modularize this will make it less painful)

Fixes gh-1015
2014-06-03 09:15:47 +01:00
Dave Syer
bc5a4bcc1e Compiler warnings 2014-06-03 08:44:30 +01:00
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