Commit Graph

1881 Commits

Author SHA1 Message Date
Phillip Webb 1e9e1b04d0 Hide 'No log4j2 configuration file found' error
Add a Log4J2 `ConfigurationFactory` that is always applied so that the
"No log4j2 configuration file found" error message does not appear.

Although the message was harmless it was quite annoying to Spring Boot
users who could safely omit the file.

Fixes gh-4809
2016-12-27 17:36:38 -08:00
Phillip Webb 87a852959d Support logging.pattern.* properties with Log4J2
Update Log4J2 configurations to respect `FILE_LOG_PATTERN` and
`CONSOLE_LOG_PATTERN` system properties. These system properties are
set by `LoggingSystemProperties` from `logging.pattern.file` and
`logging.pattern.console` properties in the Spring Environment.

Fixes gh-7757
2016-12-27 17:33:17 -08:00
Phillip Webb a23591e047 Support Jetty 9.4 and upgrade to 9.4.0.v20161208
Update `JettyEmbeddedServletContainerFactory` to support Jetty 9.4
directly and Jetty 9.3 via reflection. The primary difference between
Jetty 9.3 and 9.4 are the session management classes. Websocket suppport
has also been updates, but this is handled transparently by the
Spring Framework support.

Fixes gh-7599
2016-12-24 11:22:38 -08:00
Spring Buildmaster 9057f9ae1f Next development version 2016-12-23 00:15:23 +00:00
Stephane Nicoll 5d16edd067 Polish
See gh-6543
2016-12-22 16:49:44 +01:00
Stephane Nicoll 449043bf21 Polish contribution
Closes gh-6900
2016-12-22 15:39:31 +01:00
Johnny Lim e12b4a944f Polish 2016-12-21 20:18:04 -08:00
Phillip Webb 4aac1e3f90 Refine LoggingApplicationListenerTests
Update the Tomcat logging test to be more like the real scenario.

See gh-7639
2016-12-21 20:18:03 -08:00
Phillip Webb 765fd1dca0 Merge branch '1.4.x' into 1.5.x 2016-12-21 20:15:54 -08:00
Phillip Webb c23d8fb375 Ignore unresolvable placeholder in log properties
Update the RelaxedPropertyResolver used to load log properties so that
`${...}` patterns are ignored when possible.

Fixes gh-7719
2016-12-21 11:42:56 -08:00
Phillip Webb 38f7389eab Polish loggers 2016-12-20 21:16:40 -08:00
Phillip Webb 73a45797c0 Merge branch '1.4.x' into 1.5.x 2016-12-19 18:45:35 -08:00
Chaouki Dhib 2ea4d4b1d9 Broaden LoggingApplicationListener ignores
Update `LoggingApplicationListener` to ignore all `-D` prefixed
property values. As well as catching the Azure use-case, this update
now means Spring Boot application can start when Tomcat is missing
`CATALINA_BASE\conf\logging.properties` and sets the value `-Dnop`.

Closes gh-7639
2016-12-19 18:44:48 -08:00
Phillip Webb f36ed673fd Make Logback 1.1.8 upgrade back compatible
Update the fix committed in a2d46dc16c to fallback to reflection based
invocation in case earlier versions of Logback are being used.

Closes gh-7638
2016-12-19 18:30:28 -08:00
Phillip Webb d15f3548be Polish 2016-12-19 13:12:03 -08:00
Phillip Webb 6121208cbb Polish formatting 2016-12-19 12:47:03 -08:00
Phillip Webb 4b9cba351b Merge branch '1.4.x' into 1.5.x 2016-12-19 12:36:57 -08:00
Phillip Webb bd74c3d327 Polish formatting 2016-12-19 12:25:09 -08:00
Stephane Nicoll ef3f32f493 Remove unused "hasTransactionManager" method
Closes gh-7592
2016-12-16 14:58:22 +01:00
Stephane Nicoll ac866707d5 Merge branch '1.4.x' into 1.5.x 2016-12-15 14:02:51 +01:00
Stephane Nicoll a2d46dc16c Upgrade to Logback 1.1.8
Closes gh-7638
2016-12-15 14:01:03 +01:00
Stephane Nicoll 2b09050568 Merge branch '1.4.x' into 1.5.x 2016-12-15 10:44:22 +01:00
Stephane Nicoll 477c874eca Improve DatabaseDriver detection based on jdbc url
This commit fixes the detection of JDBC urls for DB2 AS400, Firebird and
Informix.

Closes gh-7651
2016-12-15 10:39:03 +01:00
Johnny Lim 6d1b752ffe Polish
Closes gh-7552
2016-12-14 19:14:24 +01:00
Andy Wilkinson d9e2368512 Merge branch '1.4.x' into 1.5.x 2016-12-13 10:02:52 +00:00
Andy Wilkinson 14a90aa52e Update SpringApplicationBuilder javadoc to reflect API changes
Closes gh-7609
2016-12-13 10:02:00 +00:00
Madhura Bhave b29620f2ad Allow overriding case in SpringPhysicalNamingStrategy
Fixes gh-7410
2016-12-08 14:25:39 -08:00
Andy Wilkinson 887a206b0c Remove redundant @ConfigurationProperties annotation
See gh-7397
2016-12-05 13:17:12 +00:00
Andy Wilkinson 3e9a4de869 Allow spring.profiles to be configured as a YAML list/array
Closes gh-7397
2016-12-05 12:11:24 +00:00
Andy Wilkinson 1464425d64 Remove use of @Component from classes that are not scanned
Closes gh-7549
2016-12-02 17:57:21 +00:00
Stephane Nicoll ee72e788ed Rename `spring-boot-junit-runners` to `spring-boot-test-support`
Closes gh-7421
2016-12-01 16:25:47 +01:00
Stephane Nicoll c127c1fdf9 Polish doc
Closes gh-7381
2016-12-01 14:54:54 +01:00
Stephane Nicoll b4e7a96868 Harmonize LoggingApplicationListener constants
Closes gh-4970
2016-12-01 14:49:46 +01:00
Oscar Utbult 0a1009bc42 Use addAll instead of manual array to collection copy
Closes gh-7539
2016-12-01 12:12:19 +01:00
Nicklas Holm ac10f65851 Fix typo
Closes gh-7541
2016-12-01 12:10:13 +01:00
Stephane Nicoll 2c630b5c61 Validate schema and data resources
Previously, if a user specifies a path to a schema or data DDL that does
not exist, the application will start up fine and the missing DDL would
not be reported.

