Commit Graph
1519 Commits
Author SHA1 Message Date
Stephane Nicoll 97874a0749 Fix build failure 2016-06-20 14:40:57 +02:00
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
2016-06-20 13:27:47 +01:00
Stephane Nicoll 06b81cf16f Use @AliasFor when applicable
This commit adds `@AliasFor` meta-data to annotations that declare an
alias attribute.

`@ConditionalOnProperty` and `@AutoconfigureRestDocs` were not migrated
due to the use of `AnnotationMetadata#getAnnotationAttributes`.

Closes gh-5187
2016-06-20 14:20:16 +02:00
Johnny Lim 25f37da466 Reuse objects in JsonParser implementations
Closes gh-6188
2016-06-20 10:19:50 +02:00
Andy Wilkinson f5f116d68f Make configuration of lazy session ID generator compatible with Tomcat 7
See gh-6174
2016-06-17 15:53:30 +01:00
Andy Wilkinson f0ce0e3e72 Defer Tomcat’s session ID generator initialization until it’s needed
By default, Tomcat forces the generation of a session id during startup
to ensure that a SecureRandom instance has been initialized. When there
is a lack of entropy (as is often the case on a newly booted VPS, for
example) this can block for a long time (several minutes in some cases)
causing users to incorrectly believe that their application has hung
during startup. This is particularly problematic for applications that
don't use HTTP sessions as they are paying the startup cost for no
benefit.

This commit address the problem by configuring a custom
SessionIdGenerator that does not initialize itself during startup.
Instead, the initialization is now deferred until a request for a
session id is made.

Closes gh-6174
2016-06-17 15:13:57 +01:00
Stephane Nicoll 2ff9e3cfdc Upgrade to Hibernate 5.2
See gh-6111
2016-06-17 11:14:35 +02:00
Stephane Nicoll 6dff1548fa Merge branch '1.3.x' 2016-06-16 15:45:49 +02:00
Stephane Nicoll 6574feea87 Document limitations of logging.pattern.*
Closes gh-5653
2016-06-16 15:44:22 +02:00
Andy Wilkinson 76cd45e76e Fix checkstyle violation: remove unused import 2016-06-15 17:21:08 +01:00
Andy Wilkinson 0203448345 Merge branch '1.3.x' 2016-06-15 16:56:40 +01:00
Andy Wilkinson 5c43a5b7dd Honour custom bean name generator for non-web applications
Closes gh-6160
2016-06-15 16:55:53 +01:00
Andy Wilkinson 7e854d090f Broader attempt at fixing URLStreamHandlerFactory pollution problem
This is a follow-on from d341499 that takes a broader approach to
clearing URLs URLStreamHandlerFactory.

See gh-5290
2016-06-15 16:46:17 +01:00
Andy Wilkinson d341499c6b Prevent Jetty tests from polluting URL’s URLStreamHandlerFactory
The JVM only allows URL.setURLStreamHandlerFactory to be called once.
This is problematic as the JSP support in embedded Tomcat and embedded
Jetty both call this method.

This commit uses reflection to null out URL’s factory field before and
after the embedded Jetty tests have run. This ensures that they can
run successfully if Tomcat has already installed its factory and that
Tomcat-related tests can also run afterwards.

See gh-5290
2016-06-15 16:17:30 +01:00
Andy Wilkinson 6ee6f09503 Fix warnings produced during Javadoc generation 2016-06-15 15:21:14 +01:00
Vladimir Tsanev b303b3fe35 Support JSPs in Embedded Jetty
JSPs are now supported in executable WARs with embedded Jetty.

Fixes gh-367
Closes gh-5290
2016-06-15 16:01:54 +02:00
Andy Wilkinson ff602e60a0 Change default version of Jetty to 9.3
Closes gh-5825
2016-06-15 13:58:47 +01:00
Johnny Lim a70a8635f9 Polish
Closes gh-6155
2016-06-14 08:35:22 +02:00
Phillip Webb 10f8a2f6bd Merge branch '1.3.x' 2016-06-10 20:58:50 -07:00
Phillip Webb 452281ca8d Fix property detection in SpringApplicationBuilder
Update SpringApplicationBuilder so that properties of the form
`abc=d:e:f` are correctly parsed. Prior to this commit the `:` delimiter
would always be chosen over `=`, even if `=` occurred first.

