Commit Graph

9052 Commits

Author SHA1 Message Date
Sam Brannen
9ea646e508 Include all source artifacts in published sources jars
This commit updates the Gradle build to ensure that the following are
including in published 'sources' jars.

 - Java source code (previously supported)
 - AspectJ source code (previously supported)
 - META-INF/spring.factories
 - META-INF/services/*
 - Java Properties files
 - XML files
 - MIME types files (mime.types)

Issue: SPR-12085
2014-08-15 14:39:22 +02:00
Sam Brannen
a91ab34866 Polish Javadoc and formatting in @TestExecutionListeners 2014-08-15 13:38:13 +02:00
Sam Brannen
8b86519b94 Polishing 2014-08-15 02:50:03 +02:00
Sam Brannen
66250b1f8e Support merging custom TELs with default TELs
Prior to this commit, if a custom TestExecutionListener was registered
via @TestExecutionListeners the defaults would not be registered. Thus,
if a user wanted to declare a custom listener and use the default
listeners, the user was forced to manually declare all default
listeners in addition to any custom listeners. This unfortunately
required that the user know exactly which listeners were registered by
default. Moreover, the set of default listeners can change from release
to release, and with the support for automatic discovery of default
listeners introduced in SPR-11466 it is no longer even possible to know
what the set of default TestExecutionListeners is before runtime.

This commit addresses this issue by introducing a mechanism for merging
custom declared listeners with the defaults for the current
environment. Specifically, @TestExecutionListeners supports a new
MergeMode that is used to control whether or not explicitly declared
listeners are merged with the default listeners when
@TestExecutionListeners is declared on a class that does not inherit
listeners from a superclass.

Issue: SPR-8854
2014-08-15 02:21:42 +02:00
Juergen Hoeller
b3add794d7 Polishing 2014-08-15 00:55:40 +02:00
Juergen Hoeller
d2e269e697 Fixed fragile tests for @Bean method overloading 2014-08-15 00:55:14 +02:00
Juergen Hoeller
69587f3fa4 Polishing 2014-08-14 23:49:29 +02:00
Juergen Hoeller
eb0ab8431b Lookup methods can support arguments, find a target bean based on the return type, and be identified by an @Lookup annotation
Issue: SPR-7431
Issue: SPR-5192
2014-08-14 23:49:05 +02:00
Sam Brannen
e753f23110 Merge from sbrannen/SPR-11466
* SPR-11466:
  Support automatic discovery of default TELs
2014-08-14 22:30:16 +02:00
Sam Brannen
e6d16148e5 Support automatic discovery of default TELs
Prior to this commit, there was no declarative mechanism for a custom
TestExecutionListener to be registered as a default
TestExecutionListener.

This commit introduces support for discovering default
TestExecutionListener implementations via the SpringFactoriesLoader
mechanism. Specifically, the spring-test module declares all core
default TestExecutionListeners under the
org.springframework.test.context.TestExecutionListener key in its
META-INF/spring.factories properties file, and third-party frameworks
and developers can contribute to the list of default
TestExecutionListeners in the same manner.

 - AbstractTestContextBootstrapper uses the SpringFactoriesLoader to
   look up the class names of all registered default
   TestExecutionListeners and sorts the instantiated listeners using
   AnnotationAwareOrderComparator.

 - DefaultTestContextBootstrapper and WebTestContextBootstrapper now
   rely on the SpringFactoriesLoader mechanism for finding default
   TestExecutionListeners instead of hard coding fully qualified class
   names.

 - To ensure that default TestExecutionListeners are registered in the
   correct order, each can implement Ordered or declare @Order.

 - AbstractTestExecutionListener and all default TestExecutionListeners
   provided by Spring now implement Ordered with appropriate values.

 - Introduced "copy constructors" in MergedContextConfiguration and
   WebMergedContextConfiguration

 - SpringFactoriesLoader now uses AnnotationAwareOrderComparator
   instead of OrderComparator.

Issue: SPR-11466
2014-08-14 22:29:21 +02:00
Phillip Webb
e142fd11e0 Add tests for ImportSelector meta-data
Issue: SPR-12059
2014-08-14 07:35:16 -07:00
Sebastien Deleuze
ebc726a915 Allow null ObjectMapper in Jackson2ObjectMapperFactoryBean.getObjectType()
Issue: SPR-11785
2014-08-14 13:40:47 +02:00
Sam Brannen
181299cc6c Improve ex msg when locations & classes are declared in test hierarchy
Prior to this commit, if both locations and classes were declared via
@ContextConfiguration at differing levels in a test class hierarchy,
the exception message stated that neither of the default context
loaders was able to load an ApplicationContext from the merged context
configuration, but the message didn't explain why.

This commit adds an explicit check for such scenarios and provides a
more informative exception message similar to the following:

"Neither X nor Y supports loading an ApplicationContext from
[MergedContextConfiguration ...]: declare either 'locations' or
'classes' but not both."

Issue: SPR-12060
2014-08-14 01:23:11 +02:00
Sam Brannen
f4c23d8715 Delete trailing white space in spring-test 2014-08-14 00:30:50 +02:00
Sam Brannen
2cbd5ba993 Clean up regarding deprecated HttpStatus.MOVED_TEMPORARILY 2014-08-14 00:29:09 +02:00
Sam Brannen
3e2138855a Add @Deprecated to WebMergedContextConfiguration constructor 2014-08-14 00:22:12 +02:00
Sam Brannen
f2ac02566c Merge from sbrannen/SPR-12051
* SPR-12051:
  Introduce @TestPropertySource support in the TCF
2014-08-14 00:05:03 +02:00
Sam Brannen
2cf4147ba8 Introduce @TestPropertySource support in the TCF
Spring Framework 3.1 introduced an Environment abstraction with support
for hierarchical PropertySources that can be configured
programmatically as well as declaratively via the @PropertySource
annotation. However, prior to this commit, there was no way to
declaratively configure PropertySources in integration tests in the
Spring TestContext Framework (TCF).

This commit introduces declarative support for PropertySources in the
TCF via a new class-level @TestPropertySource annotation. This
annotation provides two options for declaring test property sources:

 - The 'locations' attribute allows developers to declare external
   resource locations for test properties files.

 - The 'properties' attribute allows developers to declare inlined
   properties in the form of key-value pairs.

Test properties files are added to the Environment before all other
property sources and can therefore override system and application
property sources. Similarly, inlined properties are added to the
Environment before all other property sources and can therefore
override system property sources, application property sources, and
test properties files.

Specifically, this commit introduces the following major changes:

 - Introduced @TestPropertySource annotation along with internal
   TestPropertySourceAttributes, MergedTestPropertySources, and
   TestPropertySourceUtils for working with test property sources
   within the TCF.

 - All TestContextBootstrappers have been modified to support the
   merged property resource locations and inlined properties from
   @TestPropertySource.

 - MergedContextConfiguration (and consequently the context caching
   key) is now additionally based on the merged property resource
   locations and inlined properties from @TestPropertySource. The same
   applies to WebMergedContextConfiguration.

 - AbstractContextLoader's prepareContext() method now adds
   PropertySources for all resource locations and inlined properties
   from the supplied MergedContextConfiguration to the Environment of
   the supplied ApplicationContext. All subclasses of
   AbstractGenericContextLoader and AbstractGenericWebContextLoader
   therefore automatically provide support for @TestPropertySource.

Issue: SPR-12051
2014-08-14 00:01:38 +02:00
Sebastien Deleuze
6665634675 Support Jackson based XML serialization/deserialization
This commit adds support for XML serialization/deserialization based on
the jackson-dataformat-xml extension. When using @EnableWebMvc or
<mvc:annotation-driven/>, Jackson will be used  by default instead of JAXB2
if jackson-dataformat-xml classes are found in the classpath.

This commit introduces MappingJackson2XmlHttpMessageConverter and
MappingJackson2XmlView classes, and common parts between JSON
and XML processing have been moved to AbstractJackson2HttpMessageConverter
and AbstractJackson2View classes.

MappingJackson2XmlView supports serialization of a single object. If the model
contains multiple entries, MappingJackson2XmlView.setModelKey() should be
used to specify the entry to serialize.

Pretty print works in XML, but tests are not included since a Woodstox dependency
is needed, and it is better to continue testing spring-web and spring-webmvc
against JAXB2.

Issue: SPR-11785
2014-08-13 16:22:58 +02:00
Juergen Hoeller
92bd240474 Polishing
Issue: SPR-12079
2014-08-13 15:04:58 +02:00
Juergen Hoeller
626a5fe4eb BeanNameViewResolver ignores non-View beans
Issue: SPR-12079
2014-08-13 14:57:40 +02:00
Phillip Webb
887815f4fa Update docbook dependency and generate epub
Issue: SPR-11167
2014-08-12 13:19:21 -07:00
Juergen Hoeller
fd5dbddac4 BeanFactory supports bean creation arguments for by-type lookup as well
Issue: SPR-11235
2014-08-12 22:07:12 +02:00
Juergen Hoeller
8dbfa80b13 Unit test for circular reference in default profile property, plus related polishing
Issue: SPR-12078
2014-08-12 19:23:36 +02:00
Juergen Hoeller
71c6eb2bb5 Additional configuration classes get detected when imported through XML or registrars
Issue: SPR-11430
Issue: SPR-11723
2014-08-12 17:23:21 +02:00
Juergen Hoeller
f1f1c4c980 Remove outdated IDE, JIRA and Tomcat references
Issue: SPR-7521
2014-08-12 16:32:20 +02:00
Sebastien Deleuze
f56000b825 Replace http by https for spring.io links in the reference documentation 2014-08-12 11:15:55 +02:00
Juergen Hoeller
29cb7808f2 Merge pull request #621 from royclarkson/Gson_2_3
Upgrade to Gson 2.3
2014-08-12 10:52:33 +02:00
Roy Clarkson
d6fd40d6dc Upgrade to Gson 2.3
This release contains the following new features:

- The new @JsonAdapter annotation to specify a Json TypeAdapter for a
  class field
- JsonPath support: JsonParser.getPath() method returns the JsonPath
  expression
- New public methods in JsonArray (similar to the java.util.List):
  contains(JsonElement), remove(JsonElement), remove(int index),
  set(int index, JsonElement element)
- Many other smaller bug fixes

See: https://groups.google.com/forum/#!topic/google-gson/MOqf5RGtIzk
2014-08-12 11:47:40 +03:00
Sebastien Deleuze
01cbf9b9ee Update references to SpringSource in the reference documentation 2014-08-12 10:31:41 +02:00
Phillip Webb
ac8326d2df Polish mockito usage
Consistent use of BDDMockito rather than standard Mockito.
2014-08-11 16:23:11 -07:00
Juergen Hoeller
4db258b9e3 Polishing 2014-08-11 22:32:03 +02:00
Stephane Nicoll
d100eef829 Cache documentation in multi-threaded environment
Issue: SPR-9588
2014-08-11 16:01:38 +02:00
Stephane Nicoll
c0ea87010f Improve destination-type documentation
Issue: SPR-12073
2014-08-11 15:43:45 +02:00
Juergen Hoeller
d6370965eb Polishing 2014-08-11 15:20:09 +02:00
Stephane Nicoll
e2aba3d317 Add sonar integration.
This commit configures the SonarRunner plugin so that SonarQube can
be used against the project. A few customizations were applied to
namely exclude the asm and cglib repackaged classes.

Issue: SPR-10766
2014-08-11 09:38:00 +02:00
Juergen Hoeller
7c57424b48 Tiles 3 TilesViewResolver allows for specifying custom TilesView subclasses as well
Issue: SPR-12075
2014-08-10 01:08:27 +02:00
Juergen Hoeller
a05b748d42 InternalResourceViewResolver's exposure of context beans is now available at UrlBasedViewResolver level
Issue: SPR-8064
2014-08-10 00:54:42 +02:00
Juergen Hoeller
c06ac06bdd JmsMessagingTemplate uses local convertJmsException template method instead of generic MessagingExceptionTranslator interface
This commit also turns MessagingException into a NestedRuntimeException subclass which delivers a root message that has the cause message appended to it. That's a common expectation with the use of Spring exceptions since all of our exception hierarchies have historically been designed that way.

Issue: SPR-12064
Issue: SPR-12038
2014-08-09 22:06:50 +02:00
Juergen Hoeller
6b6ca4889b HibernateTransactionManagerTests for Hibernate 3 covers currentSession() as well
Issue: SPR-9020
2014-08-09 18:30:08 +02:00
Juergen Hoeller
5cbb1fc498 SpringSessionContext for Hibernate 4 supports lazily bound Session for propagation SUPPORTS
Issue: SPR-9020
2014-08-09 18:28:30 +02:00
Juergen Hoeller
562916b69c Consistent getJpaDialect() narrowing (along with HibernateJpaVendorAdapter)
Issue: SPR-8959
Issue: SPR-11942
2014-08-09 17:10:34 +02:00
Juergen Hoeller
cbda722329 HibernateJpaDialect prepares JDBC Connection by default if on Hibernate EntityManager 4 (with its connection release mode ON_CLOSE)
Analogous to HibernateTransactionManager, there is a "prepareConnection" flag on HibernateJpaDialect which allows for overriding the actual mode of operation. This is easily accessible from HibernateJpaVendorAdapter now which declares HibernateJpaDialect from its getJpaDialect() method.

Issue: SPR-8959
Issue: SPR-11942
2014-08-09 17:09:42 +02:00
Juergen Hoeller
e08c56fcae Linking to Java SE 8 javadocs, plus upgrade to Joda-Time 2.4 2014-08-09 00:30:10 +02:00
Juergen Hoeller
53192bb6f4 Polishing 2014-08-09 00:28:13 +02:00
Stephane Nicoll
5b35fc2d77 Add JmsTemplate accessor in JmsMessagingTemplate 2014-08-08 18:09:16 +02:00
Juergen Hoeller
ad475ffadf Consistent vararg declarations for String array setters 2014-08-08 17:17:09 +02:00
Juergen Hoeller
47006eeff1 Fixed side effect on other tests
Issue: SPR-10459
2014-08-08 17:02:59 +02:00
Stephane Nicoll
c1d149591a Add base header mapper implementation 2014-08-08 16:59:42 +02:00
Juergen Hoeller
f2e4ad2364 ComponentScan annotation allows for registering beans with lazy initialization
Issue: SPR-10459
2014-08-08 15:39:06 +02:00