Commit Graph

8892 Commits (cdeed8e9340f3a9ee15e1486e94eb85b2df14330)
 

Author SHA1 Message Date
Stephane Nicoll 6f70d53285 Add documentation for `FailureAnalyzer`
Closes gh-6775
8 years ago
Andy Wilkinson 0e00a49dcc Prevent beans created with @MockBean from being post-processed
Post-processing of mocked beans causes a number of problems:

 - The mock may be proxied for asynchronous processing which can cause
   problems when configuring expectations on a mock (gh-6573)
 - The mock may be proxied so that its return values can be cached or
   so that its methods can be transactional. This causes problems with
   verification of the expected calls to a mock (gh-6573, gh-5837)
 - If the mock is created from a class that uses field injection, the
   container will attempt to inject values into its fields. This causes
   problems if the mock is being created to avoid the use of one of
   those dependencies (gh-6663)
 - Proxying a mocked bean can lead to a JDK proxy being created
   (if proxyTargetClass=false) as the mock implements a Mockito
   interface. This can then cause injection failures as the types don’t
   match (gh-6405, gh-6665)

All of these problems can be avoided if a mocked bean is not
post-processed. Avoiding post-processing prevents proxies from being
created and autowiring from being performed. This commit avoids
post-processing by registering mocked beans as singletons as well as
via a bean definition. The latter is still used by the context for type
matching purposes.

Closes gh-6573, gh-6663, gh-6664
8 years ago
Stephane Nicoll 52d7282f5e Auto-configure JdbcTemplate with DataJpaTest
This commit adds `JdbcTemplateAutoConfiguration` to the list of auto-
configurations that are applied with `DataJpaTest`. This effectively
allows to inject a `JdbcTemplate` in any `@DataJpaTest` test.

Closes gh-6802
8 years ago
Phillip Webb 65b4f61a35 Polish 8 years ago
Phillip Webb 951f051df9 Polish 8 years ago
Stephane Nicoll 08fbe87290 Fix ClassPathScanningCandidateComponentProvider init
Closes gh-6780
8 years ago
Andy Wilkinson 2e1988f97e Rework welcome page so that it only handles reqs that accept text/html
Closes gh-6668
8 years ago
Andy Wilkinson 1c294dd562 Deprecate DefaultProfileDocumentMatcher
Closes gh-6798
8 years ago
Andy Wilkinson 3a887151e6 Remove use of regular expressions in Spring profile-based doc matching
Closes gh-1309
8 years ago
Andy Wilkinson fff280470a Realign default compressable MIME types with Tomcat's defaults
Closes gh-3592
8 years ago
Andy Wilkinson 42f90d4554 Merge pull request #6399 from Eddú Meléndez
* gh-6399:
  Polish "Provide dependency management for Querydsl"
  Provide dependency management for Querydsl
8 years ago
Andy Wilkinson 27a32fbb96 Polish "Provide dependency management for Querydsl"
Closes gh-6399
8 years ago
Eddú Meléndez aa46af5591 Provide dependency management for Querydsl
Closes gh-6777
See gh-6399
8 years ago
Andy Wilkinson 3814e509a3 Polish @deprecated javadoc and link to replacements where available
Closes gh-6765
8 years ago
Andy Wilkinson d720645275 Polishing
Fix mistake introduced during forward merge
8 years ago
Andy Wilkinson 7841af50ef Merge branch '1.3.x' 8 years ago
Andy Wilkinson 20df899b7a Merge pull request #6759 from hengyunab
* gh-6759:
  Polish “Avoid null handler package in JarFile protocol handler registration”
  Avoid null handler package in JarFile protocol handler registration
8 years ago
Andy Wilkinson eb1c349f97 Polish “Avoid null handler package in JarFile protocol handler registration”
See gh-6759
8 years ago
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
8 years ago
hengyunabc 33a81e87d1 Avoid null handler package in JarFile protocol handler registration
Closes gh-6759
8 years ago
Andy Wilkinson b488a3d9a3 Merge branch '1.3.x' 8 years ago
Andy Wilkinson 63b8e82c10 Update OnBeanCondition to consider hierarchy for PARENTS search strategy
Closes gh-6762
8 years ago
Andy Wilkinson 9874c22e23 Fix HAL browser endpoint redirect and entry point with custom servlet path
Previously, the HAL browser endpoint did not consider the dispatcher
servlet’s path (server.servlet-path) when redirecting to browser.html
or when updating the API entry point in the served HTML.

