Commit Graph

6930 Commits (f3aa236e922efc20159167160df907f0e082b0bc)
 

Author SHA1 Message Date
Andy Wilkinson 03669002de Check for null context when trying to find an exception mapper
If application context refresh fails, SpringApplication will have a 
null context. Previously, this would result in an NPE when looking for
an ExitCodeExceptionMapper.

This commit updates SpringApplication to gracefully handle the context
being null when looking for an ExitCodeExceptionMapper.

Closes gh-4803
9 years ago
Stephane Nicoll ea5195c8a6 Better document how DataSource is bound to the env
Closes gh-4971
9 years ago
Andy Wilkinson 2dc3660a32 Align launcher exception handling with direct invocation of main method
Previously, if an application’s main method threw an exception,
MainMethodRunner would catch the exception and call System.exit(1).
This meant that the JVM would exit, irrespective of whether or not
any non-daemon threads were running. In contrast, when an application’s
main method was invoked directly (in an IDE, for example) the JVM
would not exit if one or more non-daemon threads were running. This
is standard JVM behaviour that we should be consistent with in the
launcher.

This commit updates MainMethodRunner to wrap any exception thrown by an
application’s main method in a RuntimeException and rethrow it. This
alllows the JVM to handle the exception and use its normal rules for
deciding whether or not it should exit.

Closes gh-4984
9 years ago
Stephane Nicoll 9f728b3d59 Fix wrong import 9 years ago
Stephane Nicoll a61b29e6ac Merge pull request #4987 from rakk/master
* pr/4987:
  Update inconsistent documentation
9 years ago
Robert Kapala 9de13446c4 Update inconsistent documentation
Closes gh-4987
9 years ago
Stephane Nicoll ea8e0cfc48 Support for simple numeric Flyway version
While Flyway's `MigrationVersion` is a String value, a simple "0" is
also a valid number. When such value is not wrapped in YAML, an integer
is injected rather than a String which leads to a failure as we can't
convert it.

This commit updates the `StringToMigrationVersionConverter` to also
supports conversion from a Number. This is a convenience for users
using YAML for configuration

Closes gh-4981
9 years ago
Stephane Nicoll c23af8f54e Support of GenericConverter
This commit makes sure to also include any `GenericConverter` flagged for
inclusion in the conversion service to use to convert configuration keys.

Previously, those were ignored as `Converter` and `GenericConverter` are
two separate interfaces.

Closes gh-4988
9 years ago
Andy Wilkinson 6f8d4c77e6 Handle multiple ContextRefreshedEvents in BackgroundPreinitializer
The same initializer will receive multiple ContextRefreshedEvents
when their is an application context hierarchy. This commit updates
the initializer to correctly handle multiple ContextRefreshedEvents
and only act upon the first that it receives.

See gh-4871
9 years ago
Andy Wilkinson 992e90f43d Ensure that background preinit has completed before refresh returns
This commit is a continuation of the changes made in b85b608. It
addresses an additional problem when testing applications where two
contexts are refreshed in quick succession. In this scenario, it
was possible, theoretically at least, for the first context’s background preinitialization to still be in progress and creating loggers when the
second is refreshed and resets the logger context.

This commit updates BackgroundPreinitializer so that, upon receipt of
a ContextRefreshedEvent, it waits for preinitialization to have
completed. In the scenario described above, this ensures that
preinitialization has completed before the call to refresh() for the
first context returns, thereby preventing it from running in parallel
with the refresh of the second context.

Closes gh-4871
9 years ago
Stephane Nicoll 179467bdd9 Make HazelcastJpaDependencyAutoConfiguration public
If Both Hazelcast and Hibernate are available, Spring Boot takes the
opinion that Hazelcast can be used for 2nd level caching and therefore
need to start before Hibernate.

Unfortunately, some users require Hibernate in some of their hazelcast
use case so the link is actually reversed. One way for such user is to
disable the auto-configuration that deals with this link. This class is
now public so that users can locate them and exclude them if necessary.