Fixes gh-6121
2016-06-10 20:54:50 -07:00
Phillip Webb 9f30633921 Use AssertJ in merged 1.3.x tests 2016-06-10 17:37:49 -07:00
Phillip Webb e27bc9ddea Merge branch '1.3.x' 2016-06-10 17:24:02 -07:00
Phillip Webb a9b98cada5 Allow loading from package names without dots
Update BeanDefinitionLoader to support loading from package names that
do not contain dots.

Prior to this commit `new BeanDefinitionLoader(registry, "somepackage")`
would fail because "somepackage" exists and is a resource but does not
contain valid XML. Somewhat surprisingly the InputStream returned by
the resource actually contains the listing of files in the package.

Fixes gh-6126
2016-06-10 12:28:23 -07:00
Ivan Sopov 1528764194 Fix potential offset errors in BasicJsonParser
Update BasicJsonParser to fix potential exceptions if strings happen
to be empty.

Fixes gh-6136
2016-06-10 11:48:06 -07:00
Stephane Nicoll 5250fb127a Fix broken condition
See gh-6041
2016-06-10 17:39:23 +02:00
Stephane Nicoll 6cf878424f Fix SSL cipher configuration with Jetty 9.3
Previously, if a list of ciphers were configured, the default excludes
were still applied. Prior to Jetty 9.3, there were no default exclude but
Jetty 9.3 introduced some and they override the includes.

This commit makes sure that the exclude ciphers are cleared if at least
one cipher is explicitly configured.

Closes gh-6041
2016-06-10 16:28:42 +02:00
Phillip Webb f19e261bcf Move AnsiOutputApplicationListenerTests
Move AnsiOutputApplicationListenerTests to the correct package.
2016-06-09 21:02:28 -07:00
Phillip Webb 99c6194e17 Don't use MockitoJUnitRunner
Replace `@RunWith(MockitoJUnitRunner.class)` with direct Mockito
initialization since the running doesn't support parallel test
execution.
2016-06-09 20:55:59 -07:00
Phillip Webb c66da65e23 Refine ApplicationHome detection logic
Update the detection logic used in ApplicationHome to:
- Deal with `!/` elements in URLs so that `BOOT-INF/classes` packaging
  works as expected.
- Use the `start-class` when no explicit source class is provided to
  prevent accidentally picking a home next to a `spring-boot.jar` that
  happens to be on the classpath.
- Ignore search logic when running from a unit test.

Fixes gh-6129
2016-06-09 20:45:37 -07:00
Phillip Webb d87287fe72 Polish 2016-06-08 09:54:36 -07:00
Phillip Webb 5ab072be9c Polish 2016-06-08 09:27:40 -07:00
Phillip Webb 454d8581d0 Use defined Locale for BindFailureAnalyzerTests
Update BindFailureAnalyzerTests so that localized messages are not used.

Fixes gh-6106
2016-06-06 18:07:14 -07:00
Johnny Lim 5de9516255 Fix typos
Closes gh-6114
2016-06-03 07:20:39 -04:00
Phillip Webb b641e63466 Add RestTemplateBuilder support
Add a RestTemplateBuilder that allows RestTemplates to be easily created
and configured.

See gh-5507
2016-05-31 09:50:46 -07:00
Stephane Nicoll 1b0bbd89a2 Reuse ApplicationEventMulticaster
Spring Framework allows a custom `ApplicationEventMulticaster` bean to be
defined with a well-defined bean. If such bean is present, it is used
instead of the default implementation.

This commit fixes `EventPublishingRunListener` to properly honour such
arrangement. Rather than registering a `ApplicationEventMulticaster` to
transmit the application listeners from the `SpringBootApplication` it
now only uses an internal multicaster for early events (i.e. events that
are fired before the context is actually refreshed).

This has the positive effect of making sure that `ApplicationReadyEvent`
is fired to the proper multicaster.

Closes gh-6048
2016-05-27 17:38:50 +02:00
Andy Wilkinson 29ac6fc154 Tolerate API changes between Tomcat 7 and Tomcat 8
See gh-6053
2016-05-27 12:24:22 +01:00
Andy Wilkinson a5ad2b33ab Enable JNDI lookups during app context refresh without changing TCCL
When Tomcat is starting up and JNDI is enabled, it binds the web app
class loader into its ContextBindings, thereby enabling JNDI lookups
on any thread that uses the web app class loader as its thread context
class loader. When Boot starts an application, the application context
is refreshed on the main thread which has the app class loader as its
TCCL. This meant that any JNDI lookups performed during refresh would
fail.

