Commit Graph

315 Commits (26e55e5b556227ab1e597e77b8ff8e2bff5e3aa7)

Author SHA1 Message Date
Phillip Webb 99350a2216 Tidy ConfigurableEmbeddedServletContainerFactory
Rename ConfigurableEmbeddedServletContainerFactory to
ConfigurableEmbeddedServletContainer and extract
AbstractConfigurableEmbeddedServletContainer from
AbstractEmbeddedServletContainerFactory.
11 years ago
Phillip Webb 3f9ca68812 Tweak ConfigurableEmbeddedServletContainerFactory
Update ConfigurableEmbeddedServletContainerFactory to no longer directly
extend EmbeddedServletContainerFactory.
11 years ago
Phillip Webb 9c4dc0c68f Drop getPort from ConfEmbServletContainerFactory
Remove getPort() from ConfigurableEmbeddedServletContainerFactory to
keep the interface primarily setters.
11 years ago
Phillip Webb 468728a2c0 Polish 11 years ago
Dave Syer 07b88630f4 Be defensive with auto-config of Servlet 3.0 features
There's no explicit support for older Servlet specs in Spring Boot,
but we can at least make it easy for others to provide such
support by not adding stuff to the context when in an older container.
11 years ago
Dave Syer b0b7bc0e7f Fix tests
Some assumptions were being made in tests, e.g. about
there being an AuthenticationManager @Bean, which were
false with the new Security 3.2.1 updates from Rob.

Also parent-child contexts with the actuator were
problematic because they didn't exclude the web configuration
for the management security in the parent context.

Fixes gh-244
11 years ago
Rob Winch 6b0eba3759 Update to Spring Security 3.2.1
Also change strategy for defaulting of Authentication. Spring
Boot authentication defaults are now encapsulated and can easily
be overridden by a user defined AuthenticationManager.
11 years ago
Dave Syer 29982f5946 Add @Configuration to WebMvcAutoConfigurationAdapter 11 years ago
Phillip Webb 083cb388c0 Upgrade to Spring Security 3.2.1
Fixes gh-392
11 years ago
Oliver Gierke af458cb253 Upgrade to Spring Data Codd GA release.
Adapt auto-configuration code to use the new constructor introduced
in Spring Data Commons' AnnotationConfigurationSource.

Fixes gh-365
11 years ago
Phillip Webb cf23b519d2 Polish 11 years ago
Dave Syer 8947307702 Add retry and parameter increment logic to job runner
The existing behaviour of JobLauncherCommandLineRunner was really too
basic. It has now been enhanced (at the expense of duplicating a lot
of code in Spring Batch it seems) to automatically increment job
parameters if it can, and to retry a failed or stopped execution
if it can (without incrementing, but with additional job parameters
added from command line if they are non-identifying).

The JobLauncherCommandLineRunner is more extendable and exposes
its DI wiring points now as well, so hopefully users can make
use of it independently of autoconfig (by providing a @Bean of
that type).

Not everything from the wishlist in gh-325 is implememented yet,
but it should be a good platform to work with and to extend.
11 years ago
Dave Syer 09f3ee14a4 Skip unnecessary attempt at executing Job
...that was already executed as part of the "local" set.

Also added some howto docs on executing Batch jobs.

See gh-382
11 years ago
hoserdude 3ad6c96ce5 Adding support for multiple configured job names 11 years ago
Dave Syer f38a36ff70 Fail on startup if Thymeleaf template directory missing
Better even than logging would be to fail fast? Surely it's a
mistake not to have any /templates if Thymeleaf is in use.
User can disable failfast by exlcuding thymeleaf configuration
or by providing their own ITemplateResolver.

Fixes gh-294
11 years ago
Dave Syer 8d9c26b2df Switch default to fail on error in SQL initialization
User can switch the behaviour on and off with
spring.datasource.continueOnError:true|false. I decided
not to add an extra nested level of property resolution
because of the existing spring.datasource.schema
(and other properties relating to initialization) because
concision seemed like a good thing with those more common
settings.