Closes gh-4960
9 years ago
Andy Wilkinson 5e5542f09c Describe the ordering of spring.config.location in the documentation
Closes gh-4964
9 years ago
Andy Wilkinson b85b60828c Perform background preinitialization after logging system setup
Previously, BackgroundPreinitializer would kick off preinitialization
on a separate thread in response to an ApplicationStartedEvent. This
work would then race with the logging system being set up in response
to an ApplicationEnvironmentPreparedEvent. When Logback’s being used
this race is problematic. As part of Logback’s setup,
LoggerContext.stop() is called. This calls LoggerContext.reset() which
can fail with a ConcurrentModificationException if another thread tries
to create a Logger at the same time. This is a known bug in Logback [1].

This commit updates BackgroundPreinitializer to respond to
an ApplicationEnvironmentPreparedEvent and to order itself so that it’s
called after LoggingApplicationListener has responded to the same event
by initializing the logging system.

Closes gh-4871

[1] http://jira.qos.ch/browse/LOGBACK-397
9 years ago
Andy Wilkinson 00f4538529 Don’t check that a Gauge’s value is a Number until it’s being read
Spring Boot’s metrics require all values to be Numbers. A Dropwizard
Gauge can have a non-Number value. Previously, to prevent this causing
a problem, MetricRegistryMetricReader would check the value of a Gauge
when it’s being added and ignore it if it had a non-Number value.
Unfortunately, retrieving the value of a Gauge can take a non-trivial
amount of time (hence CachedGauge) so this approach, while functional,
could be improved.

This commit updates the filtering to happen when a Metric is being
retrieved from MetricRegistryMetricReader (via findOne or findAll)
when its value is required anyway. At this point, any Gauge with a
non-Number value is ignored.

Closes gh-4874
9 years ago
Andy Wilkinson d7fbe9efbb Merge branch 'gh-4976' 9 years ago
Andy Wilkinson 2f24c1862a Polish contribution 9 years ago
mkwaczynski 3724db9ecc Include details in AuditEvent data in AuthenticationAuditListener
Closes gh-4976
9 years ago
Andy Wilkinson 1dd166691d Merge branch '1.2.x' 9 years ago
Andy Wilkinson 5ef6903690 Make EmbeddedVelocityToolboxView work in servlet container deployments
EmbeddedVelocityToolboxView is used with both embedded containers and
when a Spring Boot application is deployed to a servlet container. It
process the ServletContext to intercept calls to getResource so that it
can load Velocity’s toolbox.xml file from within an executable jar.
Previously, when it created the proxy, it didn’t specify the ClassLoader
to use. This resulted in the proxy being created using the ClassLoader
that loaded the Class that is being proxied. This fails when the
application is deployed to a ServletContainer as the ClassLoader that
loaded the ServletContext implementation is the container’s ClassLoader
and it cannot see the classes that are specific to the web application.

This commit updates EmbeddedVelocityToolboxView to specify the
ClassLoader to use when creating the proxy. It specifies its own
ClassLoader thereby ensuring that the proxy creation can load
application-specific classes.

Fixes gh-4967
9 years ago
Stephane Nicoll 46470934d7 Fix log message
Closes gh-4969
9 years ago
Stephane Nicoll c57588ac09 Merge branch '1.2.x' 9 years ago
Stephane Nicoll 2ceadd705b Fix documentation of logging.path and logging.file
See gh-4969
9 years ago
Andy Wilkinson 112b707b67 Ensure that MongoClient is not created with a null credentials list
Mongo’s 2.x driver allowed the credentials list to be null, however
the 3.x driver requires an empty list instead. The behaviour of the 2.x
driver is the same whether the client is created with a null credential
list or an empty credential list.

This commit aligns with the requirements of the 3.x driver by ensuring
that we never pass in a null credential list when creating the client.

Closes gh-4076
9 years ago
Andy Wilkinson 6dadac1d4f Merge branch 'gh-4895' 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
Andy Wilkinson da4504118e Merge branch '1.2.x' 9 years ago
Andy Wilkinson 43ed824f40 Reinstate Tomcat’s old default behaviour for context root redirects
Prior to Tomcat 8.0.30, its default behaviour was for the mapper to
redirect a request for context-root to context-root/. This redirection
was switched off by default in 8.0.30 by default. This has proven
to be problematic and Tomcat 8.0.31 will reinstate the old default.

While we are waiting for Tomcat 8.0.31 to be released, this commit
explicitly sets the default back to what it was in 8.0.29 and earlier
and what it will be in 8.0.31.