This commit validates that user-defined resources actually exist and
throw a new `ResourceNotFoundException` if they don't.

Closes gh-7088
2016-12-01 11:52:52 +01:00
Oscar Utbult 2ae4515f3c Remove redundant array creation for calling varargs method
Closes gh-7526
2016-11-30 15:19:05 +01:00
Stephane Nicoll 0119c3a543 Fix metadata for spring.profiles.[include|active]
See gh-6995
2016-11-28 09:32:04 +01:00
Phillip Johnson f64d5303cf Document and test array support for spring.profiles.*
Closes gh-7175
Closes gh-6995
2016-11-25 10:24:14 +00:00
Andy Wilkinson 919d0c6172 Use data binding to access spring.profiles .active and .include
Previously, spring.profiles.active and spring.profiles.include were
looked up manually. This meant that configuration that used indexes
(for example spring.profiles.active[0]=dev) were not bound. As a
result, YAML lists did not work.

This commit updates ConfigFileApplicationListener to use a
RelaxedDataBinder to retrieve the values of spring.profiles.active
and spring.profiles.include, thereby reusing the data binding logic
that supports property names with indexes.

See gh-6995
2016-11-25 10:24:13 +00:00
Stephane Nicoll 25c4f0b5bb Merge branch '1.4.x' into 1.5.x 2016-11-24 16:11:51 +01:00
Stephane Nicoll 4c61c9f26a Polish contribution
Closes gh-7462
2016-11-24 16:07:03 +01:00
Peter Leibiger 203b6f2f2c Fix undertow session persistence with spring-boot-devtools
Fixes gh-7460
2016-11-24 16:00:23 +01:00
sangwook 7e46f8e2e3 Make it easier to override FILE_LOG_PATTERN
Closes gh-6782
2016-11-22 14:52:51 +00:00
Andy Wilkinson c9427191ee Set TCCL before initialising test class in FilteredClassPathRunner
Closes gh-7435
2016-11-21 10:41:41 +00:00
Stephane Nicoll 9423b9831c Merge branch '1.4.x' into 1.5.x 2016-11-20 15:52:49 +09:00
Stephane Nicoll 249ed899a6 Fix use of KB and MB in Multipart documentation
Closes gh-7364
2016-11-20 15:51:47 +09:00
Phillip Webb 1657120286 Move ModifiedClassPathRunner to its own module
Migrate `ModifiedClassPathRunner` from `spring-boot` test source to
its own module.

Fixes gh-7420
2016-11-18 17:27:54 -08:00
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
2016-11-18 16:39:44 +00:00
Andy Wilkinson b1ba484d0c Add dependency management for SQL Server's JDBC driver
Closes gh-7413
2016-11-18 12:03:41 +00:00
Phillip Webb 12d9ebfc02 Polish ErrorPageFilter.getDescription javadoc
See gh-7393
2016-11-16 15:30:35 -08:00
Stéphane Daviet 004528777f Make ErrorPageFilter.getDescription protected
Make `ErrorPageFilter#getDescription` `protected` instead of `private`
to be able to customize the details for the request logged in case of
an error.

Fixes gh-7380
Closes gh-7393
2016-11-16 15:30:35 -08:00
Phillip Webb 1d2f6d25fa Use consistent 'ROOT' logger name
Ensure all LoggingSystem implementation provide a consistent ROOT logger
name. Prior to this commit the `/loggers` endpoint could return '' for
root loggers which could then not be set using a POST.

Fixes gh-7372
2016-11-15 17:27:15 -08:00
Phillip Webb 01c381f2a9 Remove empty logger from default logback config
Remove the empty logger as it was not also defined in `defaults.xml`
and caused rendering issues with the new `/loggers` endpoint.

Fixes gh-7386
2016-11-15 15:46:19 -08:00
Madhura Bhave e7db7adfb8 Rename ApplicationStartedEvent
Rename `ApplicationStartedEvent` to `ApplicationStartingEvent` to
avoid confusion.

Fixes gh-7381
2016-11-15 15:43:35 -08:00
Madhura Bhave 0e3a3df6f4 Return log levels in `/loggers` endpoint payload
Update `LoggersEndpoint` to additionally return the log levels actually
supported by the system.

