- Apply code formatting
- Move configuration of excepted exception to immediately before line
that will throw the exception
- Use String.format with %n to produce platform-specific new lines
See gh-7407
Previously, both HypermediaAutoConfiguration and HttpMessageConverters
assumed that if Spring HATEOAS was on the class path, then Jackson
would be too. When this was not the case, an application would fail
to start.
This commit updates both classes to back off appropriately when
Spring HATEOAS is on the classpath but Jackson is not.
Closes gh-7434
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
This commit adds an extra property to the `server.tomcat.accesslog` to
control the `reqestAttributesEnabled` flag. This flag sets request
attributes for IP address, Hostname, protocol and port used for the
request.
Closes gh-7367
Add `content-security-policy` and `content-security-policy-mode`
`security.header` properties and update auto-configuration to apply
them when specified.
Fixes gh-7373
Closes gh-7357
Update JpaBaseConfiguration so that the persistenceUnitRootLocation is
no longer detected. The update to gh-7003 means that we can now rely on
the standard detection mechanism.
Fixes gh-6983
See gh-6635
Previously, if an auto-configuration class was (wrongly) located in a
candidate package for component scanning, the class was silently loaded
as an app configuration (i.e. with the wrong lifecycle).
This commit adds an `AutoConfigurationExcludeFilter` to
`@SpringBootApplication` so that such classes are automatically
filtered. Since they are registered in `spring.factories`, we can
silently ignore them since we know they'll be loaded later on.
Closes gh-7168
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
This commit improves database initializers for Spring Batch and Spring
Session by introducing `AbstractDatabaseInitializer` which eliminates
duplicated logic in existing initializers. Additionally, database
platform resolution now relies on `DatabaseDriver`.
See gh-6543
Previously, an URI and individual client attributes can be set to
configure the mongo client. In such a scenario, the URI is ignored.
This commit changes the URI to be "null" and the creation of the client
to fail if both the uri and client attributes are set. If no client
attributes are set, the uri is used as before.
Closes gh-6739
In addition, dependency management for `hazelcast-hibernate5` module has
been added, and a separate dependency version was introduced for
`hazelcast-hibernate4` module.
Closes gh-7023
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
This commit improves the startup error message so that it does not
reference `--debug` anymore. Such command-line switch only works when
the application is started using `java -jar`.
The error message now refers directly to a section of the documentation
that provides more details and links to more useful examples.
Closes gh-6593
This commit fixes the documentation that wrongly states that
SpringBootWebSecurityConfiguration is an auto-configuration. Rather than
excluding this class, we should exclude SecurityAutoConfiguration that
imports it.
Closes gh-6861
Change the auto-configure MongoMappingContext to use the
SimpleTypesHolder instance `Set` that's produced by a CustomConversions
bean, which we in turn now default, too.
This update is necessary as `CustomConversions` registers converters by
inspecting the classpath (to automatically detect Java 8, JodaTime etc.)
and by that rendering the types for which we find converters for as
simple ones, i.e. non-entities.
Fixes gh-6881
Closes gh-6882
This commit adds Spring Batch configuration validation that disables
database initializer in case custom table prefix is configured with
default schema.
See gh-6651
This commit adds Spring Session JDBC configuration validation that
disables database initializer in case custom table name is configured
with default schema.
See gh-6649
This commit adds a new `spring.thymeleaf.check-template` property which
is only used for Thymeleaf 3.0+.
Since thymeleaf/thymeleaf#419, the Thymeleaf template resolver
implementations can implement the `setCheckExistence` method - this
enables the template existence verification at **resolution** time,
which means the resolver can return null as a `TemplateResolution`
and let other template resolvers in the chain try.
This new property is set to `true` by default and can be disabled if the
application only has a single resolver and the template existence check
is considered as a performance penalty with the configured resolver.
Fixes gh-6500
This commit adds the `spring.http.multipart.resolve-lazily`
property, in order to configure whether the multipart request
should be resolved lazily, as the parameters are accessed.
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
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
Previously, BeanTypeRegistry did not correctly determine the type
that would be created by a factory bean if that factory bean was
returned from a bean method with arguments on a configuration class
found via component scanning.
The key difference is that bean definitions for bean methods on
configuration classes found via component scanning use ASM-based
metadata rather than reflection-based metadata. The ASM-based method
data does not provide direct access to the Method that will create the
bean. In this case, BeanTypeRegistry was falling back to looking for
a method with the matching name and no arguments. Therefore, if
the bean method had any arguments it would fail to find the method
and would, therefore, be unable to determine the type of bean
produced by the factory bean.
This commit updates BeanTypeRegistry to use logic that is very similar
to Spring Framework's ConstructorResolver's
resolveFactoryMethodIfPossible method to locate the method that will
produce the factory bean. It looks for a single method with
the required name with any number of arguments. If it finds multiple
methods with the required name and different arguments it returns
null, just as ConstructorResolver does.
Closes gh-6755
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
Hikari can configure both an underlying Driver or DataSource. Spring Boot
only supports the former so any attempt to trigger the creation of the
latter will lead to an exception since the auto-configuration has set
driver-specific field.
This commit adds an analyzer that intercepts such faulty scenario and
indicate that users should configure Hikari with an underlying DataSource
themselves.
Closes gh-6568