Commit Graph

499 Commits

Author SHA1 Message Date
Phillip Webb
f8bf0e2031 Polish 2014-07-28 15:40:40 -07:00
Andy Wilkinson
32a19f590d Enable test that relies on class and groovy script configuration
Since Spring 4.0.4, it's now possible to use both classes and
locations to provide a test's configuration.

Closes #1300
2014-07-28 15:39:45 +01:00
Andy Wilkinson
bd577f1515 Rework Jetty startup so connectors are only started once
Previously the server was started to make the ServletContext
available, then, to prevent requests from being handled before the
application context had been started, the connectors were stopped.
Once application context startup had completed, the connectors were
then started again. In addition to being somewhat inefficient, this
caused problems on FreeBSD where stopping the connector didn't free
up the port quickly enough for the subsequent start to then be able
to bind to it.

This commit updates the Jetty startup logic to be closer to the logic
that's used for Tomcat. Before the server is started, the configured
connectors are cached and then removed. The server is then started
without any connectors. Once application context startup has
completed, the connectors are reinstated and started.

Fixes #968
2014-07-28 14:38:11 +01:00
Dave Syer
8c15b13fda Change private method name 2014-07-25 08:45:40 -07:00
Dave Syer
32ede50d19 Extract property sources from composite when binding
Often this change will not be important because you are binding to
a bean with strongly typed properties. A bean with a Map property,
on the other hand, won't oytherwise be able to reason about the
permitted keys so it will miss any non-enumerable property sources,
including composites whose nested sources are themselves enumerable.

Fixed gh-1294
2014-07-25 08:34:30 -07:00
Dave Syer
300e570f68 Reverse priority of property sources when extracting sub properties
Fixes gh-1259
2014-07-21 15:09:23 +01:00
Dave Syer
4a33ab5577 Make sure ErrorPageFilter is only applied once per request
Fixes gh-1257
2014-07-17 14:20:29 +01:00
Dave Syer
8853c7c352 Ensure properties that are not enumerable can be resolved from placeholders
Before this change a property whose key was in a non-enumerable property source would
not resolve placeholders, leading to ${style} values in @ConfigurationProperties beans
even if the placeholders ere resolvable.
2014-07-17 09:02:04 +01:00
Ilayaperumal Gopinathan
341412d5b5 Fix LoggingApplicationListener
- If `logging.config` is set and could open/read the resource
then, return.
  - Currently, it logs warning though the resource is successfully
read.
2014-07-15 09:32:09 +01:00
Dave Syer
81a4548561 Ensure embedded containers actually stop if there is an error on startup
Both embedded containers need to be checked after starting to ensure that they
are actually running. With Jetty it's just a question of catching an exception
but with Tomcat it's harder (the current solution involves duplicating some
code from initialize() into start() essentially checking the lifecycle state).

Also adjusted the log levels to prevent noise at WARN level by default when
this happens (since the exception is logged and rethrown anyway).

There is still the issue of whether to fail the build in Maven or Gradle
(separate issue really).

Fixes gh-1232
2014-07-10 15:14:25 +01:00
Spring Buildmaster
40327e1ae6 Next development version 2014-07-08 02:33:36 -07:00
Phillip Webb
f7b7b1c8cb Polish embedded tomcat classes
Extract some methods to aid readability.
2014-07-07 23:40:36 -07:00
Phillip Webb
aed243fb88 Only add Tomcat connectors in start() method
Update TomcatEmbeddedServletContainer so that Connectors are removed
during initialization and re-added when the start() method is called.

This prevent protocol handlers from being bound then immediately
unbound. It also ensure that any additional connectors that may have
been added don't accidentally start to accept traffic (which could cause
potential deadlock issues).

Fixes gh-1212
2014-07-07 23:15:52 -07:00
Phillip Webb
8054426803 Format source code 2014-07-02 15:17:25 -07:00
Phillip Webb
fa88c481a5 Remote trailing whitespace 2014-07-02 15:17:14 -07:00
Christian Dupuis
133304c4f7 Resolve placeholders in banner through Enviornment
see #1191
2014-07-02 10:25:20 +02:00
Andy Wilkinson
e9c69aa46f Honour existing java.awt.headless configuration
Previously, SpringApplication would set the java.awt.headless system
property even if it had already been set. This commit updates
SpringApplication to honour any existing configuration when setting
the property.

Fixes #1189
2014-07-01 10:48:46 +01:00
Dave Syer
54a23f9920 Make -q and -v do something more sensible
-q switches off all logging and the banner, -v switches logging to debug,
running with neither will be info.

Fixes gh-1108
2014-06-27 16:24:51 +01:00
Dave Syer
fd757cb371 Add logging.level to application.properties
E.g.

logging.level.org.springframework: DEBUG
logging.level.org.hibernate: WARN