Fixes gh-7396
2016-11-15 14:32:02 -08:00
Huang YunKun 71826708a4 Upgrade to Log4j 2.7
Closes gh-7323
2016-11-11 15:25:33 +00:00
Andy Wilkinson 89d5e086e4 Merge branch '1.4.x' into 1.5.x 2016-11-11 11:47:55 +00:00
Andy Wilkinson a1dda12bcb Disable Server header by default when using SSL with Jetty 9
Closes gh-7359
2016-11-11 11:46:57 +00:00
Spring Buildmaster e712a9ba8c Next Development Version 2016-11-08 16:55:37 +00:00
Stephane Nicoll 389acb094b Merge branch '1.4.x' into 1.5.x 2016-11-05 07:43:09 +01:00
Johnny Lim ec9f0ab6b4 Polish
Closes gh-7322
2016-11-05 07:42:37 +01:00
Phillip Webb f15e0482c5 Merge branch '1.4.x' into 1.5.x 2016-11-04 16:01:02 -07:00
Phillip Webb 1bd53ea9d8 Support package private requestFactory classes
Update `RestTemplateBuilder` to support package private `requestFactory`
classes.

Fixes gh-7319
2016-11-04 15:58:27 -07:00
Andy Wilkinson 90cc322c5e Merge branch '1.4.x' into 1.5.x 2016-11-01 10:36:30 +00:00
Andy Wilkinson 4919c6f30c Ignore scoped targets when collecting servlet context initializer beans
Previously, there were two problems with servlet context initializer
beans that are a scoped proxy:

1. When there's no explicit registration bean the target of the scoped
   proxy is registered rather than the proxy. This meant that the
   proxy had no effect as it was being bypassed.
2. When there is an explicit registration bean, the registration is
   performed twice: the faulty implicit registration described above
   and explicit registration.

A fix (SPR-14816) has been made in Spring Framework so that we can
correctly determine the type of bean that will be produced by a
scoped proxy's factory bean. That change, coupled with the change in
this commit that ignored beans that are the target of a scoped proxy
addresses both of the problems described above. A single registration
is now performed and its the scoped proxy, rather than its target,
that is registered.

Closes gh-7150
2016-11-01 10:24:33 +00:00
Phillip Webb 5b66ffbb4b Merge branch '1.4.x' into 1.5.x 2016-10-31 23:09:36 -07:00
Phillip Webb 1b17677e0b Polish TLD skip pattern support
See gh-5010
2016-10-31 23:09:24 -07:00
Mike Youngstrom 970dcc3fd3 Support ApplicationReadyEvent from PidFileWriter
Update `ApplicationPidFileWriter` to support `ApplicationReadyEvent` in
addition to the already supported `ApplicationEnvironmentPreparedEvent`
and `ApplicationPreparedEvent` events.

Closes gh-7066
Fixes gh-7027
2016-10-31 16:34:27 -07:00
Johnny Lim 7bb63238ab Fix typo
Closes gh-7253
2016-10-31 11:37:52 +01:00
Stephane Nicoll 4f06e52d7e Allow adding additional tld skip patterns
This commit improves `TomcatEmbeddedServletContainerFactory` so that tld
skip patterns can be set or added to an existing set. An additional
`server.tomcat.additional-tld-skip-patterns` is now being exposed to
easily add patterns via configuration.

Closes gh-5010
2016-10-31 10:15:16 +01:00
Stephane Nicoll ed7de8eb60 Polish contribution
Also add rotate attribute to Undertow

Closes gh-7225
2016-10-26 11:31:17 +02:00
Phillip Webb a448183681 Polish `/loggers` actuator endpoint
See gh-7086
2016-10-24 10:24:36 -07:00
Ben Hale 06cb4fcca5 Add `/loggers` actuator endpoint
Add `LoggersEndpoint` that can enables listing and configuration of log
levels. This actuator builds on top of the `LoggingSystem` abstraction
and implements support for Logback, Log4J2, and JUL.  The LoggingSystem
interface is modified to require each implementation to list the
configuration of all loggers as well as an individual logger by name.

The MVC endpoint exposes these behaviors at `GET /loggers` and
`GET /loggers/{name}` (much like the metrics actuator).

In addition `POST /loggers/{name}` allows users to modify the level for a given
logger. This modification is passed to the logging implementation, which
then decides, as an internal implementation detail, what the final outcome
of the modification is (e.g. changing all unconfigured children). Users
are then expected to request the listing of all loggers to see what has
changed internally to the logging system.

Closes gh-7086
2016-10-24 10:24:36 -07:00
Stephane Nicoll ae4dd0d17e Merge branch '1.4.x' into 1.5.x 2016-10-24 18:08:23 +02:00
Stephane Nicoll a638dcd51b Remove unnecessary use of System.out.println 2016-10-24 18:07:40 +02:00
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
2016-10-20 21:02:21 +01:00
Andy Wilkinson 129c20965b Merge branch '1.4.x' into 1.5.x 2016-10-19 14:24:24 +01:00
Andy Wilkinson 943a054b61 Remove ineffective, premature optimisation from ErrorPageFilter
ErrorPageFilter contained an optimisation for looking up the path
of an error page by exception type. For cases where there was no
mapping for the type of the exception that was thrown but there
was a mapping for one of its super classes, it was intended to
speed up the lookup. Unfortunately, there was a bug in the
implementation which meant that the optimisation had no effect.

Analysis with JMH reveals that for an Exception with a deep type
hierarchy, such as Spring Framework's UnsatisfiedDependencyException,
and an error page mapping for Exception, searching up the hierarchy
until a mapping is found takes 0.0000001s. With the same mapping,
a lookup for Exception takes 0.00000001s, i.e. it's 10x faster.
The optimisation, when correctly implemented, brings the time for
UnsatisfiedDependencyException down to 0.00000001s and into line
with a lookup for Exception. However, the amount of time involved is
so small compared to the overall time spent processing a request that
the added complexity of the optimisation is not justified.