Fixes gh-374
11 years ago
Christian Dupuis b2327cb5f9 Fix comment 11 years ago
Dave Syer b2b487ee5f Add ServletRegistrationBean for DispatcherServlet
Mapping is exposed via server.servletPath.

Fixes gh-379
11 years ago
Dave Syer 44b877cd7d Remove @ConditionalOnBean(DataSource.class) from JPA config
Stacktrace is then obviously about DataSource, not EntityManager.

Fixes gh-375
11 years ago
Dave Syer 6631dd025c Ensure DispatcherServlet is available in a deployed WAR
The DispatcherServletAutoConfiguration had a condition on it that
meant it wasn't used at all if there was no EmbeddedServletContainerFactory.
It's amazing that any WAR ever deployed.

Also added some info logging to servlet and filter registrations.
11 years ago
Jakub Kubrynski 5d591edbf8 Consider FactoryBean classes in OnBeanCondition
Update OnBeanCondition to attempt to consider FactoryBean classes
for bean type matches. To ensure early instantiation does not occur, the
object type from the FactoryBean is deduced by resolving generics on the
declaration.

Fixes gh-355
11 years ago
Dave Syer fc4aabde75 Add some test cases and comments
In response to gh-352
11 years ago
Spring Buildmaster 1367d57e8c Next development version 11 years ago
Spring Buildmaster eaff1677a7 Release version 1.0.0.RC3 11 years ago
Phillip Webb 4a58171b5c A few more package tweaks
Improve package structure and include package-info javadoc.
11 years ago
Oliver Gierke 929bd902be Upgraded to Spring Data Codd
Update AbstractRepositoryConfigurationSourceSupport to use the newly
introduced RepositoryConfigurationDelegate instead of effectively
reimplementing Spring Data Commons functionality which was prone to
changes in the API (code that wasn't considered to be API in the first
place).

Switch from implementing BeanClassLoaderAware to ResourceLoaderAware
to avoid having to set up a DefaultResourceLoader which should also
improve IDE integration.

Fixes gh-236
11 years ago
Phillip Webb ed9735361e Apply source cleanup and formatting 11 years ago
Phillip Webb 80f2336f17 Polish 11 years ago
Phillip Webb 0b7eda89d4 Don't eagerly initialize FactoryBeans
Fix `EmbeddedServletContainerAutoConfiguration` so that it does not
accidentally eagerly initialize factory beans.

Fixes gh-306
11 years ago
Phillip Webb 8763fab0e7 Extract inner configuration property classes
Extract all inner @ConfigurationProperties classes from @Configuration
classes for consistency.
11 years ago
Phillip Webb 5188ee5266 Extract Mongo auto-configuration from Spring Data
Extract Mongo auto-configuration classes from Spring Data specific
auto-configuration, allowing Mongo to be used without Spring Data
if require.
11 years ago
Oliver Gierke cf4df1befb Improve Mongo auto-configuration
Disable Mongo auto-configuation when @EnableMongoRepositories is used
and adapt the test helper classes accordingly.

Change the property prefix and dependency management version property
from `...mongo` to `...mongodb` for consistency with Spring Data.

Fixes gh-315
11 years ago
Phillip Webb 37c2c89bcb Restructure packages
Improve package structure and attempt to co-locate related classes.
11 years ago
Phillip Webb f7d4490b2d Fix package tangle with AutoConfigurationReport
Rename AutoConfigurationReport to ConditionEvaluationReport and
co-locate with conditions.
11 years ago
Phillip Webb 6431fef91e Polish 11 years ago
Phillip Webb 643295cc3c Separate Application Listener and Initializer
Update SpringApplication so that ApplicationListener and
ApplicationInitializer methods must be called separately. This helps
to prevent unexpected side effects when calling the setters and
also encourages separation of concerns.

