Commit Graph

518 Commits

Author SHA1 Message Date
Dave Syer
8d6f003e9a Defensive null check in case Hibernate autoconfig is off
If the Hibernate autoconfig is not used to create an EntityManager
then I suppose it's possible that the JpaProperties might be null
when everything else is ready for the event to be published.

There's no test case because I think it's a corner case.

Fxies gh-1075
2014-06-11 16:54:11 +01:00
Dave Syer
32a220da8f Test for message properties 2014-06-11 16:39:56 +01:00
Spring Buildmaster
05ed7b3bcd Next development version 2014-06-10 12:40:35 -07:00
Phillip Webb
3341a5db2b Deprecate @ConditionalOnMissingClass.value
Fixes gh-1069
2014-06-10 10:20:50 -07:00
Dave Syer
e8fcb0c875 Use classname instead of value in @ConditionalOnMissingClass
See gh-1065
2014-06-10 17:38:15 +01:00
Phillip Webb
3007a777d0 Roll back to 1.1.0.BUILD-SNAPSHOT 2014-06-10 09:00:08 -07:00
Dave Syer
36130b27e1 Support for Jmx (and Integration) autoconfig in parent contexts
When there are parent contexts we already had a strategy for registering
the actuator endpoints, but not the regular JMX or Integration MBeans.
This chnage makes the autoconfigs for JMX aware of the parent context.

Also adds a sample with a parent context.

See gh-847
2014-06-10 15:12:30 +01:00
Spring Buildmaster
c650f2391e Next development version 2014-06-09 21:55:19 -07:00
Phillip Webb
b5d267ca89 Polish 2014-06-09 12:33:49 -07:00
Phillip Webb
2ad4c47d18 Polish 2014-06-09 11:33:17 -07:00
Dave Syer
dcb17a7cb5 Enhance @Conditionals for JMX autconfig
Fixes gh-1059
2014-06-09 17:47:24 +01:00
Roy Clarkson
1a32a6a06b Fix issues with DeviceDelegatingViewResolverAutoConfiguration
- Log to the correct class
- Set Auto-configure after Thymeleaf hint on main class instead of
  internal static class
- Use 'thymeleafViewResolver' bean name instead of class for
  conditional bean checks
- Fix class name in properties documentation

Fixes gh-1052
2014-06-09 14:05:46 +01:00
Dave Syer
aa30fdba18 Add MBeanServer @Bean in case it is needed
Anywhere that an MBeanServer is needed it should be
created @Conditionally, so that user can exclude the
JmxAutoConfiguration and still get the other JMX
behaviours automatically.
2014-06-09 10:21:49 +01:00
Dave Syer
1a5c4f88b4 Fix compilation error 2014-06-09 10:10:34 +01:00
Dave Syer
39a94428d3 Add @Conditionals to permit JPA/Mongo mixed usage
I decided to go with both approaches (make the autoconfig for
repositories @ConditionalOnMissingBean(RepositoryFactoryBeanSupport),
so the first one wins; and also make them conditional on
spring.data.*.repositories.enabled=true. The ordering problem
is still there really (it's not defined which repositories will
be created by the autoconfig), so if a user is going to have
2 repository implementations on the classpath, he is going to
have to either choose one to disable, or manualy @Enable* the
other one.

Fixes gh-1042
2014-06-09 09:48:40 +01:00
Phillip Webb
2852f7422e Polish Spring Mobile Auto-configuration
Update Spring Mobile support with the following changes:
- Apply source formatting
- User lowercase property prefixes
- Use dashed notation when accessing properties
- Inline some constants

See gh-1049
2014-06-08 23:57:55 -07:00
Dave Syer
6902f2ac97 Revert on bean condition for mongo repositories 2014-06-07 14:30:33 +01:00
Dave Syer
dd176ccacf Fix broken test (ordering) 2014-06-07 14:16:36 +01:00
Dave Syer
376d6fb9bc Add test for mixed Mongo/Jpa repositories 2014-06-07 13:26:03 +01:00
Dave Syer
e81e94924c Fix Devc->Devic
(Leaving the docs changes for later)

Fixes gh-1049
2014-06-07 08:54:40 +01:00
Craig Walls
f2351f1ece Add ProviderSignInController for Spring Social
Update SocialWebAutoConfiguration to add a ProviderSignInController.
Also fix default UserIdSource.

Fixes gh-1050
2014-06-06 23:12:51 -07:00
Roy Clarkson
8f32b87c81 Improve Spring Mobile Auto-configuration
- Upgrade Spring Mobile dependency to 1.1.2
- Rename SitePreferenceAutoConfiguration "enabled" property
- Add Auto-configuration for LiteDeviceDelegatingViewResolver
- Update docs

Fixes gh-1049
2014-06-07 07:01:36 +01:00
Phillip Webb
e891aa3525 Polish 2014-06-06 22:58:43 -07:00
Phillip Webb
93aefa8537 Polish Flyway and Liquibase
Extract common "depends on" functionality to a new
EntityManagerFactoryDependsOnPostProcessor class.

Apply consistent formatting.

Fix issue with Flyway location detection.
2014-06-06 22:56:44 -07:00
Phillip Webb
4a6e66fe8b Polish ConditionalOnJava
Apply formating and simplify the condition implementation. Delegate
to Spring's JdkVersion class to obtain the running version.
2014-06-06 22:56:44 -07:00
Phillip Webb
e032b673a2 Polish DataSourceInitialization code
Rename a few classes and methods relating to DataSourceInitialization
and update the DataSourceInitializedPublisher to check for Hibernate
settings.
2014-06-06 22:56:44 -07:00
Dave Syer
38af1c2eb3 Remove @EnableAutoConfiguration from autoconfigure tests
It was doing scary things (like starting elasticsearch, hornetq etc).
There's still an outstanding question about why the context was
not being properly closed in such a scenario (maybe one of those
embedded servers lurking on a background thread?).

See gh-1034
2014-06-07 06:30:15 +01:00
Dave Syer
09200361de Align expectations of various JMX configurations
They all want to create an MBeanServer and when that happens
user sees no MBeans, or sometimes just one set (Spring Core,
Spring Integration or Spring Boot). To harmonise them we
create a @Bean of type MBeanServer and link to it in the
other autoconfigs

Fixes gh-1046
2014-06-06 17:52:14 +01:00
Oliver Gierke
6f98c63ac0 Add auto-configuration for Jackson's JodaTime and JSR-310 modules
We now register the Jackson JodaTime module with Jackson ObjectMappers
if it is on the classpath. We also register the JSR-310 module if it's
on the classpath and the application is running Java 8 or better.

Extracted the Jackson specific configuration previously residing in
HttpMessageConvertersAutoConfiguration into a JacksonAutoConfiguration
class.

Added the Jackson JSR-310 module as a managed Boot dependency.
2014-06-06 13:22:12 +01:00
Oliver Gierke
30bef1e95e Add @ConditionalOnJava
Added a new @ConditionalOnJava annotation that allows to conditionally
enable configuration based on the Java version that is running. 

The annotation currently supports two modes of restricting Java versions:
the default mode checks for a Java version equal or better than the
requested one. Beyond that it can be configured to only match if Java
version is older than the configured one.
2014-06-06 12:38:51 +01:00
Dave Syer
dff7a3bf7c Remove dead code in ServerProperties 2014-06-06 10:23:47 +01:00
Dave Syer
53cbe74d83 Disable HornetQ by default for testing 2014-06-06 10:01:26 +01:00
Dave Syer
37121e69e6 Make DataSourceInitialization a no-op if there is no DataSource
Fixes gh-1041
2014-06-06 07:19:51 +01:00
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