Commit Graph

315 Commits

Author SHA1 Message Date
Andy Wilkinson 082258952a Fall back to JVM's class path when finding jars with static resources
Previously, StaticResourceJars would only find jars with
META-INF/resources content if it had been loaded by a URLClassLoader.
This is not the case on Java 9 and, as a result, static content in
META-INF/resources of any jars on the class path was not found.

This commit updates StaticResourceJars to fall back to using the
JVM's class path to find static resource jars when it was loaded by
a ClassLoader that is not a URLClassLoader.

Closes gh-10455
2017-09-29 12:38:37 +01:00
Andy Wilkinson ce77f48c3f Fall back to JVM's class path when TCCL is not a URLClassLoader
Previously, DevTools assumed that the TCCL was a URLClassLoader
when trying to determine the URLs that it should examine to determine
the locations that should be watched for triggering a restart. This
fails on Java 9 as the TCCL is not a URLClassLoader.

This commit updates the logic that determines the changeable URLs to
fall back to examining the JVM's class path when the TCCL is not a
URLClassLoader, typically because the application is running on Java
9. This fall back isn't a direct equivalent of the behaviour on Java 8
as the class path of the TCCL and the class path with which the JVM
was launched may not be the same. However, I consider the fix to be
reasonable for two reasons:

1. In reality, the class path of the TCCL and the class path with
   which the JVM was launched are the same.
2. There appears to be now to get the URLs on the class path of the
   TCCL on Java 9. There is a URLClassPath field, however Java 9's
   access restrictions prevent us from using it even if we resort to
   reflection.

Closes gh-10454
2017-09-29 12:17:26 +01:00
Andy Wilkinson b152b98f84 Improve diagnostics in DevTools integration tests
See gh-10454
2017-09-29 12:06:05 +01:00
Stephane Nicoll 8637547509 Disable embedded server integration tests on Java 9
See gh-10455
2017-09-29 11:47:11 +02:00
Stephane Nicoll 8f8b1371b7 Disable devtools integration tests on Java 9
See gh-10454
2017-09-29 11:39:48 +02:00
Phillip Webb 9e43b99966 Polish 2017-09-27 17:44:48 -07:00
Madhura Bhave 7093602753 Simplify UserDetailsService creation in samples
Closes gh-10385
2017-09-26 14:06:19 -07:00
Andy Wilkinson 3db5843c8b Polish "Find .conf file next to symlink to jar that's using the launch script"
Closes gh-8988
2017-09-26 14:42:18 +01:00
Ali Shahbour 56a5888008 Find .conf file next to symlink to jar that's using the launch script
See gh-8988
2017-09-26 13:12:40 +01:00
Andy Wilkinson c3bc32db02 Polish and reinstate usage of FileSystemUtils.deleteRecursively
Closes gh-9942
2017-09-21 12:03:51 +01:00
Phillip Webb 2c97d3a5e9 Polish 2017-08-29 15:59:32 -07:00
Madhura Bhave e08ddbf838 Rework security autoconfiguration
This commit combines security autoconfigurations for
management endpoints and the rest of the application. By default,
if Spring Security is on the classpath, it turns on @EnableWebSecurity.
In the presence of another WebSecurityConfigurerAdapter this backs off
completely. A default AuthenticationManager is also provided with a user
and generated password. This can be turned off by specifying a bean of
type AuthenticationManager, AuthenticationProvider or UserDetailsService.

Closes gh-7958
2017-08-27 23:15:18 -07:00
Andy Wilkinson abf39915e8 Polish 2017-08-04 11:12:33 +01:00
Andy Wilkinson 09b41a33e8 Wait for process to exit when stopping DevTools integration test apps 2017-08-03 21:00:22 +01:00
Andy Wilkinson 53e8ade4d3 Improve diagnostics for delete failures in DevTools integration tests 2017-08-03 12:07:22 +01:00
Emanuel Campolo 2626a3a795 Use lambdas when possible
Replace anonymous inner classes with lambda declarations (when possible
using method references).

See gh-9781
2017-07-25 00:53:38 -07:00
Emanuel Campolo 04fdec6f8b Replace explicit generics with diamond operator
Where possible, explicit generic declarations to use the Java 8 diamond
operator.

See gh-9781
2017-07-25 00:53:37 -07:00
Andy Wilkinson 0ab81e4f8f Prevent loader classes from being served by executable war
Closes gh-5550
2017-07-24 16:29:56 +01:00
Andy Wilkinson f7e9ec5f42 Minimise our usage of SocketUtils.findAvailableTcpPort
Closes gh-9382
2017-06-09 14:45:09 +01:00
Andy Wilkinson 4a6b34e725 Merge branch '1.5.x' 2017-06-03 19:41:35 +01:00
Andy Wilkinson d5184724b0 Downgrade Jersey to version that plays nicely with Docker's Java client 2017-06-03 19:40:21 +01:00
Andy Wilkinson 09a8b3c072 Merge branch '1.5.x' 2017-06-03 16:54:02 +01:00
Andy Wilkinson ec8ae2f91e Merge branch '1.4.x' into 1.5.x 2017-06-03 16:53:48 +01:00
Andy Wilkinson e60a261952 Do not allow failure to remove container to mask earlier failure 2017-06-03 16:53:28 +01:00
Andy Wilkinson 49fc1b831c Merge branch '1.5.x' 2017-06-03 13:13:04 +01:00
Andy Wilkinson a215103bb5 Merge branch '1.4.x' into 1.5.x 2017-06-03 13:11:39 +01:00
Andy Wilkinson 31ff7f1846 Tolerate Successfully built being found in response other than last
Different versions of Docker produce different responses when building
and tagging an image. On CI, a response with a stream like
"Successfully built 185991ffe24a" followed by a response with a
stream like "Successfully tagged spring-boot-it/centos:6.9-a23bced6"
is received. By default, for the building of an image to be considered
successful, the Docker Java client requires the stream for the last
response item to contain "Successfully built". This means that, on the
CI server, it incorrectly believes that the building of the tagged
image has failed.

