Commit Graph

504 Commits (39a94428d32cc613966ca394ffdb442ef1fb49c2)

Author SHA1 Message Date
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
11 years ago
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
11 years ago
Dave Syer 6902f2ac97 Revert on bean condition for mongo repositories 11 years ago
Dave Syer dd176ccacf Fix broken test (ordering) 11 years ago
Dave Syer 376d6fb9bc Add test for mixed Mongo/Jpa repositories 11 years ago
Dave Syer e81e94924c Fix Devc->Devic
(Leaving the docs changes for later)

Fixes gh-1049
11 years ago
Craig Walls f2351f1ece Add ProviderSignInController for Spring Social
Update SocialWebAutoConfiguration to add a ProviderSignInController.
Also fix default UserIdSource.

Fixes gh-1050
11 years ago
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
11 years ago
Phillip Webb e891aa3525 Polish 11 years ago
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.
11 years ago
Phillip Webb 4a6e66fe8b Polish ConditionalOnJava
Apply formating and simplify the condition implementation. Delegate
to Spring's JdkVersion class to obtain the running version.
11 years ago
Phillip Webb e032b673a2 Polish DataSourceInitialization code
Rename a few classes and methods relating to DataSourceInitialization
and update the DataSourceInitializedPublisher to check for Hibernate
settings.
11 years ago
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
11 years ago
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
11 years ago
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.
11 years ago
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.
11 years ago
Dave Syer dff7a3bf7c Remove dead code in ServerProperties 11 years ago
Dave Syer 53cbe74d83 Disable HornetQ by default for testing 11 years ago
Dave Syer 37121e69e6 Make DataSourceInitialization a no-op if there is no DataSource
Fixes gh-1041
11 years ago
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.
11 years ago
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
11 years ago
Stephane Nicoll 49697c7ad7 polishing 11 years ago
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
11 years ago
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
11 years ago
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.
11 years ago
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
11 years ago
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
11 years ago
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
11 years ago
Dave Syer 740c132c23 pool -> pool2 11 years ago
Dave Syer 251dbddc6e Use null instead of 'none' for ddlAuto
Fixes gh-1012
11 years ago
Dave Syer 56e70ca585 Introduce subpackages for Spring Data autoconfig
(If we ever want to modularize this will make it less painful)

Fixes gh-1015
11 years ago
Dave Syer bc5a4bcc1e Compiler warnings 11 years ago
Dave Syer 77eaa9b24e Defensive on startup with Multipart config 11 years ago
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
11 years ago
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
11 years ago
Dave Syer efcbb32788 Remove some compiler warnings 11 years ago
Phillip Webb 738d195587 Create JMS sub-packages
Reorganize the `jms` package into `hornetq` and `activemq` sub-pacakges.

Fixes gh-1005
11 years ago
Phillip Webb e5cda040b0 Restore test classes
Restore test classes accidentally deleted and ignored in c43fd04f3e.
11 years ago
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
11 years ago
Artur Konczak 99940337a9 Add support for Elasticsearch
Add auto-configuration and starters for Elasticsearch.

Fixes gh-408
11 years ago
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
11 years ago
Phillip Webb 67beba9464 Switch HSTS enum to upper case.
Since the RelaxedBinder now supports it.
11 years ago
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
11 years ago
Dave Syer 29cb21c322 Be lenient with prefix and add period if missing 11 years ago
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
11 years ago
Phillip Webb 11a093bdc0 Polish 11 years ago
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
11 years ago
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
11 years ago
Phillip Webb 5a5a7be477 Polish 11 years ago
Andy Wilkinson 7a8be3d600 Use Spring Framework bom and fully exclude commons-logging
Closes #955
Closes #978
11 years ago