Commit Graph

165 Commits (72ae5d5a97dec5aa42fda5d391c43bb1df833fe4)

Author SHA1 Message Date
Phillip Webb fa1ff72fb1 Restore quiet logging on startup
Reinstate initializeWithSensibleDefaults() on AbstractLoggingSystem
beforeInitialize(). This is required to ensure no superfluous logging
output occurs when starting up a spring boot application from the
command line.

It appears that commit e9c649dfb2
modified the logic in an attempt to prevent double initialization.

fixes gh-174
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
Dave Syer 0d0de05ae6 Add support for Groovy bean builder sources 11 years ago
Dave Syer 1194fc882b Add feature to SimpleJsonParser
Now it can parse nested lists as map values.

Fixes gh-169
11 years ago
Dave Syer bddf624bcb Merge EnableConfigurationPropertiesTests
Fixes gh-168
11 years ago
Phillip Webb 513c6a1de2 Polish 11 years ago
Phillip Webb 983ef16eae Remove SystemProperties from tests in strict mode
Remove system properties when testing strict property binding. This
prevents test failures that can occur if the local environment happens
to have certain environment variables defined.
11 years ago
johnou e9c649dfb2 Avoid double logging config init + support for slf4j-log4j. 11 years ago
Dave Syer a8c69220c7 Only log startup info (PID etc) for root context
Fixes gh-153
11 years ago
Glenn Renfro 6cf3b91b2e Allow use of underscores in @ConfigurationProperties prefix
Currently the PropertiesConfigurationFilter filters them out.
Thus when deploying to IAAS these environment variables are ignored.

Fixes gh-154
11 years ago
Dave Syer 76ea99ad0b Add instance id suffix to Tomcat Engine name
Fixes gh-160
11 years ago
Dave Syer 4ab77ca893 Added exceptionIfInvalid attribute to @ConfigurationProperties
Default behaviour unchanged, but if you want to ignore validation errors
you can switch them off for indivdual beans now.

Fixes gh-144
11 years ago
Ivan Sopov 40bfd295eb minor fix for javadoc 11 years ago
Dave Syer 4a60e3ccf6 Unignore condition tests 11 years ago
Dave Syer c16b5d277e Add test for Valve added 11 years ago
Dave Syer 6cfbcafc10 Switch to httpcomponents for better error handling in tests 11 years ago
Dave Syer d39fc5bb92 Tidy up some tests 11 years ago
Dave Syer 9db55a3b71 Add explicit test for config file and SpringApplication 11 years ago
Dave Syer 131cfd6114 Update @SpringApplicationConfiguration after comment in 3e6c1b 11 years ago
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.
11 years ago
Dave Syer 67cc427d2b Expose local port in EmbeddedServletContainer 11 years ago
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.
11 years ago
Dave Syer aefec4c16a Check that SessionScope is available early 11 years ago
Dave Syer 564475556e Allow for commandLineArgs to be already present in Environment 11 years ago
Phillip Webb f4f668a52b Polish 11 years ago
Dave Syer aeb0f0a625 Add random.* property source 11 years ago
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
11 years ago
Christian Dupuis e06596ada8 Merge pull request #132 from nitram509/fix-exception-msg-typos
fixed typos in Exception messages
11 years ago
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).
11 years ago
nitram509 cbc9c6a156 fixed 3 x typos in Exception messages 11 years ago
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).
11 years ago
Dave Syer 61dd7d1dbb Add port scan to ServerProperties (server.scan=true)
Also moved ServerProperties to autoconfigure project.
11 years ago
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).
11 years ago
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.
11 years ago
Dave Syer 40b787c71a Add test for allowed/disallowed fields 11 years ago
Dave Syer 6d4d495003 Tweak ApplicationContext ID
VCAP environemt applied consistently, and more tests.

[Fixes #60750138] [bs-351] Add API for application context id
11 years ago
Dave Syer 439f041354 Remove test resources from tests JAR 11 years ago
nitram509 c50fe0733b TomcatEmbeddedServletContainer now fails fast, if there are exceptions during protocol handler startup (re-throw exception) 11 years ago
Dave Syer caffc28b4c Add test for initializers when child context created 11 years ago
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.
11 years ago
Dave Syer 17de6689ab ENsure Vcap initializer runs before config file parser
Fixes gh-119.
11 years ago
Phillip Webb 64f32893bb Source format and clean-up 11 years ago
Phillip Webb 883fd9162f Polish 11 years ago
Phillip Webb 6a6159f106 Add JVM uptime to startup info log output 11 years ago
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).
11 years ago
Dave Syer 811bd32ce2 More sensible signature for servlet initializer 11 years ago
Phillip Webb a9a6077fdb Polish SpringApplicationErrorHandler 11 years ago
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
11 years ago
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?
11 years ago
Dave Syer c2488b1a9b Flush output streams in capture
Avoids possible test failures owing to unflushed buffers
11 years ago