This commit uses a custom BuildImageResultCallback that doesn't
require the last response to be the one that has a stream containing
"Successfully built". Instead, it looks back through the error-free
responses (newest to oldest) looking for one with a stream containing
"Successfully built".
2017-06-03 13:00:15 +01:00
Andy Wilkinson b8bd51fd48 Merge branch '1.5.x' 2017-06-03 09:55:47 +01:00
Andy Wilkinson 5722c149d0 Merge branch '1.4.x' into 1.5.x 2017-06-03 09:55:29 +01:00
Andy Wilkinson 0270ccafa5 Enable Docker command debug logging to improve diagnostics on CI server 2017-06-03 09:54:13 +01:00
Andy Wilkinson 99790f67e0 Merge branch '1.5.x' 2017-06-02 19:49:51 +01:00
Andy Wilkinson 3cf8e81a8b Merge branch '1.4.x' into 1.5.x 2017-06-02 19:49:16 +01:00
Andy Wilkinson a69a851ae9 Drop CentOS 5 from launch script tests and upgrade to 6.9
CentOS 5 was declared EOL in March 2017 and yum on longer works
out of the box. 6.9 is the latest release of CentOS 6. Tests for
CentOS 7 have not been added as it uses systemd rather than SysVinit.

Closes gh-9395
2017-06-02 19:45:45 +01:00
Andy Wilkinson 9480e09c21 Upgrade to Spring Security 5.0.0.M1
Closes gh-8714
2017-05-10 08:48:32 +01:00
Andy Wilkinson 643364e74d Try to ensure that embedded container tests can see milestones and snapshots 2017-05-04 15:49:24 +01:00
Spring Buildmaster 9768b0a8c2 Next Development Version 2017-04-21 08:32:01 +00:00
Spring Buildmaster d719d2cbbc Next Development Version 2017-04-20 12:46:19 +00:00
Andy Wilkinson 5f27ecc6d9 Remove old integration tests for the Gradle plugin 2017-04-04 15:33:27 +01:00
Phillip Webb 34de119eba Polish 2017-03-16 13:04:03 -07:00
Andy Wilkinson bb54411366 Merge branch '1.5.x' 2017-03-13 16:10:51 +00:00
Andy Wilkinson 17062f9589 Merge branch '1.4.x' into 1.5.x 2017-03-13 16:10:32 +00:00
Andy Wilkinson 2ddcf0e831 Avoid using File.renameTo(File) as it doesn't work on Windows 2017-03-13 15:46:19 +00:00
Phillip Webb 67556ba8ea Restructure embedded web server packages
Rework `org.springframework.boot.context.embedded` to relocate classes
to `org.springframework.boot.web`. Packages are now organized around
the following areas:

Packages for shared concerns, for example the `WebServer` interface
to start/stop a server and the common configuration elements:
- org.springframework.boot.web.context
- org.springframework.boot.web.server

Servlet specific packages:
- org.springframework.boot.web.servlet.server
- org.springframework.boot.web.servlet.context
- org.springframework.boot.web.servlet.filter

Reactive specific packages:
- org.springframework.boot.web.reactive.context
- org.springframework.boot.web.reactive.server

Embedded server implementations (both reactive and servlet):
- org.springframework.boot.web.embedded

In addition:

- Rename `EmbeddedServletContainerFactory` to `ServletWebServerFactory`
  to align with the `ReactiveWebServerFactory`.
- Rename `EmbeddedWebApplicationContext` to
  `ServletWebServerApplicationContext` and
- Rename `EmbeddedReactiveWebApplicationContext` to
  `ReactiveWebServerApplicationContext`.
- Add checkstyle rules to restrict imports.
- Fixup all affected code to use the correct imports and local names.

Fixes gh-8532
2017-03-12 21:08:25 -07:00
Andy Wilkinson b35c162593 Raise the minimum supported version of Gradle to 3.4
Closes gh-7922
2017-03-11 09:03:06 +00:00
Andy Wilkinson 019b0a3e9c Merge branch '1.5.x' 2017-03-09 14:05:51 +00:00
Andy Wilkinson 50c0204f2d Merge branch '1.4.x' into 1.5.x 2017-03-09 14:05:42 +00:00
Andy Wilkinson d32c3a7f43 Correct the URL that's called to test servlet context resources
See gh-8299
Closes gh-8525
2017-03-09 14:04:19 +00:00
Andy Wilkinson b527e71474 Merge branch '1.5.x' 2017-03-09 13:26:14 +00:00
Andy Wilkinson 1395f38ee7 Merge branch '1.4.x' into 1.5.x 2017-03-09 13:11:28 +00:00
Andy Wilkinson a2cf0455fd Fix static resource handling when run in IDE or using Maven or Gradle
The changes made for gh-8299 attempted to make static resource
handling consistent across Jetty, Tomcat, and Undertow. They did so
for application's launched using JarLauncher or WarLauncher but did
not consider application's launched in an IDE or using spring-boot:run
in Maven or bootRun in Gradle.

Running in an IDE or via Maven or Gradle introduces two new
resource locations:

 - Jars on the classpath with file protocol URLs (they are always
   jar protocol URLs when using either launcher)
 - Directories on the classpath from a project that is depended upon
   and contains resources in META-INF/resources

This commit updates the factories for all three containers to handle
these new resources locations. The integration tests have also been
updated.
2017-03-09 12:41:32 +00:00