This commit moves to using ServletUriComponentsBuilder to build the URI
for the redirect and the path for the entry point. In the interests of
simplicity the logic that sometimes redirected and sometimes forwarded
the request has been changed so that it will always perform a redirect.

Closes gh-6586
8 years ago
Stephane Nicoll ff48a88b91 Enable fork more when devtools is present
This commit improves the run goal to automatically fork the process when
devtools is present and log a warning when fork has been disabled via
configuration since devtools will not work on a non-forked process.

We don't want devtools to kick in for integration tests so the logic has
been placed in `RunMojo` requiring a couple of protected methods to
override.

Closes gh-5137
8 years ago
Stephane Nicoll 7765d31edd Merge branch '1.3.x' 8 years ago
Stephane Nicoll c8632f12f6 Clarify scope of Guava's CacheLoader
Closes gh-6778
8 years ago
Stephane Nicoll f93775ec12 Clarify scope of Caffeine's CacheLoader
Closes gh-6770
8 years ago
Stephane Nicoll cf07d19ed4 Polish
See gh-6792
8 years ago
Stephane Nicoll b0face34f4 Upgrade to Spring AMQP 1.6.2.RELEASE
Closes gh-6788
8 years ago
Phillip Webb a985a5c861 Update @MockBean to support generics
Update @MockBean and @SpyBean to support field generics. Prior to this
commit the following fields would fail with a "Duplicate mock
definition" exception:

  @MockBean
  private IdentityProvider<PasswordIdentity> passwordIdentityProvider;

  @MockBean
  private IdentityProvider<Oauth2Identity> oauth2IdentityProvider;

Fixes gh-6602
8 years ago
Phillip Webb 565ad79856 Polish 8 years ago
Phillip Webb 850141c405 Merge branch '1.3.x' 8 years ago
Phillip Webb 69e96c6211 Polish 8 years ago
Stephane Nicoll c4cb831770 Polish 8 years ago
Stephane Nicoll afadac27bd Merge branch '1.3.x' 8 years ago
Stephane Nicoll 97f15d606d Auto-detect fork value in stop goal
So far, one has to set the "fork" value to both the start and stop
goals. Since they have the same name, sharing them in a global
configuration element does the trick. However, the plugin also supports
auto-detection of the fork value according to other parameters:
typically if an agent or jvm arguments are set, forking will be
automatically enabled. This is a problem since the stop goal is not aware
of that.

This commit transmits the value in a property attached to the
`MavenProject`. That way, the stop goal can retrieve that value and
apply the same defaults. This has the side effect that specifying the
fork value isn't necessary anymore.

Closes gh-6747
8 years ago
Andy Wilkinson cc53f8810a Correct deprecated ErrorPage javadoc's reference to its replacement
Closes gh-6764
8 years ago
Andy Wilkinson 55f6fb94ef Merge branch '1.3.x' 8 years ago
Andy Wilkinson a5c6b0954d Consider ancestors when finding primary beans for ConditionalOnSingleCandidate
Closes gh-6559
8 years ago
Andy Wilkinson 6df279d3a1 Merge branch '1.3.x' 8 years ago
Andy Wilkinson 75c1e50c5a Improve type determination for factory beans during condition evaluation
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
8 years ago
Stephane Nicoll 62bc955ba7 Merge pull request #6746 from xenoterracide:neo4j-bolt
* pr/6746:
  Polish contribution
  Detect Neo4j bolt driver
8 years ago
Stephane Nicoll 47c568a24d Polish contribution
Closes gh-6746
8 years ago
Caleb Cushing bb7b789cd9 Detect Neo4j bolt driver
Closes gh-6690
8 years ago
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
8 years ago
Stephane Nicoll 86757efcdf Add FailureAnalyzer for Hikari
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
8 years ago
Andy Wilkinson 10402a651f Close context to ensure that logging system is cleaned up
See gh-6688
8 years ago
Andy Wilkinson 43361e0ca5 Prevent child applications from reinitializing the logging system
Closes gh-6688
8 years ago
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
8 years ago
Andy Wilkinson 07a50bb16c Update the samples to make use of auto-configured TestRestTemplate
Closes gh-6730
8 years ago