1. 14 8月, 2014 3 次提交
    • S
      3e213885
    • S
      Merge from sbrannen/SPR-12051 · f2ac0256
      Sam Brannen 提交于
      * SPR-12051:
        Introduce @TestPropertySource support in the TCF
      f2ac0256
    • S
      Introduce @TestPropertySource support in the TCF · 2cf4147b
      Sam Brannen 提交于
      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
      2cf4147b
  2. 13 8月, 2014 6 次提交
  3. 12 8月, 2014 8 次提交
  4. 11 8月, 2014 4 次提交
  5. 10 8月, 2014 5 次提交
  6. 09 8月, 2014 5 次提交
  7. 08 8月, 2014 9 次提交