Closes gh-7010
2016-10-19 14:10:34 +01:00
Andy Wilkinson a416f496c0 Clean up deprecation and unused code warnings 2016-10-18 20:43:05 +01:00
Phillip Webb d818a09ed8 Polish 2016-10-11 23:38:14 -07:00
Phillip Webb d3e06c4627 Merge branch '1.4.x' into 1.5.x 2016-10-11 21:46:06 -07:00
Phillip Webb db3f488d5a Polish 2016-10-11 17:54:00 -07:00
Stephane Nicoll 3e1425ebed Polish contribution
Closes gh-6543
2016-10-10 10:43:12 +02:00
Andy Wilkinson d2d911ba94 Merge branch '1.4.x' into 1.5.x 2016-10-07 17:08:20 +01:00
Andy Wilkinson a5b4c8e6db Make cycle clearer in bean currently in creation failure analysis
Note: the fully-qualified references to @Configuration in some of the
test configuration classes are required to work around a bug in javac.
1.8.0_102 (and earlier). Without them, compilation fails as it cannot
resolve the symbol despite the import statement and the unqualified
references working elsewhere in the same source file.

Closes gh-7056
2016-10-07 17:07:44 +01:00
Stephane Nicoll d57f3afdd3 Add XA datasource for Apache Derby
Closes gh-6823
2016-10-07 10:23:13 +02:00
Stephane Nicoll 02b0e3955c Merge branch '1.4.x' into 1.5.x 2016-10-07 09:46:21 +02:00
Johnny Lim 1c4c0c6119 Fix String.format() usages
Closes gh-7120
2016-10-07 09:45:43 +02:00
Stephane Nicoll 0fe0ad4cfb Merge branch '1.4.x' into 1.5.x 2016-10-06 13:35:32 +02:00
Stephane Nicoll 668993c4bf Fix typo
Closes gh-7117
2016-10-06 13:35:21 +02:00
Phillip Webb a2315378d4 Formatting 2016-10-03 22:44:36 -07:00
Phillip Webb f2b0fa284e Merge branch '1.4.x' into 1.5.x 2016-10-03 22:38:22 -07:00
Phillip Webb 3326841a97 Formatting 2016-10-03 22:19:35 -07:00
Stephane Nicoll a9b610c4fc Deprecate ResourceLoaderAware callback
Closes gh-6986
2016-10-03 11:42:46 +02:00
Stephane Nicoll e643fc5bd1 Merge branch '1.4.x' into 1.5.x 2016-10-02 11:08:33 +02:00
Johnny Lim 503d735fdd Polish
Closes gh-7081
2016-10-02 11:07:04 +02:00
Andy Wilkinson 2a035d0748 Remove support for Velocity following its deprecation in 1.4
Closes gh-6971
2016-09-29 15:44:36 +01:00
Andy Wilkinson 26c9d5a7e2 Merge branch '1.4.x' into 1.5.x 2016-09-29 14:28:20 +01:00
Andy Wilkinson bacdc204ae Polish imports 2016-09-29 14:27:42 +01:00
Stephane Nicoll 984b02dc7f Upgrade to Undertow 1.4.3.Final
Closes gh-7019
2016-09-26 12:43:24 +02:00
Andy Wilkinson bdc949d1b7 Remove deprecated merge and locations attributes from @ConfigurationProperties
Closes gh-6972
2016-09-21 20:50:21 +01:00
Stephane Nicoll ce1e41dce3 Remove deprecated code
This code removes code deprecated in 1.4 with the exception of code that
requires an update to Spring Framework 5.

Closes gh-6971
2016-09-21 14:30:28 +02:00
Stephane Nicoll 6bd670edbc Initiate 1.4.x branch 2016-09-21 11:11:24 +02:00
Spring Buildmaster 7e9ed5e1a7 Next Development Version 2016-09-21 07:58:07 +00:00
Phillip Webb 51092af739 Polish 2016-09-20 14:32:09 -07:00
Phillip Webb 0b9667c26f Drop setResolvePlaceholders()
Remove setResolvePlaceholders() from PropertySourcesPropertyValues
and instead rely only on the constructor.

See gh-6964
2016-09-20 14:22:51 -07:00
Phillip Webb 7896ec5a7b Polish 2016-09-20 14:20:52 -07:00
Andy Wilkinson 564207b092 Add Tomcat-specific failure analysis for connector start failures
Previously, when a Tomcat connector failed to start it was assumed that
the failure was due to the port being in use and a PortInUseException
was thrown. Unfortunately, this assumption doesn’t always hold true.
For example, a Tomcat connector will also fail to start when its using
SSL and the key store password is wrong. This could lead to incorrect
guidance from the PortInUseFailureAnalyzer indicating that a port clash
had occurred when, in fact, it was the SSL configuration that needed to
be corrected.

Unfortunately, Tomcat only tells us that the connector failed to start.
It doesn’t provide access to the exception that would allow us to
determine why it failed to start. This commit updates the embedded
Tomcat container to throw a ConnectorStartFailedException in the event
of a connector failing to start. A new failure analyser,
ConnectorStartFailureAnalyzer, has been introduced to analyse the new
exception and offer some more general guidance.