The few situations where a class was both an ApplicationInitializer
and ApplicationListener are now handled by registering an inner
listener from the `initialize` method.
11 years ago
Phillip Webb 92f01cf9bc Rename SpringApplication Events
Move SpringApplication events to their own package, create a common
base class and rename classes to match Spring conventions.
11 years ago
Christian Dupuis 8a55fbebb2 Allow pretty printed JSON output (nicer for demos and easier to read)
Defaults to false
11 years ago
Dave Syer 2bd6026a2a Exclude null and empty properties from /autoconfig 11 years ago
Dave Syer a21397dbe2 Fix AutoConfigurationReport parent location
BeanFactory.getBean() already looks in the parent context
so we have to be careful and not use the parent when locating
the report singleton

Fixes gh-290
11 years ago
Dave Syer a592215651 Use non-deprecated API to create Mongo client 11 years ago
Dave Syer 63fefbd7e7 Assert that parent autoconfig report is matched to parent BeanFactory
Test for gh-290
11 years ago
Dave Syer 9eb71c157a Remove unnecessary @Conditional 11 years ago
Dave Syer 4d608f20e9 Support for AuthenticationManagerBuilder injection into user code
Spring Boot provides a default AuthenticatiomManager for getting
started quickly with security and never exposing insecure
endpoints. To override that feature as users move to the next
stage in their project, they may have to do something slightly
different depending on whether it is a webapp or not.

In any app (web or not), providing a @Bean of type
AuthenticationManager always works, but you don't get the benefit of
the builder features.

In a webapp the user can also extend WebSecurityConfigurerAdapter
to provides a custom AuthenticationManager, and the preferred
way of doing that is via a void method that is autowired with an
AuthenticationManagerBuilder. The default AuthenticationManager is
built in a configurer with @Order(LOWEST_PRECEDENCE - 3) so
to override it the user's confugrer must have higher precedence
(lower @Order).

@EnableGlobalMethodSecurity can also be used in a non-webapp, and
Spring Boot will still provide a default AuthenticationManager.
To override it the user has to either extend
GlobalMethodSecurityConfiguration or provide a @Bean of type
AuthenticationManager (there's no other way to
capture the AuthenticationManagerBuilder that doesn't happen too late
in the beans lifecyle).

Fixes gh-244
11 years ago
Christian Dupuis efe8494f46 Remove hard coded bean names for couple of @ConfigurationProperties beans 11 years ago
Phillip Webb bcd74bb72d Remove custom JodaModule support
Remove the custom JodaModule support which is not necessary with
Spring 4.0.1.

Fixes gh-186
11 years ago
Phillip Webb b34102c30c Polish 11 years ago
Dave Syer 6528062a49 Use custom condition to detect Hibernate 4.2 and 4.3
...without any deprecation warnings and with some chance that it will
still work with Hibernate 5.

Fixes gh-256
11 years ago
Dave Syer 8d05cd1fb6 Allow hibernate.version as synonym in dependency management 11 years ago
Dave Syer 19ca4d4eae Add destroyMethods to DataSources 11 years ago
Dave Syer 76b15c4446 Add spring.messages.encoding (default utf-8)
Fixes gh-260
11 years ago
Dave Syer dac1b53fda Don't mask original exception in SpringApplication.handleError
If any @Import (or @Enable*, especially @EnableScheduling) has registered
bean *names* as ApplicationListeners, and the application context wasn't
refreshed fully when it failed, then the listener lookup could fail and
mask the original exception