Fixed gh-788
2014-06-27 15:49:17 +01:00
Spring Buildmaster
981669b7c0 Next development version 2014-06-26 14:09:54 -07:00
Phillip Webb
200cd535c2 Revert "Next development version"
This reverts commit 67189477fe.
2014-06-26 11:03:09 -07:00
Spring Buildmaster
67189477fe Next development version 2014-06-26 10:51:35 -07:00
Phillip Webb
9632abf825 Formatting and cleanup 2014-06-26 09:41:15 -07:00
Phillip Webb
b01c1d36ae Attempt to fix Windows CI 2014-06-25 16:40:20 -07:00
Phillip Webb
e383d13ad9 Attempt to fix Windows CI 2014-06-25 16:32:16 -07:00
Phillip Webb
6311ae191f Throw exception on stop failure
Trying to fix the Windows CI build
2014-06-25 16:21:33 -07:00
Phillip Webb
03b281278a Trying to break windows build 2014-06-25 16:20:39 -07:00
Phillip Webb
d4ad67af44 Relax expected exception when connection fails
Exception appears to be different on Windows JVMs
2014-06-25 16:10:02 -07:00
Phillip Webb
1f36d4657f Fix various Windows related issues
Fixes gh-1168
2014-06-25 14:31:41 -07:00
Dave Syer
5d317f2dc7 Reflection hack for Tomcat 8 API change
Fixes gh-1148
2014-06-25 11:35:44 +01:00
Dave Syer
b0bf9c776f Fix logic error in ErrorPageFilter (fixes gh-1149) 2014-06-25 08:47:24 +01:00
Spring Buildmaster
542f3cbda8 Next development version 2014-06-24 13:53:56 -07:00
Phillip Webb
1f1a7e0ed3 Polish 2014-06-24 11:46:15 -07:00
Dave Syer
078e5425cd Avoid eager factory bean instantiation for container customizers 2014-06-24 14:52:38 +01:00
Dave Syer
999748bdab Fix some sloppy code in context hierarchy support
* The SpringApplicationBuilder was registering the parent context initializer
twice (not really a problem, but confusing if you are debugging).

* ParentContextApplicationContextInitializer itself should have been
checking that the current context is not the parent

* The EventPublishingRunListener as a result needs to call
setApplicationContext on any listeners that are AplicationContextAware

* ParentContextCloserApplicationListener can ensure that there is
only one of its kind per application context by implementing hashCode
and equals

Fixes gh-1142
2014-06-24 14:31:22 +01:00
Dave Syer
d2b88d741c Re-register SpringApplication listeners in context once it is available
Fixes gh-1141
2014-06-24 11:18:14 +01:00
Phillip Webb
ed3df32cdd Extract resource handling to TomcatResources
Extract the nasty Tomcat resource handling reflection code to its own
class.
2014-06-23 19:34:08 -07:00
Dave Syer
1bcc136374 Hack around with Tomcat resource paths
Tomcat 8 has different APIs again so it was quite difficult to
get it working and test it. The test is manual anyway (multi-module
project with JSPs in /META-INF/resources, not part of the samples),
and requires you to build a war and execute it (since the resource
paths are different when it's an archive).

Fixes gh-1131
2014-06-21 15:35:29 +01:00
Dave Syer
51496b4e4f Log exception in ErrorPageFilter
Fixes gh-1130
2014-06-21 09:32:36 +01:00
Phillip Webb
bfe4240ed2 Polish 2014-06-20 10:29:04 -07:00
Dave Syer
88379e2aa3 Check if response is committed before tryying to forward
It' sthe best we can do, but the container seems to still use our error page
(it just can't have the status code that we asked for).

Fixes gh-748
2014-06-20 12:15:10 +01:00
Phillip Webb
8a1279315e Move ApplicationContextTestUtils to src/test
Move ApplicationContextTestUtils from src/main to src/test since it
is probably of limited use to others.

Fixes gh-1034
2014-06-17 12:14:24 -07:00
Phillip Webb
25eb6fb81a Polish 2014-06-17 12:14:24 -07:00
Stephane Nicoll
f6ae300ec3 Fix parsing of properties in @IntegrationTest
This commit reuses the standard behavior provided by Properties for
parsing keys rather than parsing the keys ourselves. This provides a
consistent features set regardless of where the property is defined.

Fixes gh-1110
2014-06-17 14:57:04 +02:00
Stephane Nicoll
b646231327 Properly close context hierarchy in tests
Prior to this commit, some tests were creating a parent/child
relationship but were only closing the child context. This could
be an issue with the autoconfig module as a lot of auto-config
kicks in by default.

This commit adds a new test utility designed to properly handle
those situations. Updated tests that were creating a context
hierarchy to benefit from that.

Fixes gh-1034
2014-06-17 10:58:33 +01:00
Dave Syer
7c0c2e9ea5 Be defensive about factory beans in ConfigurationPropertiesBindingPostProcessor 2014-06-16 09:22:09 +01:00
Dave Syer
c5d46d0cab Re-instate test when fixed 2014-06-13 12:24:02 +01:00
Dave Syer
bb50e1ef8c Ignore test that is WIP 2014-06-13 12:05:41 +01:00
Dave Syer
1bf256dd58 Ensure Weblogic and Websphere JMX are covered
To ensure an MBeanServer is available when needed you have to
look in JNDI before resorting to the JDK platform factory.

I had to copy some private code from Spring, but it seems
worth it.

Fixes gh-1092
2014-06-13 11:27:41 +01:00
Dave Syer
d842446186 Catch application exception in tomcat starter thread and rethrow
Fixes gh-1088
2014-06-12 16:06:30 +01:00