Closes gh-6896
2016-09-20 13:55:10 +01:00
Dave Syer 26a90c1d24 Add flag to PropertiesConfigurationFactory to switch off placeholder resolution
The default behaviour is unchanged, but it is useful for some applications to be
able to bind without placeholder resolution (e.g. to prevent exposing system
environment variables, if the bound object is being sent over the wire).
2016-09-20 10:13:54 +01:00
Phillip Webb b269ab0e4a Make DefaultApplicationArguments public
Fixes gh-6521
2016-09-18 23:41:03 -07:00
Andy Wilkinson 4d2e557fdf Merge branch '1.3.x 2016-09-15 13:35:52 +01:00
Andy Wilkinson b8833c40b6 Allow spring.config.location to be configured via servlet context
Previously, in a war deployment, the web environment’s property sources
were initialized using the servlet context after the application’s
configuration had been read by ConfigFileApplicationListener. This
meant that spring.config.location configured via the servlet context
had no effect.

This commit adds a new ApplicationListener,
ServletContextApplicationListener, that initialises the configurable
web environment’s property sources using the servlet context. It’s
ordered with higher precedence than ConfigFileApplicationListener to
ensure that any properties defined in the servlet context are available
when loading the application’s configuration.

Closes gh-6801
2016-09-15 13:28:23 +01:00
Andy Wilkinson 56cf49665f Add some tests for ServletContextApplicationContextInitializer 2016-09-15 13:14:02 +01:00
Stephane Nicoll 8470ecb4d0 Polish 2016-09-15 09:37:23 +02:00
Phillip Webb 0606428609 Allow default profile to also be set in properties
Update `ConfigFileApplicationListener` so that active profiles set in
properties files that overlap with `spring.profiles.default` can still
be set.

Prior to this commit if `spring.profiles.active` happened to specify
a profile name that was also in `spring.profiles.default` it would
not get applied.

Fixes gh-6833
2016-09-14 17:49:59 -07:00
Andy Wilkinson a68cf77386 Upgrade to Tomcat 8.5.5
As part of the upgrade, Tomcat now requires a keystore to contain
an X.509 certificate. The two stores used in our tests have been
updated by exporting their private keys and adding them as
certificates. For example:

$ keytool -exportcert -keystore test.jks -alias tomcat > exported
$ keytool -importcert -keystore test.jks -file exported

Closes gh-6703
Closes gh-6657
2016-09-14 14:59:53 +01:00
Phillip Webb 07b2fe1d67 Support relaxed binding to 'mixedCASE' names
Update relaxed binding so that names of the form `initSQL` can now
be bound against properties of the form `init-s-q-l`.

Fixes gh-6803
2016-09-09 15:36:38 -07:00
Phillip Webb 56544c8dd5 Polish 2016-09-09 10:27:44 -07:00
Stephane Nicoll b450fece2e Add NoSuchBeanDefinitionException failure analyzer
Add a `FailureAnalyzer` that handles the case where the context does
not start because no candidate bean was found for an `InjectionPoint`.

The implementation inspects the auto-configuration report for beans
that are candidate and output the condition(s) that lead to such beans
to be discarded on startup. If a whole auto-configuration class is
disabled (or excluded), its beans are inspected and candidates are
extracted in a similar way.

This works for both injection by type and by name.

Closes gh-6612
2016-09-07 16:50:25 -07:00
Phillip Webb 41dc53f5dd Polish 2016-09-07 08:34:45 -07:00
Phillip Webb 951f051df9 Polish 2016-09-01 14:39:29 +01:00
Stephane Nicoll 08fbe87290 Fix ClassPathScanningCandidateComponentProvider init
Closes gh-6780
2016-09-01 14:23:17 +02:00
Andy Wilkinson 1c294dd562 Deprecate DefaultProfileDocumentMatcher
Closes gh-6798
2016-08-31 17:00:45 +01:00
Andy Wilkinson 3a887151e6 Remove use of regular expressions in Spring profile-based doc matching
Closes gh-1309
2016-08-31 16:56:13 +01:00
Andy Wilkinson fff280470a Realign default compressable MIME types with Tomcat's defaults
Closes gh-3592
2016-08-31 14:57:06 +01:00
Andy Wilkinson 3814e509a3 Polish @deprecated javadoc and link to replacements where available
Closes gh-6765
2016-08-31 14:34:49 +01:00
Phillip Webb 2a22a7af12 Remove ApplicationInfo
Rework commit 4a69755b to remove the need for the ApplicationInfo class.
The updated code now uses the auto-configuration class to compute a
default persistence unit root location

Closes gh-6635
2016-08-31 14:49:15 +02:00
Phillip Webb 565ad79856 Polish 2016-08-29 20:26:30 +01:00
Andy Wilkinson cc53f8810a Correct deprecated ErrorPage javadoc's reference to its replacement
Closes gh-6764
2016-08-26 20:16:08 +01:00
Stephane Nicoll b9104c9337 Restore support for empty persistence unit with fat jars
Due to the layout format change in 1.4, Spring Framework is no longer
able to compute a default persistence unit root URL. If a Spring Boot 1.4
application has JPA but does not have any entity, the application started
from a fat jar now fails with a quite cryptic exception.

This commit introduces `ApplicationInfo` as a general replacement for
the `ApplicationArguments` and `Banner` singleton beans that
`SpringApplication` registers on startup. `ApplicationInfo` also defines
the detected "main" `Class` that can be used to compute a last resort
URL that makes sense.

