Commit Graph

334 Commits (7a82660bb1b78e12e2be77b63d95f274d56c6bed)

Author SHA1 Message Date
Phillip Webb 291752a317 Merge branch '1.5.x' 8 years ago
Phillip Webb d05357e036 Migrate to Tomcat WebSocket client
Move samples and tests from Jetty websocket client to Tomcat since the
upcoming Jetty release contains a bug in `JsrSession`
(https://github.com/eclipse/jetty.project/issues/1202).

See gh-7599
8 years ago
Phillip Webb 5299db3806 Fix deadlock when calling LiveReloadServer.stop()
Update LiveReloadServer so that different synchronization blocks are
used for the sockets and connection lists. Prior to this commit calling
`LiveReloadServer.stop()` would always result in a 60 second delay since
`stop()` owned the monitor add `removeConnection()` (called from a
different thread) needs it to remove the active connection.

Fixes gh-7749
8 years ago
Spring Buildmaster 9057f9ae1f Next development version 8 years ago
Phillip Webb 8b47561f7e Merge branch '1.5.x' 8 years ago
Hrishikesh Joshi c2992e3736 Add more debug logging to DevTools
Add debug logging for the included and excluded URL patterns and
matching URLs.

Fixes gh-7478
Closes gh-7544
8 years ago
Phillip Webb 1f417997f3 Merge branch '1.5.x' 8 years ago
Phillip Webb 4b9cba351b Merge branch '1.4.x' into 1.5.x 8 years ago
Phillip Webb bd74c3d327 Polish formatting 8 years ago
Stephane Nicoll 816c236e5b Merge branch '1.5.x' 8 years ago
Stephane Nicoll ee72e788ed Rename `spring-boot-junit-runners` to `spring-boot-test-support`
Closes gh-7421
8 years ago
Stephane Nicoll bd2415463c Merge branch '1.5.x' 8 years ago
Oscar Utbult 0a1009bc42 Use addAll instead of manual array to collection copy
Closes gh-7539
8 years ago
Phillip Webb 20d7dd5747 Merge branch '1.5.x' 8 years ago
Phillip Webb 1657120286 Move ModifiedClassPathRunner to its own module
Migrate `ModifiedClassPathRunner` from `spring-boot` test source to
its own module.

Fixes gh-7420
8 years ago
Phillip Webb 9e18021e8c Merge branch '1.4.x' into 1.5.x 8 years ago
Phillip Webb fce17ca6d9 Polish 8 years ago
Andy Wilkinson 9273b1789b Merge branch '1.5.x' 8 years ago
Andy Wilkinson 1cd781b242 Make spring-boot-test compatible with Mockito 2.1 and 2.2
We use some internal Mockito classes and some  breaking API changes
have been made to them in Mockito 2. This commit introduces a utility
class, SpringBootMockUtil, to shield our code from these differences.
Mockito 1 is called directly and Mockito 2 is called via reflection.

To allow these changes to be tested, FilteredClassPathRunner has been
enhanced to also support overriding a dependency on the class path.
As a result it has been renamed to ModifiedClassPathRunner. The new
ClassPathOverrides annotation can be used to provide the Maven
coordinates of one or more dependencies that should be resolved and
added to the class path. Such additions are added to the start of
the class path so that they override any existing dependency that
contains the same classes.

Closes gh-6520
8 years ago
Andy Wilkinson 8c80722a70 Merge branch '1.5.x' 8 years ago
Andy Wilkinson bed5155676 Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson 5857010dde Polishing: fix Checkstyle warning 8 years ago
Andy Wilkinson 971e5e834c Merge branch '1.5.x' 8 years ago
Andy Wilkinson eff0fc0221 Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson 918e122ddc Fix remote DevTools' support for adding and removing classes
Previously, remote DevTools only correctly supported modifying
existing classes. New classes that were added would be missed, and
deleted classes could cause a failure as they would be found by
component scanning but hidden by RestartClassLoader.

This commit introduces a DevTools-specific ResourcePatternResolver
that is installed as the application context's resource loader. This
custom resolver is aware of the files that have been added and
deleted and modifies the result returned from getResource and
getResources accordingly.

New intergration tests have been introduced to verify DevTools'
behaviour. The tests cover four scenarios:

- Adding a new controller
- Removing an existing controller
- Adding a request mapping to a controller
- Removing a request mapping from a controller

These four scenarios are tested with:

- DevTools updating a local application
- DevTools updating a remote application packaged in a jar file
- DevTools updating a remote application that's been exploded

Closes gh-7379
8 years ago
Phillip Webb cb7c0b5031 Merge branch '1.5.x' 8 years ago
Phillip Webb dfd327d68f Polish multiple root contexts in `Restarter`
See gh-7335
See gh-7336
8 years ago
Marius Bogoevici 34fb909b41 Support multiple root contexts in `Restarter`
Update devtools restarter to support multiple application contexts.

Fixes gh-7335
Closes gh-7336
8 years ago
Phillip Webb d8b7d6dfdc Merge branch '1.5.x' 8 years ago
Madhura Bhave e7db7adfb8 Rename ApplicationStartedEvent
Rename `ApplicationStartedEvent` to `ApplicationStartingEvent` to
avoid confusion.

Fixes gh-7381
8 years ago
Spring Buildmaster e712a9ba8c Next Development Version 8 years ago
Phillip Webb 1ff1402d9c Merge branch '1.5.x' 8 years ago
Phillip Webb 221feac3ec User random server port in devtools tests
Update `LocalDevToolsAutoConfigurationTests` to ensure that a random
server port is used rather than 8080.

Fixes gh-7268
See gh-7039
8 years ago
Brian Clozel cad3cc4e5d Merge branch '1.5.x' 8 years ago
Brian Clozel 56fa34719d Merge branch '1.4.x' into 1.5.x 8 years ago
Craig Andrews fc535fe27c Disable resource chain cache when DevTools is enabled
If the resource chain is used, such as by using the
`"spring.resources.chain.strategy.content.enabled"` property,
resource chain caching can prevent the developer from seeing
changes made to resources, so that caching should be disabled
when DevTools is enabled.

This commit sets the `"spring.resources.chain.cache"` property
to `true` when devtools is enabled.
8 years ago
Phillip Webb 98a3ae9ac4 Merge branch '1.5.x' 8 years ago
Phillip Webb 5b66ffbb4b Merge branch '1.4.x' into 1.5.x 8 years ago
Phillip Webb cecc1c8817 Disable DevTools property defaults in production
Update `DevToolsPropertyDefaultsPostProcessor` so that property defaults
are only added at development time. Properties are now added only when
`Restarter` is initialize or remote devtools is enabled.

Fixes gh-7014
8 years ago
Andy Wilkinson 3eb9397c9d Merge branch '1.5.x' 8 years ago
Andy Wilkinson 570b292df7 Disable JspServlet's development mode by default
This commit switches off the auto-configured JspServlet's
development mode by default. Development mode is then switched on
when DevTools is on the class path.

Closes gh-7039
8 years ago
Stephane Nicoll b95b57dbf5 Merge branch '1.5.x' 8 years ago
Stephane Nicoll e643fc5bd1 Merge branch '1.4.x' into 1.5.x 8 years ago
Johnny Lim 503d735fdd Polish
Closes gh-7081
8 years ago
Andy Wilkinson 2a035d0748 Remove support for Velocity following its deprecation in 1.4
Closes gh-6971
8 years ago
Stephane Nicoll d897bf7354 Merge branch '1.5.x' 8 years ago
Stephane Nicoll 24c2e7d182 Merge branch '1.4.x' into 1.5.x 8 years ago
Craig Andrews d94eedfd8a Exclude `META-INF/build-info.properties` from restart
Prior to this commit any application configured to write
`META-INF/build-info.properties` could trigger unexpected application
restarts. The problem is particularly prevalent when using Eclipse M2E in
combination with Maven's `spring-boot-maven-plugin` `build-info` goal
and Gradle's `springBoot` `buildInfo()`.

Closes gh-7002
8 years ago
Stephane Nicoll 9bc77254a7 Start building against Spring Framework 5 snapshot
This commit enables compatibility build against Spring Framework 5.

The Velocity and Guava support that are deprecated in the 1.x line have
been removed and few other classes contain minor change to comply to non
backward compatible changes in Spring Framework 5.

This commit also switches the required java version to 8.

Closes gh-6977
8 years ago
Stephane Nicoll 6643ec3713 Next development version 8 years ago
Stephane Nicoll 6bd670edbc Initiate 1.4.x branch 8 years ago
Spring Buildmaster 7e9ed5e1a7 Next Development Version 8 years ago
Phillip Webb 7396ccfe04 Harmonize ConditionOutcome messages
Add ConditionMessage class to help build condition messages in a
uniform format and update existing conditions to use it.

Fixes gh-6756
8 years ago
Spring Buildmaster 334baaeffd Next development version 8 years ago
Andy Wilkinson a6f443a953 Automatically disable DevTools when running a Cucumber test
Closes gh-6412
8 years ago
Andy Wilkinson e9c69f261d Merge branch '1.3.x' 8 years ago
Andy Wilkinson e1950e34c6 Include cause when throwing exception due to unreadable manifest
Closes gh-6417
8 years ago
Phillip Webb 05ff4ed4e0 Upgrade to Tomcat 8.5.4 & remove tomcat-juli
Upgrade the managed Tomcat dependency to 8.5.4 and remove `tomcat-juli`
since it's now included in `tomcat-embed-core`.

Fixes gh-6192
8 years ago
Andy Wilkinson bf618d505c Merge branch '1.3.x 8 years ago
Andy Wilkinson b1dd92881d Retry class file upload to remote application that fails to connect
Closes gh-6339
8 years ago
Andy Wilkinson 8e669e2eef Merge branch '1.3.x 8 years ago
Andy Wilkinson 4963cfd67b Reset thread's interrupted flag when catching InterruptedException
Closes gh-6360
8 years ago
Spring Buildmaster 2216369348 Next Development Version 8 years ago
Andy Wilkinson 92bb24e365 Avoid synchronizing on this and use an internal monitor instead
Where possible, code that previously synchronized on this (or on the
class in the case of static methods) has been updated to use an
internal monitor object instead. This allows the locking model that's
employed to be an implementation detail rather than part of the
class's API.

Classes that override a synchronized method continue to declare
the overriding method as synchronized. This ensures that locking
is consistent across the superclass and its subclass.

Closes gh-6262
9 years ago
Stephane Nicoll 5656e83ba9 Enable logging of resolved exceptions
Previously, if an exception was resolved by a `HandlerExceptionResolver`
nothing the log indicated a failure to process the query.

This commit adds a new property `spring.mvc.log-resolved-exception` that
enables warning logs for supported `HandlerExceptionResolver` instances.

When Devtools is enabled, this flag is enabled by default.

Closes gh-2176
9 years ago
Johnny Lim 301574de09 Polish
Closes gh-6234
9 years ago
Andy Wilkinson 52e8ad4b6b Drop back to Hibernate 5.0.9.Final
The upgrade to Hibernate 5.2.0.Final has provide to be too
problematic to live with. It requires Java 8, is incompatible with
a number of other projects in the Hibernate ecosystem, and it's
unclear for how long it will be maintained. We'd previously used
Hibernate 5.1.0.Final but its maintenance is also unclear with
Hibernate 5.1.1.Final being more than 3 months overdue.

This commit drops back to Hibernate 5.0.9.Final. This has a few
advantages:

- It's Java 7 compatible
- It's had some time to mature and should be reasonably free of
  regressions for those moving from 4.3.x
- It's used in both Wildfly and JBoss EAP so there's a fair chance
  that it will continue to be maintained.

Closes gh-6198
9 years ago
Phillip Webb c136054e69 Merge branch '1.3.x' 9 years ago
Phillip Webb 5b97981c87 Polish 9 years ago
Andy Wilkinson f28e3d54c5 Upgrade to Tomcat 8.5.3
This commit changes the default version of Tomcat to 8.5.3 while
also retaining support for Tomcat 8.0 and 7.0. The main difference
in 8.5 is that the ServerSocketFactory abstraction that allowed the
TrustStore and KeyStore to be configured programatically no longer
exists. This logic has been replaced with the use of a custom URL
protocol (springbootssl) that provides access to the key store and
trust store of an SslStoreProvider. In addition to working with 8.5,
this approach has the advantage of also working with 8.0 and 7.0.

Closes gh-6164
9 years ago
Stephane Nicoll 2ff9e3cfdc Upgrade to Hibernate 5.2
See gh-6111
9 years ago
Andy Wilkinson d9d26cba1a Merge branch '1.3.x' 9 years ago
Andy Wilkinson 13635201ff Prevent JVM from exiting with 1 when main thread is only non-daemon
DevTools deliberately throws an uncaught exception on the main thread
as a safe way of causing it to stop processing. This exception is
caught and swallowed by an uncaught exception handler. Unfortunately,
this has the unwanted side-effect of causing the JVM to exit with 1
once all running threads are daemons.

Normally, this isn't a problem. Non-daemon threads, such as those
started by an embedded servlet container, will keep the JVM alive and
restarts of the application context will occur when the user makes to
their application. However, if the user adds DevTools to an
application that doesn't start any non-daemon threads, i.e. it starts,
runs, and then exits, it will exit with 1. This causes both
bootRun in Gradle and spring-boot:run in Maven to report that the
build has failed. While there's no benefit to using DevTools with an
application that behaves in this way, the side-effect of causing the
JVM to exit with 1 is unwanted.

This commit address the problem by updating the uncaught exception
handler to call System.exit(0) if the JVM is going to exit as a
result of the uncaught exception causing the main thread to die. In
other words, if the main thread was the only non-daemon thread, its
death as a result of the uncaught exception will now cause the JVM
to exit with 1 rather than 0. If there are other non-daemon threads
that will keep the JVM alive, the behaviour is unchanged.

Closes gh-5968
9 years ago
Andy Wilkinson d839e1ec00 Remove redundant restart-compatible Redis serializer
Previously, Spring Data Redis assumed that the class loader that loaded
its classes would also be able to load the application’s classes. This
assumption is faulty when there are multiple class loaders involved
such as when using dev tools or when Spring Data Redis is installed as
a shared library in a servlet container.

DATAREDIS-427 and DATAREDIS-501 removed this assumption by making the
default serialiser use the bean class loader. DevTools configures this
class loader to be the restart class loader which can load the
application’s classes. As a result of moving to Hopper SR2 snapshots,
these fixes are now available and we can remove our custom serialised.

Closes gh-5760
9 years ago
Phillip Webb e27bc9ddea Merge branch '1.3.x' 9 years ago
Phillip Webb ed6f11d60d Polish 9 years ago
Phillip Webb 99c6194e17 Don't use MockitoJUnitRunner
Replace `@RunWith(MockitoJUnitRunner.class)` with direct Mockito
initialization since the running doesn't support parallel test
execution.
9 years ago
Andy Wilkinson 277ceb7425 Merge branch '1.3.x' 9 years ago
Martin Lippert efd541d26b Check factory method metadata to avoid NPE in devtools condition
Closes gh-6056
9 years ago
Andy Wilkinson a3f4b3c704 Merge branch '1.3.x' 9 years ago
Andy Wilkinson f3e9f1e6e3 Polish FileSystemWatcher and improve its thread safety
- Limit shared state between FileSystemWatcher and the watching thread
- Use a private monitor rather than synchronizing on this
- Use a Runnable implementation rather than subclassing Thread
- Synchronize consistently when reading and writing state

Closes gh-6039
9 years ago
Phillip Webb ccdcad757a Allow template lookup caching to be disabled
Extract TemplateAvailabilityProvider caching logic to a new
TemplateAvailabilityProviders class and provide property support to
disable it. Also update DevToolsPropertyDefaultsPostProcessor to
automatically set the property.

Fixes gh-5989
9 years ago
Andy Wilkinson bda2e766ac Merge branch '1.3.x' 9 years ago
Andy Wilkinson 9f425343ae Make FileSystemWatcherTests thread-safe
The list of changes is written to on one thread and read from on
another. Without some form of sychronization this is not thread-safe.

This commit makes changes a synchronized list which should guarantee
that the reading thread can see the changes made by the writing thread.
It also removes a redundant call to clear the list of changes at the
start of waitsForPollingInterval.

See gh-6038
9 years ago
Phillip Webb 6cdbdf9ad3 Polish 9 years ago
Johnny Lim 7a62b7d066 Polish
Closes gh-5936
9 years ago
Spring Buildmaster 819a9574a6 Next Development Version 9 years ago
Spring Buildmaster 376bbe68d8 Next Development Version 9 years ago
Andy Wilkinson 96d01d6791 Merge branch '1.3.x' 9 years ago
Andy Wilkinson a19eeaf91d DevTools should only shut down single, auto-configured DataSource
Previously, there were two problems with DevTools’ DataSource
auto-configuration:

1. It did not tolerate a context with multiple DataSources
2. It would attempt to shut down a DataSource that had not been created
   by DataSourceAutoConfiguration and, therefore, where we could not be
   sure of its configuration.

This commit updates DevToolsDataSourceAutoConfiguration so that it backs
off unless the context contains DataSourceProperties and a single
DataSource created by DataSourceAutoConfiguration. This ensures that it
can safely use DataSourceProperties to get the DataSource’s
driver class name and accurately determine if it’s an in-memory or
external database. Shutdown is only called for an in-memory database.

Closes gh-5540
9 years ago
Johnny Lim 61b47079a4 Remove duplicate words
Closes gh-5731
9 years ago
Jakub Narloch 64989ae192 Replacing StringBuffer with lock-free StringBuilder
Closes gh-5727
9 years ago
Andy Wilkinson 43256ee7c9 Merge branch '1.3.x' 9 years ago
Andy Wilkinson b554894bb4 Polishing 9 years ago
Andy Wilkinson 1fbd43bdf0 Tolerate jar files with no manifest in ChangeableUrls
Closes gh-5704
9 years ago
Andy Wilkinson 43d30cc5bc Merge branch '1.3.x' 9 years ago
Andy Wilkinson 1412eaa0e0 Handle relative URLs in jar's Class-Path when getting changeable URLs
5e0ba6ea added support for reading a jar manifest's Class-Path
attribute when resolving changeable URLs from a URLClassLoader,
however it did not handle relative URLs, i.e. URLs without a protocol,
correctly.

This commit updates ChangeableUrls so that it uses the URL of the
JAR that contains the manifest as the base for any new URLs that
are created. When the Class-Path entry is relative, this base will
be used. When the Class-Path entry is absolutee, URL's constructor
will ignore the supplied base.

Closes gh-5665
9 years ago
Phillip Webb 8514064d5c Tweak FileSystemWatcherTests timing for Windows 9 years ago
Phillip Webb 6d23ce2ada Polish 9 years ago
Phillip Webb 6550bb4cf1 Polish 9 years ago
Andy Wilkinson 140e86bb97 Merge branch '1.3.x' 9 years ago
Andy Wilkinson 5e0ba6ea2e Consider jar's Class-Path attribute when getting changeable URLs
To overcome command length limits on Windows, IntelliJ IDEA may launch
an application with a single jar on the classpath that contains that
application's actual classpath in the Class-Path attribute of its
manifest. This would prevent DevTools restarts from working as it
only considered the single jar's URL when identifying changeable URLs
and ignored the URLs added to the classpath via the jar's manifest.

This commit updates ChangeableUrls when it is created from a
URLClassLoader to consider the Class-Path manifest attribute of any
jars in the class loader's URLs. This allows the full classpath to
be considered when identifying URLs that are changeable and that
need to be monitored for restart triggering.

Closes gh-5127
9 years ago
Andy Wilkinson 571973a51a Merge branch '1.3.x' 9 years ago
Johnny Lim ec83d97443 Remove a duplicate test
Closes gh-5615
9 years ago
Phillip Webb b398b3319c Rename @SpringApplicationTest -> @SpringBootTest
Rename @SpringApplicationTest to SpringBootTest and
@SpringApplicationContextLoader to @SpringBootContextLoader.

Fixes gh-5562
9 years ago
Andy Wilkinson 33f0ea3480 Rework SpringApplicationTest to support web modes
Rework the new testing support so that @SpringApplicationTest can be
used for standard integration tests, web integration tests with a
mock Servlet environment and web integration tests with an embedded
servlet container. This means that it a replacement for 1.3's
@IntegrationTest and @WebIntegrationTest and allows all
SpringApplication testing to be configured using a common annotation.

The old @IntegrationTest and @WebIntegrationTest along with their
supporting classes have been reinstated to their previous form (while
remaining deprecated). This should ensure that they continue to work
in 1.4 exactly as they did in 1.3 giving users a smooth path to
@SpringApplicationTest.

See gh-5477
9 years ago
Phillip Webb 893a6c32f3 Upgrade to checkstyle 6.17
Fixes gh-5547
9 years ago
Phillip Webb 0829a1bde8 Drop superfluous annotations
Update internal tests to drop annotations that can now
be inferred.

Fixes gh-5470
9 years ago
Phillip Webb c28f552883 Migrate SpringJUnit4ClassRunner to SpringRunner
Replace all existing SpringJUnit4ClassRunner references with the new
SpringRunner alias.

Fixes gh-5292
9 years ago
Phillip Webb 2f815a907a Migrate existing tests from deprecated package
Update the existing tests to use the relocated `spring-boot-test`
classes. Restructuring was achieved using the following command:

find . -type f -name '*.java' -exec sed -i '' \
-e s/org.springframework.boot.test.ConfigFileApplicationContextInitializer/\
org.springframework.boot.test.context.ConfigFileApplicationContextInitializer/g \
-e s/org.springframework.boot.test.EnvironmentTestUtils/\
org.springframework.boot.test.util.EnvironmentTestUtils/g \
-e s/org.springframework.boot.test.IntegrationTest/\
org.springframework.boot.test.context.IntegrationTest/g \
-e s/org.springframework.boot.test.IntegrationTestPropertiesListener/\
org.springframework.boot.test.context.IntegrationTestPropertiesListener/g \
-e s/org.springframework.boot.test.OutputCapture/\
org.springframework.boot.test.rule.OutputCapture/g \
-e s/org.springframework.boot.test.SpringApplicationConfiguration/\
org.springframework.boot.test.context.SpringApplicationConfiguration/g \
-e s/org.springframework.boot.test.SpringApplicationContextLoader/\
org.springframework.boot.test.context.SpringApplicationContextLoader/g \
-e s/org.springframework.boot.test.SpringBootMockServletContext/\
org.springframework.boot.test.mock.web.SpringBootMockServletContext/g \
-e s/org.springframework.boot.test.TestRestTemplate/\
org.springframework.boot.test.web.client.TestRestTemplate/g \
-e s/org.springframework.boot.test.WebIntegrationTest/\
org.springframework.boot.test.context.web.WebIntegrationTest/g {} \;

See gh-5293
9 years ago
Phillip Webb 644ae2c21a Merge branch '1.3.x' 9 years ago
Phillip Webb 5e722dae6a Polish 9 years ago
Andy Wilkinson 5009933788 Move to constructor injection in simple configuration classes
This commit updates "simple" configuration classes to use constructor
injection. Simple means that there are no optional dependencies
(@Autowired(required=false) is not used), and none of the dependencies
use generics.

Configuration classes that are not simple will be updated in a second
pass once https://jira.spring.io/browse/SPR-14015 has been fixed.

See gh-5306
9 years ago
Andy Wilkinson 367a4ed219 Merge branch '1.3.x' 9 years ago
Andy Wilkinson 40ffe4169b Improve DevTools non-embedded in-memory DB shutdown handling
Shutdown handling has been improved so that it will run after any
EntityManagerFactory beans have been closed. This ensures that Hibernate
can, if configured to do so, drop its schema during restart processing.
Without this change, a benign exception could be logged if the database
was shutdown before Hibernate.

Closes gh-5305
9 years ago
Andy Wilkinson cd6cacfb4f Merge branch '1.3.x' 9 years ago
Andy Wilkinson 7a4e061de5 Make DevTools DataSource auto-config back off without DataSourceProperties
Previously, if DataSourceAutoConfiguration had been explicitly excluded,
DevToolsDataSourceAutoConfiguration would cause refresh to fail due to
a missing DataSourceProperties bean. This commit corrects the condition
so that the auto-configuration is conditional on a DataSource bean and
a DataSourceProperties bean rather than only being conditional on one or
the other.

Closes gh-5269
9 years ago
Spring Buildmaster 225d877ab9 Next Development Version 9 years ago
Andy Wilkinson 44ddfcc7fa Upgrade copyright headers of all files changed in 2016 9 years ago
Andy Wilkinson 6075682e64 Polishing
- Code formatting
 - Javadoc warnings
 - Deprecation warnings
9 years ago
Phillip Webb 89b7704977 Extract spring-boot-test.jar
Relocate the `org.springframework.boot.test` package from the
`spring-boot.jar` to `spring-boot-test.jar`.

Fixes gh-5184
9 years ago
Andy Wilkinson 7512687cba Upgrade to Spring Session 1.1.0.RC1
Closes gh-5161
9 years ago
Andy Wilkinson 4189e145bb Polishing
- Remove usages of deprecated APIs
 - Remove redundant version on dependency declaration
9 years ago
Andy Wilkinson ae08934e08 There may only be a single restart during RestarterTests.testRestart()
See gh-4097 and changes in 2522a5f
9 years ago
Andy Wilkinson 2522a5f9ef Call context.close() rather than shutdown hook in DevTools restart
Previously, when DevTools was restarting the application it would
use reflection to run all of the JVM's shutdown hooks. This was done
to close any SpringApplications' application contexts. Unfortunately,
it had the unwanted side-effect of running other shutdown hooks as
well.

The other shutdown hooks were often written with the, entirely
reasonable, expectation that they would only be called when the JVM
was shutting down. Calling them at another time could leave the
hook's library in an unexpected state. One such example is Log4J2
which was worked around in aaae4aa3 (see gh-4279). Another is the
problem with Eureka (see gh-4097). There's no work around for this
problem, even with reflective hackery, hence the change being made
here.

This commit updates the Restarter so that shutdown hooks are no longer
called during a restart. This removes the chance of a restart having
the unwanted side-effect of leaving a third-party library in a broken
state. RestartApplicationListener now prepares the Restarter with the
root application context, and the Restarter then closes it as part of
the restart. The changes have been tested with an application that
uses a single context and an application with a context hierarchy.

Closes gh-4097
9 years ago
Andy Wilkinson 6e3faecce6 Merge branch '1.3.x' 9 years ago
Andy Wilkinson 1c170b35ea Improve handling of connection failures in remote debug tunnel
Previously, if an application had been started without remote
debugging enabled, an attempt to connect to it via
RemoteSpringApplication and the HTTP tunnel would result in the
application being hammered by connection attempts for 30 seconds.

This commit updates the tunnel server to respond with Service
Unavailable (503) when a connection attempt is made and the JVM
does not have remote debugging enabled. When the client receives a
503 response, it now logs a warning message describing the possible
problem before closing the connection.

The client has also been updated to provide improved diagnostics when
a connection to the tunnel server cannot be established, for example
because the remote URL is incorrect, or the remote application isn't
running.

Lastly, the client has been updated so that it continues to accept
connections when a connection to the server is closed. This allows
the user to correct a problem with the remote application, such as
restarting it with remote debugging enabled, without having to also
restart the process that's running RemoteSpringApplication.

Closes gh-5021
9 years ago
Andy Wilkinson 9836d6ef89 Merge branch '1.3.x' 9 years ago
Andy Wilkinson ac5c6f725c Correct the scope of the postgresql dependency in spring-boot-devtools 9 years ago
Andy Wilkinson 3894ff84e3 Merge branch '1.3.x' 9 years ago
Andy Wilkinson 31aa5ad8dd Remove redundant public modifier 9 years ago
Andy Wilkinson f3aa236e92 Merge branch '1.3.x' 9 years ago
Andy Wilkinson a8f4708ffb Shut down in-memory database when DevTools restarts the context
Previously an in-memory database that wasn’t pooled (an
EmbeddedDatabase) would be shutdown when the context restarted, but
an in-memory database wrapped in a connection pool was not. This meant
that the former would be be wiped clean after each restart, whereas the
latter would not. In addition to being inconsistent, this also
caused problems with schema.sql and data.sql scripts when using
DevTools. If you were using an in-memory database wrapped in a
connection pool, a failure may occur during a restart as the scripts
were not being run against in clean database.

This commit adds an auto-configured bean to DevTools that, when the
context is being closed, will execute “SHUTDOWN” if it identifies that
the DataSource is not an EmbeddedDatabase and is for an in-memory
database.

Closes gh-4699
9 years ago
Phillip Webb 7f9358f4d8 Use AssertJ in spring-boot-devtools
See gh-5083
9 years ago
Phillip Webb 516afcd2ca Polish 9 years ago
Phillip Webb fbaf209240 Move master to 1.4.0.BUILD-SNAPSHOT 9 years ago
Andy Wilkinson 4c1bb38878 Fix broken locking in Restarter.initialize
Closes gh-4955
9 years ago
Spring Buildmaster 504d3e97ba Next development version 9 years ago
Andy Wilkinson 77e350acc0 Polish contribution 9 years ago
Vladimir Tsanev 3e291ff04f Allow DevTools to find and configure Spring Session 1.1's RedisTemplate
Previously, when Spring Session 1.1.0.M1 and DevTools were declared as
dependencies the application failed to start, because
sessionRedisTemplate could not be resolved.

This commit relaxes the dependency for sessionRedisTemplate in
restartCompatibleRedisSerializerConfigurer from
RedisTemplate<String, ExpiringSession> to RedisTemplate<?, ?> and uses
the bean name in a @Qualifer to ensure that the right RedisTemplate
bean gets injected.

Fixes gh-4895
Closes gh-4896
9 years ago
mrumpf 1f5291cd84 Fixed the check whether Log4j2 is available on the classpath
In Spring Boot 1.3.1 the class 'org.apache.logging.log4j.LogManager'
is used to check which logging backend is in use. But this class is
part of the log4j-api.jar and not part of the log4j-core.jar.
That means the check is invalid, as it does not detect the actual
core implementation of Log4j2 correctly.

When you want to redirect Log4j2 logging via SLF4J, a NPE occurs
each time the application is reloaded by the devtools, because the
class Log4j2RestartListener tries to shutdown Log4j2 resources.
This is done by accessing some internal shutdown method via
reflection. The method that is being looked for does not exist
when the log4j-api.jar is available only on the classpath,
resulting in a NPE. This causes the application to stop,
disappearing from the Spring Boot Dashboard in Eclipse

Closes gh-4831
9 years ago
Spring Buildmaster 8db59059a5 Next Development Version 9 years ago
Kirill Vlasov ec2f33f986 Make loggers private static final
Apply consistency across all static loggers.

Closes gh-4784
9 years ago
mnhock ea016f5442 Remove redundant toString() call
Closes gh-4706
9 years ago
Phillip Webb 0489a3b4de Polish 9 years ago
Andy Wilkinson df9308c645 HttpTunnelServer should only check for disconnect after first connection
Previously, ServerThread would check for a disconnect as soon as it
had been started. This raced with it handling its first connection. If
the check for disconnect won the race it would incorrectly determine
that the disconnect timeout had been reached and wouldn’t respond to
the connection.

This commit updates ServerThread so that it only checks the disconnect
timeout once it’s handled at least one connection.

Closes gh-4668
9 years ago
Andy Wilkinson e4342075ab Fix class loading problem with DevTools and Spring Session with Redis
Previously, when a session attribute that had been stored in Redis was
being deserialized, the app class loader would be used. This would
result in a ClassCastException if the attribute was an instance of a
class visible to the restart class loader.

This commit auto-configures Spring Session’s RedisTemplate to use a
custom deserializer that uses the restart class loader when
deserializing session attributes.

Closes gh-3805
9 years ago
Andy Wilkinson 256cad8980 Fix inconsistent synchronization in HttpTunnelServer.ServerThread
Previously, ServerThread.lastHttpRequestTime was written while
synchronized on this.httpConnections but was read without
synchronization. This could lead to a read of the field producing the
wrong value and cause premature connection timeout.

This commit moves the call to checkNotDisconnected into a block that
sychronizes on this.httpConnections, thereby ensuring that
lastHttpRequestTime can be read safely.

Closes gh-4668
9 years ago
Johnny Lim 8ec00c35bf Polish
Closes gh-4572
9 years ago
Johnny Lim efff4a0051 Polish
Closes gh-4554
9 years ago