Fixes gh-253
11 years ago
Dave Syer 195eb9f9bc Updates to redis repositories
* Ensure prefix ends with period
* Allow prefix and key index to be set separately
11 years ago
Phillip Webb 43e54d38f7 Make fields private where possible 11 years ago
Phillip Webb 0160760568 Apply latest eclipse cleanup rules 11 years ago
Phillip Webb ac54d7fe3c Final polish before 1.0.0.RC1 11 years ago
Phillip Webb cdda330acd Update copyright header for files changed in 2014 11 years ago
Dave Syer ea3b82091b Tweak javadocs in SprinApplicationBuilder 11 years ago
Dave Syer 8f4059147c Revert "Upgrade to Tomcat 7.0.50"
This reverts commit 3d60696b9b.
11 years ago
Phillip Webb 68293f34af Upgrade version to 1.0.0.BUILD-SNAPSHOT
Fixes fg-243
11 years ago
Phillip Webb 3d60696b9b Upgrade to Tomcat 7.0.50
Upgrade to Tomcat 7.0.50, working around the potential
NullPointerException by also adding dependencies to
tomcat-embedded-jasper (which is now also required for Hibernate
Validator 5.0, see commit 377953babd)

Fixes gh-245
11 years ago
Phillip Webb 56364ecd46 Allow custom PersistenceUnitManager with JPA
Allow JPA auto-configuration to use an optional custom
PersistenceUnitManager defined as a bean.

Fixed gh-238
11 years ago
Dave Syer 8db1d0e044 Fix some TODOs 11 years ago
Dave Syer 07da034571 Allow @EnableTransactionManagement to be supplied by user 11 years ago
Christopher Smith 25cc68cafe Add spring.resources.cachePeriod to MvcAutoConfiguration
Fixes gh-232
11 years ago
Phillip Webb f103a976f8 Don't use @ComponentScan for default packages
Update the 'default' package used for @Entity and Repository scanning
to be the package of the class annotated with @EnableAutoConfiguration
rather than using @ComponentScan.

This allows JPA and Spring Data to be used without requiring component
scanning and also removes the confusion that could arise from reusing
the @ComponentScan annotation, which already has well defined semantics.

Fixes gh-200
11 years ago
Phillip Webb b85f984349 Refine auto-configuration report log levels
Refine the `AutoConfigurationReportLoggingInitializer` log level to
only display the information about enabling debug if the debug level
if not on.

Fixes gh-199
11 years ago
Phillip Webb 53f1488f70 Don't automatically log auto-configuration report
Update the `AutoConfigurationReportLoggingInitializer` to only output
the report at debug level. A crash report now triggers an info output
suggesting the user runs again with '--debug' to display the report.

Fixes gh-199
11 years ago
Phillip Webb 312535bcd5 Add SpringNamingStrategy to improve FK names
Add a new `SpringNamingStrategy` hibernate `NamingStrategy` that
extends `ImprovedNamingStrategy` to improve the name of foreign
key columns.

Fixes gh-213
11 years ago
Andy Wilkinson b45683f103 Only auto-configure Reduce if Lettuce is on the classpath
Fixes #226
11 years ago
Phillip Webb ffe8bf5419 Remove unused .gitignore files 11 years ago
Phillip Webb 47da8a817a Polish 11 years ago
Christian Dupuis 62e02d3d81 Add initialSize configuration property to datasource auto configuration
fixes #206
11 years ago
Christian Dupuis 1a44b3e676 Fix sorting of auto configuration classes on JDK 8 11 years ago
Dave Syer 2377bd9ec9 Don't load BatchAutoConfiguration at all if there is no JobLauncher
Fixes gh-204
11 years ago
Dave Syer b1db714c23 Allow @EnableGlobalMethodSecurity in a non webapp
Fixes gh-202
11 years ago
Dave Syer aebaa580db Add test for user overriding @EnableJpaRepositories 11 years ago
Dave Syer c8152bfc70 SpringBootTestUtils->EnvironmentTestUtils 11 years ago
Dave Syer 478e655758 Change algorithm for determining active profile from external config
Instead of adding active prpfiles for every one we encounter, we need to
build up a complete "default" Environment and then ask it what the active
profiles are. Implemented in ConfigFileApplicationListener.

