Commit Graph

4467 Commits

Author SHA1 Message Date
Stephane Nicoll
2e2ebeb9fa Allow PORTFILE to always override the file to use
Previously, the `PORTFILE` system property was not checked if the
`EmbeddedServerPortFileWriter` was created using the default constructor.

This had the effect to prevent overriding of the port file when this
listener is created without any file or via `META-INF/spring.factories`.

Closes gh-4254
2015-10-21 13:58:48 +02:00
Phillip Webb
cfbac20807 Ensure ErrorControllers work when using AOP
Add a BeanFactoryPostProcessor to set PRESERVE_TARGET_CLASS_ATTRIBUTE
to true on all ErrorController bean definitions. Without this attribute
AOP advice on @Controllers causes ErrorController beans to be created
as JDK proxies (since they implement a single valid looking interface)
and therefore not get found by Spring MVC.

Fixes gh-4236
2015-10-20 13:42:38 -07:00
Andy Wilkinson
ee93307402 Align the mime mapping configuration across all three embedded containers
Closes gh-4161
2015-10-20 17:46:01 +01:00
Phillip Webb
a79131f8d2 Organize imports with new settings
See gh-4234
2015-10-19 12:55:44 -07:00
Phillip Webb
47ae7487ac Tweak import order settings
Update the import order settings to be a little more logical. Imports
should now be ordered:

java.*
javax.*
<others>
org.springframework.*
import static *

See gh-4234
2015-10-19 12:17:46 -07:00
Andy Wilkinson
92ba46e1c9 Upgrade to Spring Social Twitter 1.1.2.RELEASE
Closes gh-4238
2015-10-19 19:08:29 +01:00
Stephane Nicoll
a4af835c35 Merge pull request #4212 from zhanhb/patch-4
* pr/4212:
  Fix default value of MongoDB port in doc
2015-10-19 15:09:41 +02:00
zhanhb
299d0653ed Fix default value of MongoDB port in doc
Closes gh-4212
2015-10-19 15:08:43 +02:00
Spring Buildmaster
2b38a861e3 Next Development Version 2015-10-16 05:57:24 -07:00
Andy Wilkinson
c236db04ef Ignore parent contexts in message source auto-configuration
This commit applies the changes made in 68b55ad to 1.2.x (it was
originally only made in 1.0.x and master). It also adds some tests.

Closes gh-3803
2015-10-16 11:07:39 +01:00
Andy Wilkinson
35a3f4a1c0 Reinstate the use of shutdown hooks in the tests
Commit adf2c44b was an attempt to prevent HSQLDB from throwing an
exception when the JVM exits. This was achieved by disabling the
application context’s shutdown hook in the tests. This had the unwanted
side effect of causing tests’ application contexts not to be closed. The
reported symptom was that @Destroy methods were no longer being invoked.
We need a different solution to the problem.

The exception was:

Caused by: org.hsqldb.HsqlException: Database lock acquisition failure: attempt to connect while db opening /closing
    at org.hsqldb.error.Error.error(Unknown Source)
    at org.hsqldb.error.Error.error(Unknown Source)
    at org.hsqldb.error.Error.error(Unknown Source)
    at org.hsqldb.DatabaseManager.getDatabase(Unknown Source)
    at org.hsqldb.DatabaseManager.newSession(Unknown Source)
    ... 23 common frames omitted

I originally thought this was due to a race between the application
context’s shutdown hook and HSQLDB’s shutdown hook, however HSQLDB
doesn’t use a shutdown hook. I believe that the problem is due to 
an HSQLDB database being created with shutdown=true in its URL, similar
to the problem described here [1]. This will shut down the database when
the last connection to it is closed, however the shutdown will happen
asynchronously. If the JVM then runs the application context’s shutdown
hook, EmbeddedDatabaseFactory will attempt to connect to the database to
execute the SHUTDOWN command. This executes synchronously but will race
with the asynchronous shutdown that’s executing as a result of
shutdown=true in the JDBC url and the last connection to the database
being closed. 

This commit reinstates the use of application context shutdown hooks in
the tests, and updates the documentation to recommend that, if a user
manually configures the URL for their embedded database, they do so 
in such a way that the database doesn’t shutdown automatically, thereby
allowing the shutdown to be driven by application context close.

Closes gh-4208

[1] http://sourceforge.net/p/hsqldb/bugs/1400/
2015-10-16 10:36:20 +01:00
Phillip Webb
1c46fd2a8e Roll back to Groovy 2.4.4
See gh-4210
2015-10-16 00:50:22 -07:00
Phillip Webb
b0d287356c Revert "Increase PermGen for CLI integration tests"
This reverts commit 4c26b0c194.
2015-10-16 00:28:05 -07:00
Phillip Webb
d84889b03c Revert "Compile samples and integration tests with Java 8"
This reverts commit 09395f956a.
2015-10-16 00:01:52 -07:00
Phillip Webb
4c26b0c194 Increase PermGen for CLI integration tests 2015-10-15 23:36:18 -07:00
Phillip Webb
c804299c8d Prevent Undertow from exposing classpath files
Update `UndertowEmbeddedServletContainerFactory` so that the
`ClassPathResourceManager` is no longer registered by default.