Closes gh-4937
9 years ago
Andy Wilkinson 69b60f6d8c Remove HalJsonMvcEndpoint’s redirect and add links to both paths instead
Previously, HalJsonMvcEndpoint used a redirect to go from path/ to path.
When the actuator’s configured to use a custom context path this
redirect was leading to an infinite redirect loop.

This commit removes the redirect in favour of updating the controller
advice to apply the links to requests for path and path/.

Closes gh-4853
9 years ago
Andy Wilkinson c4f756daee Fix MavenSettings’ handling of profiles activated by a file
Previously, MavenSettings used a FileProfileActivator with no
PathTransformer. If a settings.xml file contains a file-activated
profile this would result in an NPE within Maven. This was made worse
by the NPE not being included in the resulting failure message which
hampered diagnosis of the problem.

This commit updates MavenSettings to configure its FileProfileActivator
with a PathTransformer. It also improves the failure message that’s
created from any problems that are reported by Maven while determining
the active profiles to include a problem’s exception if it has one.

Closes gh-4826
9 years ago
Stephane Nicoll 7d975ecd2e Polish 9 years ago
Stephane Nicoll af5d765a08 Enable resource chain if webjars locator is present
Webjars locator is a good hint that the resource chain should be
enabled. The sole presence of the library now enables the resource chain
unless the configuration states otherwise.

Closes gh-4403
9 years ago
Stephane Nicoll 7842f50e30 Add property to skip integration tests
Generalize the `skip` property to start and stop goals so that one
can control if the Spring Boot app is starting via a configuration
property.

Note that this only controls the Spring Boot Maven plugin and the
failsafe maven plugin should be updated accordingly.

Closes gh-4922
9 years ago
Stephane Nicoll 6c5441d041 Fix typo 9 years ago
Stephane Nicoll fc857d832b Merge pull request #4956 from vpavic/update-readme
* pr/4956:
  Document use of maven wrapper
9 years ago
Vedran Pavic 0ba9a18cf2 Document use of maven wrapper
Closes gh-4956
9 years ago
Brian Kelly 0f2c25c4b8 Clarify location for Flyway callback scripts
Closes gh-4947
9 years ago
Andy Wilkinson eb3d64108e Merge branch 'gh-4320' 9 years ago
Andy Wilkinson f5b973a242 Polish contribution
- Update copyright headers
 - Use kebab-case for the property name
 - Set the header unconditionally when the filter's registered

Closes gh-4320
9 years ago
Eddú Meléndez c219f5e57f Don't create ApplicationContextHeaderFilter when header is disabled
See gh-4320
Closes gh-4454
9 years ago
Andy Wilkinson b02cdc7248 Merge branch 'gh-4813' 9 years ago
Andy Wilkinson 93ef795159 More use entrySet() rather than using keySet() and get(key)
This commit replaces some more occurrances of keySet() and get(key)
with more efficient usage of the map's entry set.

See gh-4813
9 years ago
mnhock 8f1f8dd680 Use entrySet() rather than using keySet() and then calling get(key)
Closes gh-4813
9 years ago
Robert Požarickij 48d22f933d Fix grammar in CONTRIBUTING.adoc
Closes gh-4885
9 years ago
Andy Wilkinson d1b3522227 Provide some guidlines on securing an app that's symlinked into init.d
Closes gh-4935
9 years ago
Andy Wilkinson 97c5a1b3aa Merge branch '1.2.x' 9 years ago
Andy Wilkinson 2f2bba4d26 Fix docs for using YAML to configure Log4J 2
Previously, the documentation stated that jackson-dataformat-yaml was
the only required dependency. This is incorrect. jackson-databind is
also required.

Closes gh-4924
9 years ago
Andy Wilkinson 1107079683 Merge branch '1.2.x' 9 years ago
Andy Wilkinson b56eef236e Close Reader used by MustacheViewResolver when compiling a Template
Previously, MustacheViewResolver would create an InputStreamReader
that wraps the template Resource's InputStream but would fail to close
the Reader. When the InputStream was a FileInputStream, this caused
the resolver to leak file handles.

This commit updates the resolver to close the Reader once the Template
has been compiled, thereby allowing any underlying resources to be
cleaned up immediately, rather than having to wait for the JVM to exit.

Closes gh-4921
9 years ago
Andy Wilkinson 89beef4099 Merge branch '1.2.x' 9 years ago