Commit Graph

130 Commits

Author SHA1 Message Date
Spring Operator
e401d02ced Use HTTPS for external links wherever possible
See gh-16316
2019-03-27 11:35:54 +00:00
Andy Wilkinson
0e009ef047 Use HTTPS to link to the Apache license 2019-03-20 15:00:10 +00:00
Spring Operator
7c314122f7 Update build and setup configuration to use HTTPS
See gh-16243
2019-03-19 16:01:05 +00:00
Spring Buildmaster
5f959b074f Next Development Version 2016-09-20 20:20:06 +00:00
Spring Buildmaster
a89ef5df6e Next Development Version 2016-07-28 09:18:40 +00:00
Andy Wilkinson
e1950e34c6 Include cause when throwing exception due to unreadable manifest
Closes gh-6417
2016-07-19 08:48:04 +01:00
Andy Wilkinson
b1dd92881d Retry class file upload to remote application that fails to connect
Closes gh-6339
2016-07-13 10:35:42 +01:00
Andy Wilkinson
4963cfd67b Reset thread's interrupted flag when catching InterruptedException
Closes gh-6360
2016-07-11 16:46:05 +01:00
Spring Buildmaster
2216369348 Next Development Version 2016-07-04 14:15:02 +00:00
Phillip Webb
5b97981c87 Polish 2016-06-20 18:13:43 -07:00
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
2016-06-17 09:55:30 +01:00
Phillip Webb
ed6f11d60d Polish 2016-06-10 11:46:26 -07:00
Martin Lippert
efd541d26b Check factory method metadata to avoid NPE in devtools condition
Closes gh-6056
2016-06-01 18:08:17 +01:00
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
2016-06-01 17:13:04 +01:00
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
2016-05-25 20:59:03 +01:00
Spring Buildmaster
819a9574a6 Next Development Version 2016-05-10 05:28:34 +00:00
Spring Buildmaster
376bbe68d8 Next Development Version 2016-05-06 11:23:57 +00:00
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
2016-04-19 11:41:21 +01:00
Andy Wilkinson
b554894bb4 Polishing 2016-04-15 17:27:19 +01:00
Andy Wilkinson
1fbd43bdf0 Tolerate jar files with no manifest in ChangeableUrls
Closes gh-5704
2016-04-15 17:18:00 +01:00
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
2016-04-12 13:47:58 +01:00
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
2016-04-07 17:44:38 +01:00
Johnny Lim
ec83d97443 Remove a duplicate test
Closes gh-5615
2016-04-06 11:43:21 +01:00
Phillip Webb
5e722dae6a Polish 2016-03-08 09:37:13 -08:00
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
2016-03-02 10:55:29 +00:00
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
2016-02-29 11:37:17 +00:00
Spring Buildmaster
225d877ab9 Next Development Version 2016-02-26 01:06:16 -08:00
Andy Wilkinson
6075682e64 Polishing
- Code formatting
 - Javadoc warnings
 - Deprecation warnings
2016-02-24 17:05:54 +00:00
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
2016-02-12 12:50:58 +00:00
Andy Wilkinson
ac5c6f725c Correct the scope of the postgresql dependency in spring-boot-devtools 2016-02-12 09:39:05 +00:00
Andy Wilkinson
31aa5ad8dd Remove redundant public modifier 2016-02-11 16:28:15 +00:00
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
2016-02-11 16:01:07 +00:00
Andy Wilkinson
4c1bb38878 Fix broken locking in Restarter.initialize
Closes gh-4955
2016-01-22 15:21:00 +00:00
Spring Buildmaster
504d3e97ba Next development version 2016-01-21 18:41:30 -08:00
Andy Wilkinson
77e350acc0 Polish contribution 2016-01-18 15:39:40 +00:00
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
2016-01-18 15:36:04 +00:00
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
2016-01-12 16:14:11 +01:00
Spring Buildmaster
8db59059a5 Next Development Version 2015-12-18 05:43:02 -08:00
Kirill Vlasov
ec2f33f986 Make loggers private static final
Apply consistency across all static loggers.

Closes gh-4784
2015-12-16 21:02:53 +00:00
mnhock
ea016f5442 Remove redundant toString() call
Closes gh-4706
2015-12-11 13:43:30 +00:00
Phillip Webb
0489a3b4de Polish 2015-12-10 19:43:29 +00:00
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
2015-12-04 16:00:25 +00:00
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
2015-12-04 11:58:52 +00:00
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
2015-12-03 10:57:14 +00:00
Johnny Lim
8ec00c35bf Polish
Closes gh-4572
2015-11-21 08:12:21 +01:00
Johnny Lim
efff4a0051 Polish
Closes gh-4554
2015-11-20 11:02:08 +01:00
Spring Buildmaster
3f6f57a80e Next Development Version 2015-11-16 03:18:54 -08:00
Johnny Lim
903cdf3ddd Polish 2015-11-13 21:45:43 -08:00
Johnny Lim
1e4f8fdd8e Polish 2015-11-13 18:06:31 -08:00
Phillip Webb
3e8cafaf97 Add support for spring-devtools.properties
Allow `META-INF/spring-devtools.properties` files to be used by
application developers to declare is specific jars should be included
or excluded from the RestartClassLoader.

A typical example where this might be used is a company that develops
it's own set of internal JARs that are used by developers but not
usually imported into their IDE.

See gh-3316
2015-11-13 10:32:44 -08:00