Commit Graph

170 Commits

Author SHA1 Message Date
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.
2013-12-20 19:49:48 +00:00
Dave Syer e2c962ac28 Switch to thymeleaf-spring4 2013-12-19 13:40:24 +00:00
Christian Dupuis b694556483 Set JMX export on by default 2013-12-19 08:47:22 +01:00
Phillip Webb dbec81cabe Disable jmx by default
Change JmxAutoConfiguration so that by default JMX exposure is not
enabled. This matches the Javdoc text.
2013-12-18 22:32:39 -08:00
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
2013-12-18 09:55:06 -08:00
Dave Syer 997b015d10 Split SecurityAutoConfiguration
Spring Security 3.2 has a new annotation @EnableWebMvcSecurity that we
should use if MVC is being used.
2013-12-17 17:17:05 +00:00
Dave Syer 72bfd4ce68 Protect HttpMessageConverters if MVC is not available 2013-12-17 17:17:05 +00:00
Dave Syer 3789424f22 Add JodaModule bean if detected on classpath
Fixes gh-146
2013-12-17 14:22:18 +00:00
Dave Syer bdcb94a139 Remove initialization concerns fom HttpMessageConverters 2013-12-17 09:02:16 +00:00
Phillip Webb 513c6a1de2 Polish 2013-12-16 14:38:52 -08:00
Phillip Webb 85fb1cba0b Rework HttpMessageConverters 2013-12-16 14:38:48 -08:00
Dave Syer b72002142d Split MessageConverters auto config out into separate class 2013-12-16 16:13:39 +00:00
Dave Syer c78973e375 MessageConverters -> HttpMessageConverters 2013-12-15 13:33:50 +00:00
Dave Syer 370501f4a9 Add test and fix bug in MessageConverters 2013-12-15 10:06:27 +00:00
Dave Syer c2b499c775 Support for @Beans of type HttpMessageConverter, and Jackson specific details
You can contribute additional HttpMessageConverters
by simply adding beans of that type in a Spring Boot
context. If a bean you add is of a type that would have been included
by default anyway (like MappingJackson2HttpMessageConverter for JSON
conversions) then it will replace the default value. A convenience
bean is provided of type MessageConverters (always available if you
use the default MVC configuration) which has some useful methods to
access the default and user-enhanced message converters (useful, for
example if you want to manually inject them into a custom
RestTemplate).

There are also some convenient configuration shortcuts for Jackson2.
The smallest change that might work is to just add beans of type
Module to your context. They will be registered with the default
ObjectMapper and then injected into the default message
converter. In addition, if your context contains any beans of type
ObjectMapper then all of the Module beans will be registered with
all of the mappers.
2013-12-14 22:05:30 +00:00
Christian Dupuis 2b16a4af39 Fix failing test due to change in JMX export default setting 2013-12-13 23:32:53 +01:00
Dave Syer c40d0aba0d Document switching off DispatcherServlet 2013-12-12 17:32:58 +00:00
Christian Dupuis 5c6a0fd472 Enabled JMX export auto configuration by default 2013-12-12 17:52:33 +01:00
Dave Syer 9c2b34f188 Allow default DispatcherServlet to be switched off more easily
All a user has to do now is declare a bean with name "dispatcherServlet".
2013-12-12 16:47:09 +00:00
Christian Dupuis b931cce386 Auto configuration support for JMX export 2013-12-11 21:31:10 +01:00
Dave Syer cf05a5d578 Fix @Conditional for Batch command line runner
Previously it was @ConditionalOnMissingBean(CommandLineRunner.class)
which caued obvious problems when user wanted to add an unrelated
CLR.

Extended feature set so that a JobRegistry can also be used (with
spring.batch.job.name) and the whole idea can be switched off with
spring.boot.job.enabled.
2013-12-11 14:00:20 +00:00
Dave Syer cf53b76430 Remove another annotation= attribute
Hopefully really fixes gh-151
2013-12-10 17:14:27 +00:00
Dave Syer ed8d161d33 Remove debug logging on stderr 2013-12-10 09:24:32 +00:00
Dave Syer 2543ef7072 Change @Conditional for existing security configuration
Fixed by using `WebSecurityConfiguration` to detect existing
security configuration (not the annotation).