Prior to this commit the resource manager would be registered whenever
a valid document root could not be found. This had the effect of
exposing all classpath files.

Fixes gh-4015
2015-10-15 16:02:41 -07:00
Phillip Webb
56643222cf Add simple war sample 2015-10-15 15:31:28 -07:00
Phillip Webb
676ff75d9d Polish 2015-10-15 15:30:18 -07:00
Stephane Nicoll
fddd7c5f91 Upgrade to Spring Framework 4.1.8.RELEASE
Closes gh-4019
2015-10-15 12:45:42 +02:00
Andy Wilkinson
7e718cda26 Remove redundant hash from path of unpacked nested library
Closes gh-4124
2015-10-14 16:32:58 +01:00
Andy Wilkinson
d55c001a2e Start building against Spring Framework 4.1.8 snapshots
See gh-4019
2015-10-14 15:52:07 +01:00
Andy Wilkinson
5ceda4f4ab Upgrade to Spring Data Evans SR4
Closes gh-3576
2015-10-14 14:16:07 +01:00
Andy Wilkinson
e4895f8fde Disable child context's /error endpoint if disabled in parent
Previously, EndpointWebMvcChildContextConfiguration would attempt to
create a /error endpoint, irrespective of whether or not the parent
had such an endpoint. If the endpoint was disabled in the parent this
would cause a failure due to the absence of an ErrorAttributes bean.

This commit updates EndpointWebMvcChildContextConfiguration to make
the creation of its /error endpoint conditional on the existence of
an ErrorAttributes bean.

Closes gh-4164
2015-10-14 12:06:10 +01:00
Andy Wilkinson
9218d5ad11 Use Maven Central as source of Tomcat binaries for deployment tests
Closes gh-4151
2015-10-12 15:05:53 +01:00
Andy Wilkinson
baa2473da1 Update to CRaSH 1.3.2
Closes gh-4150
2015-10-12 14:45:31 +01:00
Andy Wilkinson
100ad995e6 Upgrade to Groovy 2.4.5
Closes gh-4149
2015-10-12 14:40:34 +01:00
Andy Wilkinson
ed022fb79a Upgrade to AspectJ 1.8.7
Closes gh-4148
2015-10-12 14:39:54 +01:00
Andy Wilkinson
d33d068fae Upgrade to Tomcat 8.0.28 and test support for SSL config from classpath
Prior to 8.0.28 Tomcat required the key store and trust store (if any)
to be available directly on the filesystem, i.e. classpath: resources
would not work. Tomcat 8.0.28 removed this limitation.

This commit updates to Tomcat 8.0.28, updates the tests to verify
the new Tomcat capability and removes the obsolete documentation of
the restriction.

Closes gh-4048
2015-10-12 13:36:32 +01:00
Andy Wilkinson
ee3d4b34a0 Consider parent when application is built and then run
Previously, the parent context was only considered when the builder
was used to run the application. If the application was built using
the builder and then run using SpringApplication.run, the parent
context was not considered.

This commit updates the builder to consider the parent both when it's
used to run the application and when it's used to build the
application that will later be run via SpringApplication.run

Closes gh-4014
2015-10-12 13:06:44 +01:00
Andy Wilkinson
050a4fed17 Restore compatibility with Gradle 2.0
Gradle 2.0, and only 2.0, requires a Plugin implementation to be
public. The changes made in gh-4113 (9c14ed3) made the class
package-private.

