Commit Graph

152 Commits

Author SHA1 Message Date
Dave Syer 4a60e3ccf6 Unignore condition tests 2013-11-29 17:20:30 +00:00
Dave Syer c16b5d277e Add test for Valve added 2013-11-29 17:06:08 +00:00
Dave Syer 6cfbcafc10 Switch to httpcomponents for better error handling in tests 2013-11-29 16:56:17 +00:00
Dave Syer d39fc5bb92 Tidy up some tests 2013-11-28 17:35:48 +00:00
Dave Syer 9db55a3b71 Add explicit test for config file and SpringApplication 2013-11-28 16:46:21 +00:00
Dave Syer 131cfd6114 Update @SpringApplicationConfiguration after comment in 3e6c1b 2013-11-28 15:45:57 +00:00
Dave Syer 3e6c1b435f Add @SpringApplicationConfiguration (for integration testing)
Example:

    @RunWith(SpringJUnit4ClassRunner.class)
    @SpringApplicationConfiguration(classes = SampleDataJpaApplication.class)
    public class CityRepositoryIntegrationTests {

    	@Autowired
    	CityRepository repository;

Fixes gh-66.
2013-11-28 14:35:36 +00:00
Dave Syer 67cc427d2b Expose local port in EmbeddedServletContainer 2013-11-27 15:50:46 +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 aefec4c16a Check that SessionScope is available early 2013-11-27 14:04:09 +00:00
Dave Syer 564475556e Allow for commandLineArgs to be already present in Environment 2013-11-26 10:00:50 +00:00
Phillip Webb f4f668a52b Polish 2013-11-25 17:12:56 -08:00
Dave Syer aeb0f0a625 Add random.* property source 2013-11-25 15:08:53 +00:00
Dave Syer 94c5203de6 Add more smarts to properties binding
* Underscores are allowed as nested property field separators
* System and env vars are only considered for binding if they
look like they apply to a given bean when ignoreUnknownFields
is false
2013-11-25 15:08:53 +00:00
Christian Dupuis e06596ada8 Merge pull request #132 from nitram509/fix-exception-msg-typos
fixed typos in Exception messages
2013-11-25 02:25:17 -08:00
Dave Syer 98ae4ed928 Add ignoreNestedFields option to @ConfigurationProperties
@ConfigurationProperties(ignoreUnkownFields=false,ignoreNestedFields=true)
is now a useful option for binding to "top-level" command line options
(without a prefix). In that case we don't try to bind to `server.*` and
other common prefixed property values (at the cost of not being able to
bind to nested beans).
2013-11-25 09:15:09 +00:00
nitram509 cbc9c6a156 fixed 3 x typos in Exception messages 2013-11-24 13:40:50 +01: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 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 40b787c71a Add test for allowed/disallowed fields 2013-11-20 15:59:46 +00:00
Dave Syer 6d4d495003 Tweak ApplicationContext ID
VCAP environemt applied consistently, and more tests.

[Fixes #60750138] [bs-351] Add API for application context id
2013-11-20 10:55:14 +00:00
Dave Syer 439f041354 Remove test resources from tests JAR 2013-11-20 08:41:10 +00:00
nitram509 c50fe0733b TomcatEmbeddedServletContainer now fails fast, if there are exceptions during protocol handler startup (re-throw exception) 2013-11-19 13:35:06 +00:00
Dave Syer caffc28b4c Add test for initializers when child context created 2013-11-19 09:03:43 +00:00
Dave Syer 71fd474ed2 Ensure ApplicationContextInitializers are not overwritten
SpringApplicationBuilder has to be careful not to overwrite the
default initializers if user calls its initializers() method.

Fixes gh-120.
2013-11-18 09:59:11 +00:00
Dave Syer 17de6689ab ENsure Vcap initializer runs before config file parser
Fixes gh-119.
2013-11-17 15:29:12 +00:00
Phillip Webb 64f32893bb Source format and clean-up 2013-11-16 00:08:18 -08:00
Phillip Webb 883fd9162f Polish 2013-11-16 00:08:17 -08:00
Phillip Webb 6a6159f106 Add JVM uptime to startup info log output 2013-11-15 15:41:51 -08:00
Dave Syer 8bc5e9c36c Refine semantics of server.port=0
If the server port is 0 it doesn't mean you don't want *any* container
because there might still be servlet context aware components in the
classpath. Better to try and stop the server from actually starting.

This change is a step in the right direction: it prevents the server
from starting in the start() method (even though for technical reasons
it may have already been started and stopped in initialize()).

N.B. Tomcat at least uses port=0 as a signal it should pick a random
port. Pertty useful feature that we may want to capitalize on at some
point (on the other hand having our own port scanner would be useful
generally too).
2013-11-14 14:59:30 +00:00
Dave Syer 811bd32ce2 More sensible signature for servlet initializer 2013-11-07 14:03:58 +00:00
Phillip Webb a9a6077fdb Polish SpringApplicationErrorHandler 2013-11-06 15:40:09 -08:00
Dave Syer 8922a6be4a Ignore exceptions while resolving placeholders in PropertySources
When a PropertySourcesPropertyValues is used to bind Environment
values to a bean (or the SpringApplication) it tries to resolve
placeholders eagerly in the Environment. Any that fail might not
actually be a problem for users (until validation is done it's
impossible to tell even whether that value was needed for the
ongoing binding or not).

Fixed by ignoring exceptions in the PropertySourcesPropertyValues
constructor.

Fixes gh-108
2013-11-06 14:16:31 +00:00
Dave Syer 7cf98d15f2 Tidy up log tests
Bamboo doesn't seem to be causing issues now, so assume
[Fixes #52871199] [bs-176] -Djava.util.logging.config.file
is passed to log4j as a file name?
2013-11-06 13:54:11 +00:00
Dave Syer c2488b1a9b Flush output streams in capture
Avoids possible test failures owing to unflushed buffers
2013-11-06 13:19:04 +00:00
Andy Wilkinson 24486eb68c Use legal java.util.logging levels in logging.properties 2013-11-06 12:17:36 +00:00
Dave Syer b07c2f0b34 Set default log levels same for all systems 2013-11-06 11:40:23 +00:00
Phillip Webb 4c75700164 Detect Tomcat start failures
Detect if the tomcat container fails to start and propagate an
exception to the caller.
2013-11-05 17:00:14 -08:00
Phillip Webb bec1c8f00f Polish 2013-11-04 22:17:38 -08:00
Dave Syer 0def447750 More care required getting beans early in lifecycle 2013-11-04 18:16:30 +00:00
Dave Syer 089233e472 Add SpringApplicationErrorHandler
[#48055575] [bs-31] Add hooks for failed application context startup
2013-11-04 17:07:04 +00:00
Dave Syer f6e6831f25 Correct copy-paste errors in javadocs 2013-11-04 10:39:05 +00:00
Dave Syer c5cfe54c80 Add spring-boot tests to test starter 2013-11-01 14:39:03 +00:00
Dave Syer 217ec5d564 Avoid registering ConfigurationPropertiesBindingPostProcessor twice 2013-11-01 11:57:47 +00:00
Dave Syer e005ba7232 SpringApplicationBuilder.properties fixes
Previously: properties(Map) behaved differently to
properties(String...).

Fixed by merging the implementations.

Also added properties(Properties).
2013-11-01 08:42:14 +00:00
Dave Syer 8d186945e7 Use RelaxedNames to search for prefix in RelaxedBinder
RelaxedDataBinder now supports "env var" style variables that include the
path prefix, e.g. FOO_BAR_BAZ=boom will bind to a bean with property "baz"
and a binder with prefix "foo.bar".

Fixes gh-98
2013-10-28 17:59:23 -04:00
Phillip Webb eff587d5b0 Create CliTester JUnit @Rule
Extract logic from SampleIntegrationTests into a reusable JUnit @Rule.
2013-10-28 07:38:07 -07:00
Andreas Kluth 19b74461e4 Update README.md
- Found typo while reading.
2013-10-25 15:07:48 -04:00