If such bean is available, `EntityManagerFactoryBuilder` now sets the
default persistence unit root location, preventing Spring Framework to
attempt to resolve an unknown location. Note that in our case the
persistence unit root location is actually useless: given the way the
persistence unit is created, nothing actually uses it but Hibernate, as a
compliant JPA provider, has to make sure this setting is set to a valid
URL nevertheless.

Closes gh-6635
2016-08-26 13:38:17 +02:00
Andy Wilkinson 43361e0ca5 Prevent child applications from reinitializing the logging system
Closes gh-6688
2016-08-25 19:55:47 +01:00
Stephane Nicoll 25e72fab71 Initialize FailureAnalyzer earlier
This commit changes `FailureAnalyzers` so that the loaded
`FailureAnalyzer` instances are initialized before the context eventually
fails.

Before this commit, the `BeanFactoryAware` callback was processed at a
time where the context has already shutdown. Some implementations need
to access components that are no longer available.

Instead, we now initialize them before the context is refreshed.

Closes gh-6748
2016-08-25 13:33:55 +02:00
Johnny Lim 524edaea51 Polish
Closes gh-6728
2016-08-23 15:13:33 +02:00
Andy Wilkinson e465368f54 Ensure that access log is flushed periodically
Previously, Tomcat’s background processing was only enabled on the
context but access logging was configured on the engine. This means that
the access log valve’s background processing method was never called
and, therefore, that it wasn’t flushed periodically.

This commit moves the enablement of background processing up to the
engine, thereby ensuring that the access log is flushed periodically.
Background processing cascades down the container hierarchy so, after
this change, background processing will still be performed on the
context as well.

Closes gh-6646
2016-08-22 23:01:44 +01:00
Andy Wilkinson a16aa767dc Tweak performance of RelaxedNames.separatedToCamelCase
Closes gh-6661
2016-08-22 22:09:24 +01:00
Andy Wilkinson 6cb18835b9 Reorder javadoc at-clauses to appease the Checkstyle gods 2016-08-22 20:51:00 +01:00
Andy Wilkinson 269bb9148c Add methods to RestTemplateBuilder for configuring interceptors
Closes gh-6701
2016-08-22 20:37:28 +01:00
Andy Wilkinson d4c9a2b271 Merge branch '1.3.x' 2016-08-22 15:07:03 +01:00
Andy Wilkinson ba51dc5c4a Make configuration of Liquibase’s logging more robust
We make Liquibase aware of our custom Commons Logging-based logger by
adding its package to the Liquibase ServiceLocator’s packages to scan.
Previously, this was happening too late so Liquibase may have already
initialized and cached a particular logger.

This commit moves the registration of the extra package from the
Liquibase auto-configuration to the application listener that customises
Liquibase’s ServiceLocator. This ensures that the package is added
before Liquibase is used. Unfortunately, configuring Liquibase’s
ServiceLocator and its packages to scan causes it to try to perform
some logging, resulting in it caching the wrong type of logger. We
work around this problem by resetting Liquibase’s LogFactory once we’ve
finished setting everything up.

Closes gh-6713
2016-08-22 14:58:34 +01:00
Stephane Nicoll c9a3880f27 Remove hard-coded property values
As of Spring Boot 1.4, IDEs are supposed to provide auto-completion for
hints and enum values. This commit removes the hard-coded copy of
allowed values for enum-based properties. This was mostly the case
already and this commit fixes the few ones remaining.

Closes gh-6654
2016-08-22 15:39:41 +02:00
Andy Wilkinson 98d81110f2 Write management and main server access logs to separate files
Previously, when access logging was enabled and the management server
was running on a separate port, both the main server and the management
server would write their access logs to the same file. Having two
separate containers writing to the same file could cause problems such
as causing log rotation to break.

This commit updates the actuator so that when the management server is
running on a separate port (and therefore using a separate container)
it prepends management_ to the access log prefix so that the main
server and the management server write their access logs to separate
files in the same directory.

Closes gh-6618
2016-08-22 11:57:51 +01:00
Andy Wilkinson 81275887e4 Polishing 2016-08-22 11:54:18 +01:00
Stephane Nicoll a6ef3741ef Configure Undertow's access log prefix and suffix
This commit adds two properties that can be used to customize the prefix
and suffix of the Undertow's access log.

Closes gh-6652
2016-08-22 10:12:26 +02:00
Andy Wilkinson dd465b7f79 Fix configuration of session ID generator on Tomcat 7
See gh-6679
2016-08-18 14:23:33 +01:00
Andy Wilkinson e16c9d4e76 Polishing 2016-08-18 11:44:43 +01:00
Andy Wilkinson 70b5c97c7f Set original, possibly wrapped request factory on built RestTemplate
Previously, RestTemplateBuilder unwrapped the request factory to allow
the actual factory to be customised but then set this unwrapped factory
on the template that is being built. This meant that any wrappers were
lost.

This commit updates the build to unwrap the factory prior to it being
customised, but to the set the original, possibly wrapped factory on
the template that is being built.