Fixes gh-198
11 years ago
Dave Syer 561cb3a50f TestUtils -> SpringBootTestUtils 11 years ago
Dave Syer 321ce3aad2 TestUtils -> SpringBootTestUtils 11 years ago
Dave Syer 147968cf83 Set isolation to DEFAULT for JPA transaction manager
Also logs a warning about the fact that locks may not be taken when
starting a Job. JPA and Batch don't really work that well together
in general so it's probably not worth a lot of effort to work aoround
this. If anyone needs to they should create a custom JpaDialect
(and a BatchConfigurer).

Fixes gh-197
11 years ago
Dave Syer 633dea9d80 Add declarative ApplicationListener 11 years ago
Dave Syer 441572c61c Migrate config file initializer to a listener 11 years ago
Dave Syer 3dacf4be17 Migrate Logging and Liquibase initializers to be listeners 11 years ago
Dave Syer 27ae6a5fd6 Add ApplicationListener as first class component in Spring Application 11 years ago
Phillip Webb 751beda2cb Additional fixes for auto-configuration report
Fix the following issues that were introduced in commit 0610378:

- Formatting of code including imports
- Improve hashcode/equals implementations by using ObjectUtils
- Provide hashcode/equals for ConditionOutcome
- Use LinkedHashSet in ConditionAndOutcomes to maintain insert order

Fixed gh-127
11 years ago
Greg Turnquist 0610378d2f Resolves #127: Prevent duplicate report outcomes
The collection of outcomes is a list. Sometimes a race condition causes to instances
of the same outcome to get added to the list shown in the report. By replacing this
with a set and propery equals/hashCode, duplicates are prevented from appearing
in the report.

I added test cases to prove that that POJO is properly managed inside a Set and also
to show that duplicates don't appear in the final report.
11 years ago
Dave Syer c71322a0b2 Add a BatchConfigurer so the transaction manager can adapt to JPA
Autoconfiguration ordering has to be adjusted so that a DataSource is
available before an EntityManagerFactory is ever needed. Previously
the autoconfigs were accidentally loaded in the right order, but after
the change to BatchAutoConfiguration the order has to be explicit.

Fixes gh-189
11 years ago
Phillip Webb 1bcd3de7b5 Polish 11 years ago
Phillip Webb 7623c291a2 Attempt to fix failing CI build 11 years ago
Oliver Gierke d39a8360b7 Added support to allow manually declaring a EntityManagerFactoryBean.
Added the necessary @ConditionalOnMissingBean annotations to allow selectively declaring an EntityManagerFactoryBean, a JpaVendorAdapter or a PlatformTransactionManager. Especially the first one might be necessary to make sure the persistence provider evaluates an orm.xml. This unfortunately rules out using the packages to scan feature of Spring's LCEMFB.

I've filed https://jira.springsource.org/browse/SPR-11260 to potentially remove the need for this workaround in Spring itself.
11 years ago
Dave Syer fe1336edcc Add JobExplorer and JobOperator 11 years ago
Dave Syer c94fb7fc53 Fix bizarre compiler error 11 years ago
Dave Syer 6c4ee0b05d Add PoolConfig to Redis 11 years ago
Dave Syer fa507005cd Use ServletWrappingController for jolokia instead of Servlet
We get more control over the handling and in particular the registration
of the endpoint this way. It was practically impossible to disable the
AgentServlet bean when in a parent context of the management server
because of lifecyce issues - you don't know that the user wants a
separate management server until too late.

This approach also makes it possible to test with spring-test MVC
support.
11 years ago
Dave Syer e2c962ac28 Switch to thymeleaf-spring4 11 years ago
Christian Dupuis b694556483 Set JMX export on by default 11 years ago
Phillip Webb dbec81cabe Disable jmx by default
Change JmxAutoConfiguration so that by default JMX exposure is not
enabled. This matches the Javdoc text.
11 years ago
Phillip Webb 7c57541d50 Filter duplicates from SpringFactories loading
Filter duplicate class names when loading spring.factories files. The
prevents errors if -source jars are included on the classpath.

fixes gh-161
11 years ago