Closes gh-4139
2015-10-12 10:33:33 +01:00
Andy Wilkinson
9c14ed3502 Remove stale Java source from src/main/groovy in the Gradle plugin
Closes gh-4113
2015-10-12 10:30:31 +01:00
Stephane Nicoll
ed1b5cbfde Upgrade to H2 1.4.190
Closes gh-4145
2015-10-12 09:21:29 +02:00
Phillip Webb
70214da2e4 Fix broken formatting 2015-10-09 16:41:36 -07:00
Phillip Webb
94736719f1 Reformat package-info.java files with Eclipse Mars 2015-10-09 13:32:57 -07:00
Phillip Webb
b779e8e4fc Add custom Eclipse code formatter
Update Eclipse settings to make use of a custom Spring formatter
implementation. Using a custom formatter allows us to fix a couple of
issues with the version that shipped with Eclipse Mars.1 (Eclipse bugs

The custom formatter also means that it is possible to use Groovy
Eclipse despite the fact that it has formatter regressions (see
https://github.com/groovy/groovy-eclipse/issues/142).

Fixes gh-4136
2015-10-09 10:33:14 -07:00
Andy Wilkinson
04c2bd9c89 Update tests to expect additional entry in test jar
Closes gh-4124
2015-10-09 15:19:50 +01:00
Andy Wilkinson
888fa90265 Ensure that JarFileArchive unpacks entries to unique location
Previously, JarFileArchive would always unpack any entries marked for
unpacking to ${java.io.tmpdir}/spring-boot-libs. This could cause
problems if multiple Spring Boot applications were running on the same
host:

- If the apps are run as different users the first application would
  create the spring-boot-libs directory and the second and subsequent
  applications may not have write permissions to that directory
- Multiple apps may overwrite each others unpacked libs. At best this
  will mean one copy of a jar is overwritten with another identical
  copy. At worst the jars may have different contents so that some of
  the contents of the original jar disappear unexpectedly.

This commit updates JarFileArchive to use an application-specific
location when unpacking libs. A directory beneath ${java.io.tmpdir} is
still used but it's now named <jar-file-name>-spring-boot-libs-<uuid>.
A loop, limited to 1000 attempts, is used to avoid problems caused by
the uuid clashing.

Closes gh-4124
2015-10-09 14:59:18 +01:00
Andy Wilkinson
f7d2bafb3e Use Java 8 on Travis as the samples now require it
Commit 09395f95 updated the samples to require Java 8. This commit
updates the Travis configuration to build with Java 8.

Closes gh-4133
2015-10-09 13:18:29 +01:00
Andy Wilkinson
0069e41c29 Prevent closed context from being refreshed again by an HTTP request
Prior to this commit, EmbeddedWebApplicationContext would perform its
close processing and then stop the embedded container. This could
lead to the closed context's dispatcher servlet handling an HTTP
request and refreshing the context again. This opened up two
possibilities that we need to avoid:

1. Another HTTP request could be received by the dispatcher servlet
   while the context is still being refreshed. This could lead to the
   context being used before its refreshed. I believe this could be
   the cause of the current modification exception described in
   gh-3239 and SPR-13123.
2. It can lead to a race during shutdown as the shutdown hook's
   attempt to close the context races with the refresh initiated by
   the HTTP request. This is possible as the shutdown hook bypasses
   the sychronization on startupShutdownMonitor that would normally
   prevent refresh and close from occurring in parallel. This race
   can lead to a deadlock as described in gh-4130

Closes gh-4130
2015-10-09 12:24:43 +01:00
Dave Syer
7b6de545e7 Change HashSet to LinkedHashSet to preserve order of file extensions
Fixes gh-4111
2015-10-08 10:20:43 +01:00
Phillip Webb
6ab376e2e8 Reformat code use Eclipse Mars 2015-10-07 23:32:31 -07:00
Phillip Webb
ba7c1fda72 Convert Gradle plugin from Groovy to Java
Replace existing Groovy code with Java since the Groovy Eclipse tooling
currently forces the use of an old jdt plugin which has formatter bugs.

Fixes gh-4113
2015-10-07 23:12:25 -07:00
Phillip Webb
09395f956a Compile samples and integration tests with Java 8
Update the samples and integration tests to use Java 8. There's no
specific reason to keep them on Java 6 and it helps keep Eclipse happy
if we upgrade.
2015-10-07 19:46:11 -07:00
Phillip Webb
cb6e30c8f5 Ignore helpmojo from Eclipse m2e config
Ignore the `helpmojo` goal to save needing an additional Eclipse plugin.
2015-10-07 19:45:20 -07:00
Andy Wilkinson
3697dd52a0 Use main Apache archive for Tomcat binaries to improve(?) build stability
Mirrors of archive.apache.org only mirror the latest release of each
project so, as new releases are made, builds using older versions will
break as the mirrors are updated.

This commit updates the Tomcat deployment test to use the main Apache
archive site. This should provide long-term access to Tomcat binaries,
improving build stability and ensuring that tagged builds are
repeatable.

Backport of 5f087e6444
2015-10-07 11:57:46 +01:00
Andy Wilkinson
9a703ab4d1 Correct quotation marks in spring-boot-actuator’s README
Closes gh-4095
2015-10-07 11:33:43 +01:00
Andy Wilkinson
d793d5abcb Work around intermittent failure caused by SPR-13079
See gh-4098
2015-10-06 11:43:53 +01:00
Andy Wilkinson
6387f36efa Work around MockMvc bug (SPR-13079) that has only been fixed in 4.2
See gh-4098
2015-10-06 11:25:18 +01:00
Andy Wilkinson
b8b4ea489e Improve MetricsFilter’s handling of async requests
Previously, MetricsFilter would treat async requests the same as
sync requests and would record their response status as soon as the
request had been processed by the filter chain. This would result in a
200 response being recorded and the actual response status produced by
the async processing being ignored. Furthermore, the time that was
recorded for the request would not include the time take for any async processing.

This commit updates MetricsFilter to check whether or not an async
request has been started before it records the metrics for the request.
In the event of an async request having been started no metrics are
recorded. Instead, the StopWatch is stored in a request attribute that
is then retrieved during the filtering of the request’s async
dispatch(es). Once the async processing has completed (isAsyncStarted()
returns false), the StopWatch is stopped, removed from the request’s
attributes and the metrics for the request are recorded.

Closes gh-4098
2015-10-06 11:00:59 +01:00
Andy Wilkinson
a94f3a0cbf Only try to auto-configure Jetty when jetty-webapp is on the classpath
Closes gh-4089
2015-10-05 11:41:23 +01:00