Closes gh-6685
2016-08-18 11:40:23 +01:00
Andy Wilkinson a2420bacfb Honour @MultipartConfig on servlets registered via @ServletComponentScan
Closes gh-6680
2016-08-18 11:32:06 +01:00
Andy Wilkinson a6f777e941 Ensure that lazy session id generator is initialized by manager
Closes gh-6679
2016-08-18 10:00:38 +01:00
Johnny Lim 37c8c3669b Polish
Closes gh-6671
2016-08-17 10:49:04 +02:00
Andy Wilkinson 6d78066a3a Ensure that AWTError from image banner does not prevent app starting
Closes gh-6617
2016-08-16 15:05:00 +01:00
Andy Wilkinson 05fc967335 Update FilteredClassPathRunner so that JUnit rules work
Previously, the tests class and any JUnit annotations it contained were
loaded by a different class loader to JUnit. This meant that the JUnit
annotations were loaded twice and @Rule-annotated fields were not found.
This commit updates FitleredClassPathRunner to use a custom class loader
that ensures that any org.junit.* classes are only loaded by a single
class loader.
2016-08-16 13:06:57 +01:00
Andy Wilkinson b2420be886 Load FailureAnalyzers defensively
Previously, if a single FailureAnalyzer failed to load, no failure
analysis would be performed. This commit updates FailureAnalyzers to
load the analysers defensively so that all but the problematic analyzer
are used for analysis.

Closes gh-6606
2016-08-10 17:36:00 +01:00
Stephane Nicoll 9cb95f423c Fix typo
Closes gh-6518
2016-07-31 07:33:51 -07:00
Spring Buildmaster 334baaeffd Next development version 2016-07-28 19:54:01 +00:00
Spring Buildmaster a89ef5df6e Next Development Version 2016-07-28 09:18:40 +00:00
Phillip Webb d7e1ccc690 Improve configuration properties logging
Update ConfigurationPropertiesBindingPostProcessor with improved logging
when multiple PropertySourcesPlaceholderConfigurer beans are found.

See gh-6457
2016-07-27 18:12:29 -07:00
Phillip Webb 162b9e84a3 Polish 2016-07-26 22:47:51 -07:00
Brian Clozel a282710fc9 Add Locale to Charset Mapping for Servlet containers
This commit adds a new configuration key:

    spring.http.encoding.mapping.<locale>=<charset>

This allows to specify which default charset should be used for any
given Locale, if none has been provided already in the response itself.
This applies to all supported embedded servlet containers.

Fixes gh-6453
2016-07-26 12:17:11 +02:00
Phillip Webb 496b3a8d75 Relocate FileWriters to `spring-boot`
Move ApplicationPidFileWriter and EmbeddedServerPortFileWriter to the
core spring-boot project since they're not really tied to the actuator.

Fixes gh-6398
2016-07-25 13:45:29 -07:00
Phillip Webb 254b099bfd Polish 2016-07-25 10:23:35 -07:00
Phillip Webb b615070535 Merge branch '1.3.x' 2016-07-25 10:20:57 -07:00
Phillip Webb 8e22f47916 Don't limit collection sizes in property binding
Update PropertiesConfigurationFactory so that collections can grow
beyond 256 items. Prior to this commit configuration property binding
used the default `DataBinder.autoGrowNestedPaths` setting of 256.

Fixes gh-6436
2016-07-25 10:13:24 -07:00
Andy Wilkinson a1797879e6 Add a FailureAnalyzer for BeanNotOfRequiredTypeException
Closes gh-6434
2016-07-21 16:26:24 +01:00
Phillip Webb b6fd1b515d Add `/` consistently in logback base.xml
Update logback `base.xml` so that both `LOG_PATH` and `LOG_TEMP` can
be specified without a trailing slash.

Fixes gh-6423
2016-07-19 12:49:58 -07:00
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
2016-07-18 17:52:35 -07:00
Christoffer Sawicki 150aba2191 Add support for engine valves
Update TomcatEmbeddedServletContainerFactory to allow registration of
engine valves as well as context values. For clarity the ambiguous
`getValues()` method has been deprecated in favor of
`getContextValves()`

See gh-6311
2016-07-18 15:37:34 -07:00
Max Stoliar 219df8dc25 Fixed ServletContextInitializer documentation
Closes gh-6410
2016-07-18 15:13:25 -07:00
Phillip Webb 8bf3f275c9 Merge branch '1.3.x' 2016-07-18 14:35:56 -07:00
Phillip Webb 49676ee986 Polish 2016-07-18 14:31:23 -07:00
Phillip Webb 2cb38bc8e2 Apply Log4J2LoggingSystem.FILTER to main config
Update Log4J2LoggingSystem so that the FILTER is applied to the main
configuration and not to the root logger. Prior to this commit calls
to `logger.isErrorEnabled()` would not consider the filter and hence
would always return `true`. This caused `SpringApplication` to silently
swallow exceptions.

Fixes gh-5271
2016-07-18 14:26:11 -07:00
Phillip Webb 3b0b65cafc Fix deprecation warning 2016-07-18 13:05:19 -07:00
Phillip Webb ef6139be63 Refactor from deprecated getAliasedStringArray
Update ServletComponentScanRegistrar to make use of Spring Framework's
updated alias support with ASM reading.

See gh-6337
2016-07-18 11:26:57 -07:00
Stephane Nicoll 1d5549ff01 Merge complex types from multiple source correctly
Update PropertySourcesPropertyValues so that source detection logic for
collection values also considers complex types. Prior to this commit
properties of the following form were processed correctly:

	PropertySource-A
	  list[0]=x

	PropertySource-B
	  list[0]=y
	  list[1]=z

But properties of the form were not:

	PropertySource-A
	  list[0].name=x

	PropertySource-B
	  list[0].name=y
	  list[1].name=z

