1. 18 2月, 2015 11 次提交
  2. 17 2月, 2015 4 次提交
    • S
      Open up TestPropertySourceUtils for public consumption · 75e0bc92
      Sam Brannen 提交于
      Spring Framework 4.1 introduced support for @TestPropertySource;
      however, the utilities used to parse inlined properties and add test
      property sources to the environment are currently private which
      prevents reuse by third-party frameworks like Spring Boot.
      
      This commit addresses this issue by making such utilities public.
      
       - TestPropertySourceUtils is now a public class.
      
       - Various utility methods in TestPropertySourceUtils have been made
         public.
      
       - addResourcePropertySourcesToEnvironment() has been renamed to
         addPropertiesFilesToEnvironment().
      
       - extractEnvironmentProperties() has been renamed to
         convertInlinedPropertiesToMap().
      
       - All public methods in TestPropertySourceUtils are now fully
         documented.
      
      Issue: SPR-12721
      75e0bc92
    • S
      Preserve ordering of inlined props in @TestPropertySource · d6a799ad
      Sam Brannen 提交于
      The initial implementation for adding inlined properties configured via
      @TestPropertySource to the context's environment did not preserve the
      order in which the properties were physically declared. This makes
      @TestPropertySource a poor testing facility for mimicking the
      production environment's configuration if the property source mechanism
      used in production preserves ordering of property names -- which is the
      case for YAML-based property sources used in Spring Boot, Spring Yarn,
      etc.
      
      This commit addresses this issue by ensuring that the ordering of
      inlined properties declared via @TestPropertySource is preserved.
      Specifically, the original functionality has been refactored. extracted
      from AbstractContextLoader, and moved to TestPropertySourceUtils where
      it may later be made public for general purpose use in other frameworks.
      
      Issue: SPR-12710
      d6a799ad
    • S
      Polish EnumerablePropertySource · add718d7
      Sam Brannen 提交于
      add718d7
    • R
      Pass SockJS session attributes to HandshakeHandler · b4fa1c24
      Rossen Stoyanchev 提交于
      Before this change the WebSocketTransportHandler passed
      Collections.emptyMap as attributes to the HandshakeHandler because
      it didn't matter what attributes the underlying WebSocketSession has
      since it is wrapped by the SockJsSession and that's what exposed for
      use everywhere.
      
      This change has the WebSocketTransportHandler passing the attributes
      from the SockJsSession instead since it's more accurate for the
      underlying WebSocketSession to have access to the same map instance
      and it allows the HandshakeHandler to change the attributes even if
      it doesn't need to do that today.
      
      Issue: SPR-12716
      b4fa1c24
  3. 16 2月, 2015 1 次提交
  4. 13 2月, 2015 2 次提交
  5. 12 2月, 2015 7 次提交
  6. 11 2月, 2015 8 次提交
  7. 10 2月, 2015 7 次提交
    • S
      Merge pull request #723 from svolsky/SPR-12653 · 13ccc8ed
      Stephane Nicoll 提交于
      * SPR-12653:
        Synchronize clear on TransactionAwareCacheDecorator
      13ccc8ed
    • S
      Synchronize clear on TransactionAwareCacheDecorator · ef95fc2f
      Stas Volsky 提交于
      Previously, a cache decorated with TransactionAwareCacheDecorator would
      clear the cache immediately, even when a transaction is running. This
      commit updates the decorator to synchronize to the afterCommit phase for
      the clear operation as well.
      
      Issue: SPR-12653
      ef95fc2f
    • S
      Clear expression caches on context shutdown · 6b3092c2
      Stephane Nicoll 提交于
      Issue: SPR-12691
      6b3092c2
    • S
      Fix usage of Java8 API · 37c04bd9
      Stephane Nicoll 提交于
      37c04bd9
    • S
      Support for transactional event listener · 4741a12f
      Stephane Nicoll 提交于
      Update the application event listener infrastructure to support events
      that are processed according to a transactional phase.
      
      Introduce EventListenerFactory that can be implemented to provide support
      for additional event listener types. TransactionalEventListener is a new
      annotation that can be used in lieu of the regular EventListener. Its
      related factory implementation is registered in the context automatically
      via @EnableTransactionManagement or <tx:annotation-driven/>
      
      By default, a TransactionalEventListener is invoked when the transaction
      has completed successfully (i.e. AFTER_COMMIT). Additional phases are
      provided to handle BEFORE_COMMIT and AFTER_ROLLBACK events.
      
      If no transaction is running, such listener is not invoked at all unless
      the `fallbackExecution` flag has been explicitly set.
      
      Issue: SPR-12080
      4741a12f
    • S
      Annotation-based event listeners · f0fca890
      Stephane Nicoll 提交于
      Add support for annotation-based event listeners. Enabled automatically
      when using Java configuration or can be enabled explicitly via the
      regular <context:annotation-driven/> XML element. Detect methods of
      managed beans annotated with @EventListener, either directly or through
      a meta-annotation.
      
      Annotated methods must define the event type they listen to as a single
      parameter argument. Events are automatically filtered out according to
      the method signature. When additional runtime filtering is required, one
      can specify the `condition` attribute of the annotation that defines a
      SpEL expression that should match to actually invoke the method for a
      particular event. The root context exposes the actual `event`
      (`#root.event`) and method arguments (`#root.args`). Individual method
      arguments are also exposed via either the `a` or `p` alias (`#a0` refers
      to the first method argument). Finally, methods arguments are exposed via
      their names if that information can be discovered.
      
      Events can be either an ApplicationEvent or any arbitrary payload. Such
      payload is wrapped automatically in a PayloadApplicationEvent and managed
      explicitly internally. As a result, users can now publish and listen
      for arbitrary objects.
      
      If an annotated method has a return value, an non null result is actually
      published as a new event, something like:
      
      @EventListener
      public FooEvent handle(BarEvent event) { ... }
      
      Events can be handled in an aynchronous manner by adding `@Async` to the
      event method declaration and enabling such infrastructure. Events can
      also be ordered by adding an `@order` annotation to the event method.
      
      Issue: SPR-11622
      f0fca890
    • S
      Support for generics-based events · 6d6422ac
      Stephane Nicoll 提交于
      Update the event publishing infrastructure to support generics-based
      events, that is support ApplicationListener implementations that define
      a generic event, something like:
      
      public class MyListener
              implements ApplicationListener<GenericEvent<String>> { ... }
      
      This listener should only receive events that are matching the generic
      signature, for instance:
      
      public class StringEvent extends GenericEvent<String> { ... }
      
      Note that because of type erasure, publishing an event that defines the
      generic type at the instance level will not work. In other words,
      publishing "new GenericEvent<String>" will not work as expected as type
      erasure will define it as GenericEvent<?>.
      
      To support this feature, use the new GenericApplicationListener that
      supersedes SmartApplicationListener to handle generics-based even types via
      `supportsEventType` that takes a ResolvableType instance instead of the
      simple Class of the event. ApplicationEventMulticaster has an additional
      method to multicast an event based on the event and its ResolvableType.
      
      Issue: SPR-8201
      6d6422ac