Fixes gh-151
2013-12-09 09:48:40 +00:00
Dave Syer f57c8f52bf Check for null before trying to use ApplicationContext
Fixes gh-145
2013-12-05 08:54:13 +00:00
Dave Syer 33c38b3a51 Remove inaccurate TODO 2013-12-04 14:57:44 +00:00
Dave Syer 322b03779d Upgrade Thymeleaf and Spring 2013-12-03 12:30:31 +00:00
Dave Syer 2104d9a1e2 Prevent failure of web app with parent context
ServerProperties formerly had an @OnMissingBeanCondition
that didn't restrict the hierarchy. It also asserts that
the current context (not including parents) contains such
a bean. This led to an inevitable failure when there was
an existing instance in the parent context.

Fixed by a) searching only the current context, b) not
adding a ServerProperties bean if the context is not a
web app.
2013-11-29 17:40:16 +00:00
Dave Syer c03a06b52d Add test for customize container factory 2013-11-29 17:26:17 +00:00
Dave Syer 4a60e3ccf6 Unignore condition tests 2013-11-29 17:20:30 +00:00
Dave Syer a4cb09c4eb Unignore some tests 2013-11-29 17:12:54 +00:00
Dave Syer 259e6a6ec1 RedisProperties prefix -> spring.redis 2013-11-28 15:12:55 +00:00
Dave Syer 16222270b8 Improve reporting of SpEL condition matching 2013-11-28 13:08:19 +00:00
Dave Syer 20bede21ad Add support for parent hierarchy in AUtoConfigurationReport 2013-11-28 11:39:27 +00:00
Dave Syer d1dcb015b6 Ensure only supported listeners are instantiated
Previously all EventListeners were eagerly instantiated
but that can cause problems because it happens quite early
in the lifecycle. Better to be explicit about the
supported types.
2013-11-27 15:04:05 +00:00
Dave Syer 7ef9688d99 Javadocs clarification of role of DispatcherServlet 2013-11-27 10:21:38 +00:00
Dave Syer 94e2f90793 Ensure endpoints.jolokia.enabled=false switches off jolokia 2013-11-26 13:27:10 +00:00
Phillip Webb f4f668a52b Polish 2013-11-25 17:12:56 -08:00
Dave Syer a9e4400f82 Add test for PropertyPlaceholderAutoConfiguration 2013-11-25 16:07:07 +00:00
Dave Syer 8efa2fc569 Use server.port=0 for scanning
This leverages existing capabilities of teh JDK and the OS
to grab a port at random and not have it stolen by another
process. It's very hard to avoid that race condition in
pure Java code, so why bother?

User can set port<0 to disable autoStart of connectors (e.g.
to start a web application context but not have it listen on
any port). In that case the actual socket port will be set to
0 (and therefore if it ever starts up the local port will
be random).
2013-11-23 11:26:58 +00:00
Dave Syer 59f07d37ab Scan for port near default 2013-11-22 19:59:19 +00:00
Dave Syer 61dd7d1dbb Add port scan to ServerProperties (server.scan=true)
Also moved ServerProperties to autoconfigure project.
2013-11-22 16:56:43 +00:00
Dave Syer bd26b28aa5 Extract actuator security into separate classes
So spring-security + a web app is secure by default
(you don't need the actuator).
2013-11-21 16:47:29 +00:00
Dave Syer 285dd5b270 ApplicationContextInitializers now listen for ContextRefreshedEvent
The AutoConfigurationReportLoggingInitializer wasn't working in
non-GenericApplicationContext becasue teh BeanFatcory wasn't available
for registering its listener during initialization. Instead of
relying on that rather fragile state I decided to give any
ApplicationContextInitializer that was itself an ApplicationListener
an explicit callback with a ContextRefreshedEvent, and move that
interface up a level in the logging initializer. Works much better.
2013-11-21 09:35:00 +00:00
Dave Syer 06c16ae452 Only check for singleton in AutoConfigurationReportLoggingInitializer
Using containsBean() involves looking in the parent bean factory
if there is one, and that would mean that the same report woykd be used
for multiple contexts, which wouldn't make sense.
2013-11-20 11:42:32 +00:00
Dave Syer faf02a21ab Prevent @Bean method from being called during @PreDestroy 2013-11-20 11:19:54 +00:00
Dave Syer fce48c00c7 Really fix it 2013-11-20 09:10:25 +00:00
Dave Syer 71cd1926b9 Fix test on command line 2013-11-20 08:58:45 +00:00
Dave Syer 156ef3f1a0 Weird build problem? 2013-11-19 09:16:37 +00:00
Dave Syer ded9020916 Allow Batch datbase initializer to be disabled 2013-11-19 09:03:43 +00:00