gh-2038 described this problem and a fix was made in ff99bb0. The
fix was to set the main thread's TCCL to be Tomcat's web app class
loader. This fixed the JNDI lookup problem, but it has become apparent
that it has caused other problems when testing an application.

The fix for gh-2038 sets the main thread's TCCL when embedded Tomcat
starts (during application context refresh) and then restores it when
embedded Tomcat stops (as a result of the application context being
closed). This causes problems during testing as, when application
context's are cached, the close is delayed. This means that the main
thread's TCCL isn't restored, causing subsequent tests to run with the
wrong TCCL.

This commit takes a different approach to fixing gh-2038. Rather than
changing the main thread's TCCL, it binds the app class loader into
Tomcat's ContextBindings, thereby enabling JNDI lookups from the main
thread. To avoid leaving a reference to the app class loader in
Tomcat's ContextBindings, it unbinds the app class loader at the end
of application context refresh. This narrows the scope of the fix so
that it only applies during application context refresh which is the
period in which JNDI lookups were problematic.

Note that the original fix could have been modified to restore the
TCCL once context refresh has completed rather than waiting for the
context to be closed. However, my feeling is that leaving the TCCL
unchanged and specifically addressing the JNDI problem by manipulating
the context bindings is a more precise, and hopefully safer,
solution.

Closes gh-6053
2016-05-27 11:26:32 +01:00
Stephane Nicoll deb6c9a4f6 Polish 2016-05-26 14:58:41 +02:00
Johnny Lim 70adefc87b Polish
Closes gh-6046
2016-05-26 14:58:41 +02:00
Dave Syer ba824b240b Add uuid generator to RandomValuePropertySource
A well-formed string represenation of a UUID can now be generated
by ${random.uuid}.
2016-05-22 10:36:54 +01:00
Phillip Webb 00fbb5c3d9 Polish 2016-05-16 12:00:03 -07:00
Casey Scarborough 84d3b6a41a Remove unchecked casts
Closes gh-5975
2016-05-16 13:53:18 +02:00
Phillip Webb 66b69f4346 Deprecate setProperties on ConfigurationFactory
Deprecate `PropertiesConfigurationFactory.setProperties()` since it was
only being used in tests.

Fixes gh-5930
2016-05-13 20:09:03 -07:00
Andy Wilkinson 9e4eb037f6 Improve diagnostics for start failures in TomcatStarter
Closes gh-5934
2016-05-13 16:27:23 +01:00
Johnny Lim 7a62b7d066 Polish
Closes gh-5936
2016-05-13 08:55:28 +02:00
Andy Wilkinson 508905884a Fix String.format call in PropertiesConfigurationFactory
Closes gh-5921
2016-05-12 16:57:48 +01:00
Andy Wilkinson 5c0d400c23 Align Hibernate 5 join table names with those from SpringNamingStrategy
Previously, the name of a join table when using Hibernate 5 would
differ from those when using Hibernate 4 with the default
SpringNamingStrategy.

This commit introduces SpringImplicitNamingStrategy which customises the
name of join tables to match those produced by SpringNamingStrategy.

Closes gh-5880
2016-05-11 10:52:43 +01:00
Phillip Webb cf6212b955 Polish 2016-05-10 10:22:37 -07:00
Andy Wilkinson 1a45e30f37 Add a test to verify that the console log pattern can be overridden
See gh-5867
2016-05-10 15:30:05 +01:00
boriswaguia 7f7a109acb Make it easier to override CONSOLE_LOG_PATTERN when including base.xml
Previously, the CONSOLE_LOG_PATTERN property would always be set as
a result of base.xml including defaults.xml. This made it hard to
override the CONSOLE_LOG_PATTERN as it required a copy and paste of
the configuration.

This commit updates defaults.xml so that CONSOLE_LOG_PATTERN is only
set if it has not already been set. This reduces the configuration to
customize the console log pattern to a handful of lines.

Closes gh-5632
Closes gh-5867
2016-05-10 15:26:26 +01:00