Fixes gh-4313
See gh-2611
2016-07-13 15:27:01 -07:00
Phillip Webb e6f6e83c39 Polish 2016-07-13 11:17:59 -07:00
Phillip Webb d9e8676f77 Merge branch '1.3.x' 2016-07-13 10:48:02 -07:00
Phillip Webb fd6c0029dc Formatting 2016-07-13 10:44:37 -07:00
Andy Wilkinson f84f31b47d Add setReadTimeout and setConnectTimeout to RestTemplateBuilder
Closes gh-6346
2016-07-13 16:40:32 +01:00
Dave Syer 9fdef15d50 Merge branch '1.3.x' 2016-07-13 16:06:38 +01:00
Dave Syer af426d0856 Be more defensive about a null password in Undertow SSL
Fixes gh-6387
2016-07-13 15:36:55 +01:00
Andy Wilkinson 18d99245dd Merge branch '1.3.x 2016-07-12 09:17:03 +01:00
Andy Wilkinson c2db9fa385 Update admin MBean to only be ready when its own context is ready
Previously, if there was a hierarchy of SpringApplications, the admin
MBean would report that the application was ready as soon as any
application in the hierarchy was ready. This could lead to a client
trying to query a property in the environment before it's available.

This commit updates the MBean registrar to that the MBean only reports
that the application is ready when the context that contains the
registrar has refreshed and fired its ApplicationReadyEvent.

Closes gh-6362
2016-07-12 09:13:36 +01:00
Phillip Webb 629ce6a527 Clarify @EntityScan deprecated Javadoc
Closes gh-6340
2016-07-07 14:16:30 -07:00
Stephane Nicoll 0356be7b95 Refine AliasFor usage
This commit makes sure to use `getAliasedStringArray` rather than
`getStringArray` as the latter does not work with ASM. While this will
probably be fixed in the core framework, this commit also adds dedicated
tests with ASM to ensure that the code works as expected.

Closes gh-6337
2016-07-07 11:47:24 +02:00
Phillip Webb f10286caf1 Fix spring.profiles.default with profile enabled by configuration file
Previously, if the user configured a custom default profile and then
enabled another profile using a configuration file, the custom default
profile would be activated when it should not have been.

This commit updates ConfigFileApplicationListener so that when a
profile is activated via a configuration file, any profiles
that are queued purely because they are a default profile are removed
from the queue. This ensures that a default profile is not active
when another profile is activated via a configuration file.

Closes gh-5998
2016-07-05 09:41:11 +01:00
Spring Buildmaster 2216369348 Next Development Version 2016-07-04 14:15:02 +00:00
Matt Benson 687199e688 Add an accessor for webEnvironment to SpringApplication
Closes gh-6241
2016-07-01 10:59:17 +01:00
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
2016-07-01 10:44:23 +01:00
Andy Wilkinson 76c4a38e65 Merge branch '1.3.x' 2016-06-30 16:05:16 +01:00
Andy Wilkinson 02e989c863 Check that URL is actually a file URL before getting a File from it
Previously, Log4J2LoggingSystem used ResourceUtils.isFileURL(URL) to
check that the URL of the configuration was suitable for accessing as a
File. Unfortunately, this fails when the URL’s protocol is vfs or
vfsfile as both return true and then fail when the URL is subsequently
passed into ResourceUtils.getFile(URL).

This commit switches to checking that the URL’s protocol is file,
the only protocol that will allow getFile(URL) to succeed.

Closes gh-6246
2016-06-30 15:55:22 +01:00
Andy Wilkinson 2b970f9efc Allow Tomcat context root redirect to be configured via the environment
This commit adds a new property, server.tomcat.redirect-context-root,
that can be used to configure the Tomcat Context’s 
mapperContextRootRedirectEnabled property. The default is to not apply
any configuration and, therefore, to use Tomcat’s default of true.

Closes gh-6248
2016-06-30 12:47:42 +01:00
Phillip Webb 4d50b4d321 Defer javax.servlet.Filter initialization
Update `DelegatingFilterProxyRegistrationBean` so that calls to the
`init()` method no longer trigger early bean initialization.

See gh-6178
2016-06-29 20:13:58 -07:00
Phillip Webb be884d4e33 Polish 2016-06-29 10:57:43 -07:00
Phillip Webb 266445aaf0 Polish 2016-06-29 10:44:33 -07:00
Stephane Nicoll 669da59b4a Polish 2016-06-29 16:28:41 +02:00
Stephane Nicoll f54bec835d Move BasicAuthorizationInterceptor
`BasicAuthorizationInterceptor` is now available in the core framework
and this commit uses that instead of the outdated copy in Boot.

Closes gh-6237
2016-06-29 08:07:30 +02:00
Stephane Nicoll 3151df624a Fix build failure 2016-06-27 12:12:07 +02:00
Stephane Nicoll 6631136f91 Merge branch '1.3.x' 2016-06-27 12:08:04 +02:00
Stephane Nicoll 17f8a244de Fix property names with successive capital letters
Previously, if a property name had successive capital letters, the
generated meta-data would clean it in such a way it is defined as a
regular word. For instance a `myFOO` property would be written as
`my-foo` in the meta-data.

It turns out this decision is wrong as the binder has no way to compute
back the name of the property and therefore `my-foo` wouldn't bind to
`setMyFOO` as it should.

This commit updates the meta-data name generation algorithm to properly
identify such cases: `myFOO` now translates to `my-f-o-o`. While the
generated name is a bit ugly, it now provides a consistent binding
experience.

Closes gh-5330
2016-06-27 12:02:34 +02:00
Phillip Webb e8d4d0e2b1 Drop Neo4J SessionFactoryProvider
Remove SessionFactoryProvider since it's no longer needed for
auto-configuration.

See gh-6142
2016-06-24 12:49:13 -07:00