Commit Graph

4537 Commits

Author SHA1 Message Date
Stephane Nicoll
8ede966708 Harmonize java.mail dependency management
Closes gh-4588
2015-11-26 16:58:47 +01:00
Stephane Nicoll
e5ea0252cd Upgrade to commons-collections 3.2.2
Closes gh-4520
2015-11-25 09:55:44 +01:00
Stephane Nicoll
d9f09e46f8 Cherry-pick 398d06e
Fixed initially in #3725

The target attribute is effectively checked for null beforehand so this
additional defensive check can be removed.

Closes gh-4567
2015-11-23 10:43:44 +01:00
Dimitri
c605675b7a Fix wrong class reference
Closes gh-4551
2015-11-23 09:41:34 +01:00
Andy Wilkinson
2fe0819495 Isolate multiple Undertow deployments
Previously, UndertowEmbeddedServletContainerFactory always used
Undertow’s default ServletContainer. This meant that if there were two
UndertowEmbeddedServletContainers created, they would share the same
ServletContainer and the second one that was created would overwrite
the deployment for the first. This resulted in a async request
handling failing as the attempt to look up the deployment for the
first embedded Undertow instance would incorrectly find the deployment
for the second.

This commit fixes the problem by ensuring that each 
UndertowEmbeddedServletContainerFactory uses a separate Undertow
ServletContainer instance.

Closes gh-4329
2015-11-17 18:04:22 +00:00
Phillip Webb
604ca52491 Revert "Upgrade to Spring Social 1.1.3"
This reverts commit 331a26a497.
2015-11-13 16:50:30 -08:00
Phillip Webb
331a26a497 Upgrade to Spring Social 1.1.3
Fixes gh-4464
2015-11-13 14:09:24 -08:00
Phillip Webb
49a5587558 Fully support -cp arguments
The CLI application advertises `-cp` support but it appears that only
`--cp` is really supported. The fix for gh-178 forgot to update the
call to `getParser().parse(...)`.

See gh-178
2015-11-09 14:38:54 -08:00
Phillip Webb
f08f872729 Restore original embedded container shutdown order
Update EmbeddedWebApplicationContext so that the servlet container is
shutdown after the context is closed. Unfortunately shutting the
container down before the context has been closed causes exceptions if
the `/shutdown` actuator endpoint is used. It can also cause the Tomcat
classloader to throw IllegalStateExceptions if resources are accessed
during shutdown.

As this commit effectively reverts 0069e41c we need to fix the shutdown
deadlock issue reported in gh-4130 in a different way. The deadlock can
be caused when an incoming HTTP connection occurs whilst the context is
closing. The incoming connection triggers the `FrameworkServlet` to
call `initWebApplicationContext` which in turn calls `refresh`. The
`FrameworkServlet` checks `ApplicationContext.isActive()` before
performing an initialization but prior to this commit we would set
active to `false` before stopping the servlet container. We now override
`onClose` rather than `doClose` in `EmbeddedWebApplicationContext` to
ensure that the active flag is only set to `false` once the servlet
container has been stopped.

See gh-4130
Fixes gh-4396
2015-11-06 12:54:19 -08:00
Stephane Nicoll
6d90188a27 Fix Maven/Gradle wrapper executable flag
Spring Initalizr now bundles a wrapper script for the build system. While
that wrapper has the necessary execute flag in the zip archive, that flag
is lost as the zip abstraction does not honor those.

The init command now makes sure to restore the execute flag on `mvnw`
and `gradlew` if necessary.

Unfortunately, this can't be tested as the Windows build would fail to
assert that the executable flag has been propertly set.

Closes gh-4392
2015-11-06 17:47:27 +01:00
Stephane Nicoll
96ca3e0c0f Polish
Add missing documentation

See gh-4220
2015-11-05 14:09:30 +01:00
Phillip Webb
9432ee6a6b Polish 2015-11-05 00:19:58 -08:00
Dave Syer
124574e345 Add mediaTypes (extension to media type mapping) in MVC resources
Allows users to configure "allowed" file extensions for controller
mappings, so that browsers will not switch to downloading "f.txt"
(part of the recent RFD attack fixes in Spring MVC).

See gh-4220
2015-11-05 08:10:07 +01:00
Phillip Webb
2118242e00 Polish 2015-11-03 14:06:44 -08:00
Stephane Nicoll
8c140092b6 Fix key to disable the metrics filter
Commit d0cf6b5 introduced a `endpoints.metrics.filter.enabled` property
key meant to disable the filter. Unfortunately, the `endpoints.metrics`
namespace is already managed so setting this property will fail.

We now use the same key than the one used to disable the metrics
endpoint.

Closes gh-4365
2015-11-03 10:14:39 +01:00
Stephane Nicoll
791e3048cf Fixup version numbers following release 2015-11-01 17:02:35 +01:00
Andy Wilkinson
1f92360583 Ensure that HATEOAS sample does not try to produce XML
The HATEOAS sample does not support XML responses. Previously, the
controller doesn't constrain the media types that it could produce.
This would result in a failure when handling a request that prefers
XML responses.

This commit updates the produces clauses in the controller so that
the sample will only attempt to produce JSON.

Closes gh-4343
2015-10-30 09:17:34 +00:00
Andy Wilkinson
05b501ce41 Update Tomcat multi-connectors sample to configure SSL declaratively
The documentation recommends configuring the HTTP connector in code
and using application.properties to configure the HTTPS connector
as it's easier. This commit updates the sample to follow that
recommendation.

Closes gh-4342
2015-10-30 09:05:24 +00:00
Stephane Nicoll
7c1bf58262 Filter duplicate
Improve the initial PR to include a filtering of the profiles that were
already enabled via the `spring.profiles.active` property.

Also add more tests to prove that each profile is loaded only once
now.

Closes gh-4273
2015-10-22 17:19:56 +02:00
Dave Syer
06bb6bd1e1 Fix logic affecting files loaded
The problem fixed here is that the Loader keeps track of the profiles it
is going to look at for loading files, but ignores any that were already
active in the Environment if the listener is called initially with
spring.profiles.active not empty.

Closes gh-4261
2015-10-22 16:57:06 +02:00
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