Commit Graph

785 Commits

Author SHA1 Message Date
Juergen Hoeller 22c0085ba0 ComponentScanAnnotationParser supports multiple base packages within a single placeholder as well
Issue: SPR-10425
2014-09-25 17:51:53 +02:00
Juergen Hoeller cfc821d179 DataBinder unwraps Optional objects and allows for proper handling of Optional.empty()
Issue: SPR-12241
2014-09-25 17:00:36 +02:00
Juergen Hoeller 3836aa051f Message broker thread pools should be set up in allowCoreThreadTimeOut mode
Issue: SPR-12249
2014-09-25 01:29:00 +02:00
Juergen Hoeller e003d21726 Defensively use setRemoveOnCancelPolicy for JDK 6 compatibility
Issue: SPR-12238
2014-09-25 01:24:13 +02:00
Juergen Hoeller e52f041a78 ComponentScanBeanDefinitionParser supports placeholders for entire base-package specification and for type filter expressions
Issue: SPR-10424
Issue: SPR-10425
2014-09-25 01:03:08 +02:00
Juergen Hoeller 5ecdd8ca31 Consistent Environment access in XML bean definition parsing code
Issue: SPR-12248
2014-09-25 01:02:40 +02:00
Juergen Hoeller 0934751d7a BeanWrapper supports traversal of nested paths with Java 8 Optional declarations
Issue: SPR-12241
2014-09-24 17:56:24 +02:00
Phillip Webb 4c59d85f69 Be defensive adding additional imported configs
Refine the logic introduced in commit 71c6eb2b so that additional
imported @Configuration classes are not considered as candidates if
they have already been parsed.

Issue: SPR-12233
2014-09-22 15:05:47 -07:00
Juergen Hoeller 16325c2eaa Polishing 2014-09-20 00:29:16 +02:00
Juergen Hoeller 7f8d611598 Defensive reset/restore of JNDI environment (avoiding test side effects)
Issue: SPR-12223
2014-09-20 00:23:42 +02:00
Phillip Webb a2b983a4e4 Further refine property source ordering
Refine property source ordering so that sources already contained in the
environment remain before those added by @PropertySource annotations.

Issue: SPR-12198
2014-09-19 00:10:30 -07:00
Phillip Webb 2077388f38 Improve JNDI detection logic
Update JndiLocatorDelegate.isDefaultJndiEnvironmentAvailable() to
call `getEnvironment()` on the `InitialContext` in order to actually
trigger a NamingException if JNDI is not available.

Issue: SPR-12223
2014-09-18 23:09:45 -07:00
Juergen Hoeller f259ca1b1f Refined tests for property source ordering
Issue: SPR-12198
(cherry picked from commit 205e681)
2014-09-19 00:53:07 +02:00
Juergen Hoeller 90b93ffe3f Restored property source ordering (fixing regression from 4.0.x)
Issue: SPR-12198
2014-09-18 23:48:35 +02:00
Juergen Hoeller f4219ca06b Consistent exclusion of bridge methods in annotation post-processors (for Java 8 compatibility)
Issue: SPR-12187
2014-09-18 23:45:42 +02:00
Phillip Webb 70b5f319a9 Support @Ordering of Conditions
Update ConditionEvaluator to collect then sort Conditions before
evaluation. By annotating Conditions with @Ordered expensive operations
can be pushed to the back of the queue.

Issue: SPR-12219
2014-09-17 21:39:38 -07:00
Juergen Hoeller a833889c2a Polishing 2014-09-17 21:55:46 +02:00
Juergen Hoeller 58b22ceddc Scheduled/JmsListenerAnnotationBeanPostProcessor avoids needless re-scanning of non-annotated classes
Issue: SPR-12189
2014-09-17 21:55:35 +02:00
Juergen Hoeller 40cd277b7e ReloadableResourceBundleMessageSource prevents accidental exposure of incomplete holder
Issue: SPR-12177
2014-09-17 15:00:22 +02:00
Juergen Hoeller 15320db414 Polishing 2014-09-17 02:35:41 +02:00
Juergen Hoeller 824c90d2bf ConfigurationClassParser avoids double registration of nested classes which extend their containing class
Issue: SPR-12195
2014-09-16 17:08:30 +02:00
Juergen Hoeller 20c2ba35dc Polishing 2014-09-04 00:55:38 +02:00
Juergen Hoeller c6d29f1a31 Refactored support for @Order on @Bean methods as well as @Priority handling
Issue: SPR-11310
Issue: SPR-10548
2014-09-04 00:41:13 +02:00
Juergen Hoeller 2f93759d1b Cache.get(key, type) explicitly defines an IllegalStateException in case of a type mismatch
Issue: SPR-12145
2014-09-03 13:00:20 +02:00
Juergen Hoeller 6563405be5 ImportRegistry as a package-visible top-level interface which can easily be shared within the package
Issue: SPR-12128
2014-09-03 12:59:51 +02:00
Phillip Webb abc343f407 Prevent incorrect ImportAware metdata injection
Update ImportRegistry to track all import registrations that occur
against an importing class (rather than just keeping the last). In
addition, prune imported classes from the registry when a configuration
class is removed during the REGISTER_BEAN ConfigurationPhase.

This update prevents incorrect metadata from being injected into an
ImportAware class which is imported twice by different configurations
classes (when one of the configuration classes will be ultimately skipped
due to a @Condition).

Issue: SPR-12128
2014-09-02 20:47:30 -07:00
Juergen Hoeller f617d28eef Polishing 2014-09-03 00:31:19 +02:00
Juergen Hoeller 4432c41dbd AbstractAutowireCapableBeanFactory avoids early FactoryBean instantiation on currently created configuration bean
Issue: SPR-12141
2014-09-03 00:28:05 +02:00
Juergen Hoeller 98eb0f75bc Polishing 2014-09-02 22:15:53 +02:00
Juergen Hoeller 8c9274e017 LazyInitTargetSource works for @Bean targets as well
Issue: SPR-10508
Issue: SPR-8080
2014-09-02 22:13:35 +02:00
Juergen Hoeller 53fbf1a509 ConfigurationClassParser checks REGISTER_BEAN conditions before processing configuration class imports
Issue: SPR-12128
2014-09-02 22:07:51 +02:00
Juergen Hoeller 078f23d6e6 Polishing 2014-08-23 01:07:01 +02:00
Juergen Hoeller 9dfbc5326b Revised ResourcePropertySource in order to avoid ConfigurationClassProcessor's AnnotationPropertySource subclass
Issue: SPR-12115
2014-08-22 13:54:39 +02:00
Phillip Webb 84564a0c7b Rework @PropertySource early parsing logic
Rework the @PropertySource parsing logic recently changed in commit
7c608886 to deal with the same source appearing on a @Configuration
class and an @Import class.

Processing now occurs in a single sweep, with any previously added
sources being converted to a CompositePropertySource.

Issue: SPR-12115
2014-08-21 21:21:15 -07:00
Juergen Hoeller 7c6088861f @PropertySource gets parsed as early as possible
Other PropertySources and in particular @ComponentScan can benefit from previously declared property sources on the same configuration class.

Issue: SPR-12110
Issue: SPR-12111
2014-08-21 22:43:08 +02:00
Juergen Hoeller a000dd782a ReloadableResourceBundleMessageSource uses ConcurrentHashMaps and ReentrantLocks instead of synchronization
Issue: SPR-10500
2014-08-21 14:24:28 +02:00
Juergen Hoeller b5763fe326 Consistent attribute documentation/formatting in spring-context and spring-mvc schemas 2014-08-20 16:36:12 +02:00
Juergen Hoeller 9d3d6d5919 DefaultListableBeanFactory defensively handles BeanDefinition access in getBean(Class)
Issue: SPR-10542
2014-08-20 10:48:35 +02:00
Juergen Hoeller 2ef3d66c89 Polishing 2014-08-18 19:27:08 +02:00
Stephane Nicoll bccb3bb70b polishing 2014-08-18 11:03:58 +02:00
Stephane Nicoll 8fc191c95e Apply AsyncUncaughtExceptionHandler to AspectJ
Prior to this commit, only @Async annotated methods with proxy style
had their custom uncaught exception handler applied. This commit
harmonizes the configuration so that AspectJ applies that behaviour as
well.

Issue: SPR-12090
2014-08-18 10:51:21 +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
Phillip Webb e142fd11e0 Add tests for ImportSelector meta-data
Issue: SPR-12059
2014-08-14 07:35:16 -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 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
Phillip Webb ac8326d2df Polish mockito usage
Consistent use of BDDMockito rather than standard Mockito.
2014-08-11 16:23:11 -07: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
Juergen Hoeller f2e4ad2364 ComponentScan annotation allows for registering beans with lazy initialization
Issue: SPR-10459
2014-08-08 15:39:06 +02:00
Juergen Hoeller ef51d4dbdb AnnotatedElementUtils adapts post-processed values to AnnotationAttributes as well
Issue: SPR-12065
2014-08-08 15:15:29 +02:00
Juergen Hoeller 3a419872c8 Polishing 2014-08-07 23:06:08 +02:00
Stephane Nicoll 3da68cfe21 Remove unused imports 2014-08-04 14:13:40 +02:00
Juergen Hoeller 9f3c1cf762 Polishing 2014-07-28 23:05:08 +02:00
Juergen Hoeller 036896a6b8 Split configuration constants into local XConfigUtils classes instead of piling them up in AnnotationConfigUtils 2014-07-28 21:58:21 +02:00
Juergen Hoeller 92c657e12d JmsListener/ScheduledAnnotationBeanPostProcessor uses SmartInitializingSingleton instead of ContextRefreshedEvent
Also reducing the container dependencies to BeanFactory instead of ApplicationContext, wherever possible.

Issue: SPR-12039
2014-07-28 15:58:13 +02:00
Juergen Hoeller 78484129f5 ConcurrentMapCacheManager recreates caches in case of setAllowNullValues change
Issue: SPR-12026
2014-07-24 15:06:36 +02:00
Juergen Hoeller 496492b2d8 Autowiring rejects self references to a factory method on the same bean as well
Issue: SPR-12018
2014-07-24 12:13:25 +02:00
Stephane Nicoll d9e0b292ab polishing 2014-07-23 17:08:19 +02:00
Juergen Hoeller 5e2fbe7355 AbstractApplicationContext logs initialization exception before trying to cancel refresh attempt
Issue: SPR-12010
2014-07-22 16:33:46 +02:00
Juergen Hoeller 9d6c38bd54 Consistent bracket alignment 2014-07-18 17:21:58 +02:00
Stephane Nicoll 35226695eb Rename default to testCache in Cache related tests
This simply renames the default cache from "default" to "testCache" as
this might be a reserved names for third party cache providers.
2014-07-16 17:25:27 +02:00
Juergen Hoeller 4e25a14f6c Merge pull request #571 from sdeleuze/SPR-11820
Make ListenableFuture compliant with Java 8 lambda
2014-07-16 16:41:41 +02:00
Sebastien Deleuze 86e8bdab6b Make ListenableFuture compliant with Java 8 lambda
Make it possible to use a ListenableFuture with Java 8
lambda expressions, using a syntax like
listenableFuture.addCallback(() -> ..., () -> ...);

Issue: SPR-11820
2014-07-16 16:06:24 +02:00
Juergen Hoeller bad74dc836 Revision of SpelCompiler support, resolving a subpackage cycle through moving CodeFlow and CompilablePropertyAccessor to the main spel package
Also contains explicit ClassLoader management, passed through StandardBeanExpressionResolver and SpelParserConfiguration to SpelCompiler lookup.

Issue: SPR-10943
2014-07-16 14:41:46 +02:00
Juergen Hoeller bbf5800831 ConfigurationClassParser processes late-arriving DeferredImportSelectors as regular import selectors
Also contains refined exception handling, treating regular class loading and ASM-based loading consistently in terms of exception wrapping, and always mentioning the current configuration class in all exception messages.

Issue: SPR-11997
2014-07-15 22:04:52 +02:00
Juergen Hoeller 2665d56209 Polishing 2014-07-15 15:13:35 +02:00
Stephane Nicoll b676c41805 Add missing 4.1 XSDs
This commit adds the missing 4.1 XSDs for the following components:

* spring-aop
* spring-context
* spring-jee
* spring-lang
* spring-tx
* spring-util

These are strictly identical to the definition of the 4.0 XSDs.

Issue: SPR-11990
2014-07-14 17:59:54 +02:00
Juergen Hoeller 2bd6e24b65 MBeanExporter implements newly introduced SmartInitializingSingleton callback interface
Issue: SPR-8045
2014-07-10 15:48:36 +02:00
Juergen Hoeller 29f6f3d7e7 Test ASM5's bytecode parsing of INVOKESPECIAL/STATIC on interfaces
Issue: SPR-11979
2014-07-10 15:46:18 +02:00
Juergen Hoeller 01264dc673 Polishing 2014-07-08 00:59:31 +02:00
Juergen Hoeller 1115374188 MBeanExporter should not implement SmartLifecycle but rather receive a ContextRefreshedEvent-like callback
This commit removes the immediate package dependency cycle between the context and jmx packages. A specific callback arrangement will follow in time for 4.1 RC1; at this point, it's temporarily back to registration kicked off by afterPropertiesSet again.

Issue: SPR-8045
2014-07-07 23:50:27 +02:00
Stephane Nicoll e20ac27fb4 Fix mutually exclusive use of CachePut and Cacheable
Commit eea230f introduced a regression by adding a support for the
"result" variable in SpEL expression for @CachePut. As such expressions
cannot be evaluated upfront anymore, any method that contains both
@Cacheable and @CachePut annotations are always executed even when
their conditions are mutually exclusive.

This is an example of such mutual exclusion

@Cacheable(condition = "#p1", key = "#p0")
@CachePut(condition = "!#p1", key = "#p0")
public Object getFooById(Object id, boolean flag) { ... }

This commit updates CacheEvaluationContext to define a set of
unavailable variables. When such variable is accessed for a given
expression, an exception is thrown. This is used to restore the
evaluation of the @CachePut condition upfront by registering "result"
as an unavailable variable.

If all @CachePut operations have been excluded by this upfront check,
the @Cacheable operation is processed as it was before. Such upfront
check restore the behavior prior to eea230f.

Issue: SPR-11955
2014-07-07 14:18:19 +02:00
Juergen Hoeller b7984f21d8 Polishing 2014-07-01 20:30:31 +02:00
Juergen Hoeller 37ba1b966e Seamless support for Groovy bean definitions mixed with XML bean definitions
GroovyBeanDefinitionReader and Groovy ApplicationContexts redirect ".xml" files to XmlBeanDefinitionReader now, similar to what they've been doing for importBeans directives already. Analogously, @ImportResource for configuration classes redirects ".groovy" to GroovyBeanDefinitionReader now.

Issue: SPR-11924
2014-06-30 22:53:25 +02:00
Juergen Hoeller db616dc438 Polishing 2014-06-30 14:55:43 +02:00
Juergen Hoeller cee53e9330 Unit tests for method validation before async dispatching
Issue: SPR-11775
2014-06-30 13:49:48 +02:00
Rossen Stoyanchev 71b942698d Fix sniff task warnings 2014-06-29 22:56:53 -04:00
Rossen Stoyanchev 9880d2b5f4 Remove JDK 1.7 guard for removeOnCancelPolicy property
Issue: SPR-11918
2014-06-29 15:30:39 -04:00
Rossen Stoyanchev 7441f23012 Add support for removeOnCancelPolicy
This change removes the recently added SockJsThreadPoolTaskScheduler
and instead builds support for the removeOnCancelPolicy property in
ThreadPoolTaskScheduler and ScheduledExecutorFactoryBean.

Issue: SPR-11918
2014-06-29 14:28:52 -04:00
Juergen Hoeller fac2d80054 AbstractApplicationContext uses AtomicBoolean instead of synchronization for active/closed flags
Issue: SPR-11863
2014-06-29 17:36:50 +02:00
Stephane Nicoll b0979cbab6 autoGrow support in DataBinder for field access
This commit harmonizes the autoGrow feature for both regular bean
property and direct field access.

Issue: SPR-8692
2014-06-27 11:28:09 +02:00
Stephane Nicoll 17d15cc495 Fix warning 2014-06-27 11:04:41 +02:00
Stephane Nicoll bc714888c4 Nested properties support for field-based validation
This commit validates that the changes introduced in 8221c9abc5 are
indeed allowing DirectFieldBindingResult to support nested validation
paths.

Issue: SPR-10623
2014-06-27 11:00:41 +02:00
Stephane Nicoll 8221c9abc5 Support for nested path using field access
This commit adds a nested path support for DirectFieldAccessor that is
similar to what BeanWrapper provides. It is now possible to use
expressions such as "person.address.city.name" to access the name of
the city that a given person lives in using fields to traverse the
graph.

DirectFieldAccessor also now supports an auto-grow option to create
a default instance for a "null" intermediate path. This option is
false by default and leads to a NullValueInNestedPathException in such
a case.

This commit also harmonizes part of the tests suite so that core tests
are shared between BeanWrapperImpl and DirectFieldAccessor.

Note that map and list access is not implemented as part of this
commit.

Issue: SPR-9705
2014-06-26 19:22:02 +02:00
Juergen Hoeller 442bd682a7 Polishing
Issue: SPR-11910
2014-06-26 18:14:51 +02:00
Juergen Hoeller 35067790f3 MBeanExporter implements DisposableBean again (also revised logging and rearranged properties)
Issue: SPR-8045
2014-06-26 15:55:40 +02:00
Juergen Hoeller 46dc07a005 AsyncExecutionInterceptor uses submitListenable if method signature indicates ListenableFuture
Issue: SPR-11909
2014-06-26 15:19:17 +02:00
Juergen Hoeller cc917de24d Polishing 2014-06-26 11:44:07 +02:00
Juergen Hoeller b3e3c5312f Introduced AnnotationConfigRegistry as common interface for AnnotationConfig(Web)ApplicationContext
Issue: SPR-11814
2014-06-26 11:43:03 +02:00
Juergen Hoeller b6255128bf ConfigurationClassPostProcessor skips pre-processed bean definitions now (avoiding side effects in case of multiple CCPPs)
Issue: SPR-11858
2014-06-25 13:46:15 +02:00
Juergen Hoeller 18131bf611 Consistent declaration of private static final logger variables
Issue: SPR-11905
2014-06-24 14:02:05 +02:00
Juergen Hoeller 6f68b034ca MBeanExportConfiguration's SpecificPlatform properly calls afterPropertiesSet
Also makes the nested SpecificPlatform enum public for Spring Boot to reuse it.

Issue: SPR-11877
2014-06-19 22:24:04 +02:00
Stephane Nicoll c7b106577f polishing
Reorganized class structure to match our code style (setter for
properties at the top of the class, public method before private
implementation).

Removed DisposableBean as it the lifecycle is already taking care
of removing MBeans on stop.

Cleaned test suite

Issue: SPR-8045
2014-06-10 10:13:58 +02:00
Marten Deinum 2ede219e66 Using SmartLifecycle to register MBeans
Prior to this commit, MBeans were registered in a post construct
call of MBeanExporter. This commit moves that logic after the
initialization phase using the SmartLifecycle callback.

Issue: SPR-8045
2014-06-10 10:13:58 +02:00
Juergen Hoeller 6aa9c40552 ConfigurationClassParser falls back to ASM-based resolution of member classes in case of NoClassDefFoundError
Issue: SPR-11844
2014-06-06 14:01:38 +02:00
Juergen Hoeller f7b465390c Moved @Uses annotations to org.springframework.lang; fixed Base64Utils to declare Java 8, and fixed PathResource's declaration to refer to Java 7.
Issue: SPR-11604
2014-06-04 21:34:23 +02:00
Stephane Nicoll 001d0e734c Support for @Order at the bean declaration level
This commit introduces OrderProvider and OrderProviderComparator, two
interfaces designed to externalize how a collection of element is sorted
according to their order value.

FactoryAwareOrderProvider is an OrderProvider implementation that knows
about the objects to order and the corresponding BeanFactory instance.
This allows to retrieve additional metadata about the actual instances
to sort, such as its factory method.

A @Bean method can now holds an additional @Order to define the order
value that this bean should have when injected as part of a collection
or array.

Issue: SPR-11310
2014-06-04 21:04:13 +02:00
Stephane Nicoll aaae10ce3b Cache operation invocation hook point
This commit adds a invokeOperation protected method in case one
needs a hook point in the way the underlying cache method is invoked,
and how exceptions that might be thrown by that invocation are handled.

Issue: SPR-11540
2014-06-02 15:00:51 +02:00
Juergen Hoeller 31f2f20307 Unit tests for configuration classes implementing the JSR-330 Provider interface
Issue: SPR-11830
2014-05-30 21:37:01 +02:00
Juergen Hoeller 5ed9bedf32 Introducing GroovyWebApplicationContext along the lines of XmlWebApplicationContext and GenericGroovyApplicationContext
Also includes minor dependency updates such as Groovy 2.3.2.

Issue: SPR-11371
2014-05-30 17:35:00 +02:00
Juergen Hoeller 8220832c4e Polishing 2014-05-27 18:29:51 +02:00
Juergen Hoeller d9f8ee886e Introduced EmbeddedValueResolutionSupport base class for AnnotationFormatterFactory implementations 2014-05-27 18:15:34 +02:00
Stephane Nicoll bb6e07bd3a polishing 2014-05-26 13:39:38 +02:00
Stephane Nicoll 9952973e01 Add missing cache-resolver attribute
Prior to this commit, CacheResolver could not be configured through
the XML namespace (i.e. cache:annotation-driven). This is now the
case.

Issue: SPR-11490
2014-05-21 09:03:18 +02:00
Stephane Nicoll 05e96ee448 Cache provider related exceptions handling
This commit adds the necessary infrastructure to handle exceptions
thrown by a cache provider in both Spring's and JCache's caching
abstractions.

Both interceptors can be configured with a CacheErrorHandler that
defines several callbacks on typical cache operations. In particular,
handleCacheGetError can be implemented in such a way that an
exception thrown by the provider is handled as a cache miss by the
caching abstraction.

The handler can be configured with both CachingConfigurer and the
XML namespace (error-handler property)

Issue: SPR-9275
2014-05-20 16:39:34 +02:00
Juergen Hoeller f29d6eb5f6 Properly evaluate @Conditional in case of multiple imports for same config class (fixing regression in Spring Boot)
Issue: SPR-11788
(cherry picked from commit 7d78c65)
2014-05-18 02:05:18 +02:00
Juergen Hoeller 52f44b340e Properly evaluate @Conditional in case of multiple imports for same config class
Issue: SPR-11788
2014-05-16 15:06:22 +02:00
Juergen Hoeller b4d447fc3d isLiteConfigurationCandidate considers @ComponentScan and @ImportResource as indicators as well
Issue: SPR-11769
2014-05-09 21:43:37 +02:00
Juergen Hoeller 8c9116fd4b Additional tests for configuration class importing via ASM
Issue: SPR-11647
2014-05-08 16:22:24 +02:00
Stephane Nicoll 658f7f58df Add missing @since tag 2014-05-05 15:45:45 +02:00
Stephane Nicoll bd85c916eb Integrate animal sniffer
Animal sniffer provides tools to assist verifying that classes
compiled with a newer JDK are compatible with an older JDK.

This integratesthe latest version of the tool (1.11) that
permits the use of custom annotations. Added @UsesJava7,
@UsesJava8 and @UsesSunHttpServer and annotated the few places
where we rely on a specific environment.

The verification process can be invoked by running the 'sniff'
task.

Issue: SPR-11604

polishing
2014-04-30 13:51:01 +02:00
Juergen Hoeller adb616b67b JRubyScriptUtils defensively handles null Nodes in findClassNode (fails against JRuby 1.7.12 otherwise)
Issue: SPR-11747
2014-04-30 13:40:11 +02:00
Stephane Nicoll 90081f787f Fix Cacheable javadoc
This commits fixes a confusing phrasing of Cacheable javadoc that
mentioned explicitly that the method signature is used to compute the
key for the cache.

Issue: SPR-11736
2014-04-30 11:40:54 +02:00
Juergen Hoeller 02aca9c754 Polishing 2014-04-30 00:01:07 +02:00
Juergen Hoeller 1b2014a52d AbstractAutoProxyCreator and AbstractAdvisingBeanPostProcessor consistently not considering configuration callbacks and internal language interfaces as reasonable proxy interfaces
Issue: SPR-11715
2014-04-29 19:07:29 +02:00
Juergen Hoeller e510f6393a Polishing 2014-04-29 15:45:56 +02:00
Juergen Hoeller a0658c5832 AbstractAdvisingBeanPostProcessor uses target class check for existing proxy but checks against actual exposed object otherwise (catching introductions)
Issue: SPR-11725
2014-04-29 15:44:55 +02:00
Juergen Hoeller be5f2a8b4e Polishing 2014-04-28 23:37:07 +02:00
Juergen Hoeller ab24dda4ff Revised @PropertySource parsing for consistent PropertySource naming, avoiding accidental overriding by name
Issue: SPR-11637
2014-04-28 23:24:57 +02:00
Juergen Hoeller 299776fd80 Test for overriding singleton @Bean method with scoped proxy in configuration subclass
Issue: SPR-10744
2014-04-28 14:02:02 +02:00
Juergen Hoeller 6f2e61b19f Polishing
(cherry picked from commit c97c246)
2014-04-28 00:47:50 +02:00
Juergen Hoeller 6cb45f714e General defensiveness about the bootstrap ClassLoader (i.e. null ClassLoader)
Issue: SPR-11721
(cherry picked from commit 59cef3c)
2014-04-28 00:47:21 +02:00
Juergen Hoeller ce1954da1e Configuration class processing explicitly skips java.* classes since we'll never find @Bean annotations there anyway
Issue: SPR-11718
(cherry picked from commit c8ea80d)
2014-04-28 00:33:14 +02:00
Juergen Hoeller 310bdbcb15 @Bean processing explicitly ignores bridge methods (for method overrides with return type narrowing on JDK 8)
Issue: SPR-11718
(cherry picked from commit 656fc52)
2014-04-28 00:33:04 +02:00
Juergen Hoeller 9353332a61 Polishing 2014-04-23 23:55:43 +02:00
Stephane Nicoll 5559209233 Remove useless imports 2014-04-22 09:57:12 +02:00
Juergen Hoeller 48c977afdc Polishing 2014-04-17 21:19:47 +02:00
Juergen Hoeller 4612559446 Automated tests against Hibernate ORM 4.3 and Hibernate Validator 5
Issue: SPR-11704
2014-04-17 16:24:10 +02:00
Stephane Nicoll 713dd60fa7 JMS annotation-driven endpoints.
This commit adds the support of JMS annotated endpoint. Can be
activated both by @EnableJms or <jms:annotation-driven/> and
detects methods of managed beans annotated with @JmsListener,
either directly or through a meta-annotation.

Containers are created and managed under the cover by a registry
at application startup time. Container creation is delegated to a
JmsListenerContainerFactory that is identified by the containerFactory
attribute of the JmsListener annotation. Containers can be
retrieved from the registry using a custom id that can be specified
directly on the annotation.

A "factory-id" attribute is available on the container element of
the XML namespace. When it is present, the configuration defined at
the namespace level is used to build a JmsListenerContainerFactory
that is exposed with the value of the "factory-id" attribute. This can
be used as a smooth migration path for users having listener containers
defined at the namespace level. It is also possible to migrate all
listeners to annotated endpoints and yet keep the
<jms:listener-container> or <jms:jca-listener-container> element to
share the container configuration.

The configuration can be fine-tuned by implementing the
JmsListenerConfigurer interface which gives access to the registrar
used to register endpoints. This includes a programmatic registration
of endpoints in complement to the declarative approach. A default
JmsListenerContainerFactory can also be specified to be used if no
containerFactory has been set on the annotation.

Annotated methods can have flexible method arguments that are similar
to what @MessageMapping provides. In particular, jms listener endpoint
methods can fully use the messaging abstraction, including convenient
header accessors. It is also possible to inject the raw
javax.jms.Message and the Session for more advanced use cases. The
payload can be injected as long as the conversion service is able to
convert it from the original type of the JMS payload. By
default, a DefaultJmsHandlerMethodFactory is used but it can be
configured further to support additional method arguments or to
customize conversion and validation support.

The return type of an annotated method can also be an instance of
Spring's Message abstraction. Instead of just converting the payload,
such response type allows to communicate standard and custom headers.

The JmsHeaderMapper infrastructure from Spring integration has also
been migrated to the Spring framework. SimpleJmsHeaderMapper is based
on SI's DefaultJmsHeaderMapper. The simple implementation maps all
JMS headers so that the generated Message abstraction has all the
information stored in the protocol specific message.

Issue: SPR-9882
2014-04-17 09:16:06 +02:00
Juergen Hoeller 90309ab0b5 CglibAopProxy detects package-visible methods when defined in a different ClassLoader
Issue: SPR-11618
2014-04-16 18:07:10 +02:00
Stephane Nicoll 397aa82984 Fix expression cache
Prior to this commit, only the java.lang.reflect.Method was used to
identify an annotated method. As a result, if different annotations
were placed on different methods (method overriding, interface
implementation) only the first one (cached) was used.

LazyParamAwareEvaluationContext was affected by the exact
same problem and has been also fixed.

Issue: SPR-11692
2014-04-15 09:14:41 +02:00
Sam Brannen 2a937a369e Polish Javadoc in SimpleApplicationEventMulticaster 2014-04-11 15:57:21 +02:00
Juergen Hoeller 49916bb7eb SimpleApplicationEventMulticaster supports a configurable ErrorHandler strategy
Issue: SPR-11551
2014-04-10 23:06:25 +02:00
Juergen Hoeller 14f9dbf70c Consistent documentation for both 'close' and 'shutdown' as inferred destroy methods
Issue: SPR-11680
2014-04-10 22:52:22 +02:00
Juergen Hoeller 0041e245a1 Polishing
Issue: SPR-11637
2014-04-09 17:43:09 +02:00
Stephane Nicoll 7b5e9e8c8e polishing
This fixes a Java6 backward compatible issue introduced in the JCache
implementation.

This commit also adds new representative tests.

Issue: SPR-9616
2014-04-07 21:43:05 +02:00
Stephane Nicoll f3b8a4103e Use CacheResolver in Spring abstraction
Prior to this commit, the CacheResolver was not used by Spring's
caching abstraction. This commit provides the necessary configuration
options to tune how a cache is resolved for a given operation.

CacheResolver can be customized globally, at the operation level or at
the class level. This breaks the CachingConfigurer class and a support
implementation is provided that implements all methods so that the
default is taken if it's not overridden. The JSR-107 support has been
updated as well, with a similar support class.

In particular, the static and runtime information of a cache
operation were mixed which prevents any forms of caching. As the
CacheResolver and the KeyGenerator can be customized, every operation
call lead to a lookup in the context for the bean.

This commit adds CacheOperationMetadata, a static holder of all
the non-runtime metadata about a cache operation. This is used
as an input source for the existing CacheOperationContext.

Caching the operation metadata in an AspectJ aspect can have side
effects as the aspect is static instance for the current ClassLoader.
The metadata cache needs to be cleared when the context shutdowns.
This is essentially a test issue only as in practice each application
runs in its class loader. Tests are now closing the context properly
to honor the DisposableBean callback.

Issue: SPR-11490
2014-04-07 15:41:09 +02:00
Stephane Nicoll 47a4327193 Add JSR-107 cache annotations support
This commit adds support for the JSR-107 cache annotations alongside
the Spring's cache annotations, that is @CacheResult, @CachePut,
@CacheRemove and @CacheRemoveAll as well as related annotations
@CacheDefaults, @CacheKey and @CacheValue.

Spring's caching configuration infrastructure detects the presence of
the JSR-107 API and Spring's JCache implementation. Both
@EnableCaching and the cache namespace are able to configure the
required JCache infrastructure when necessary. Both proxy mode
and AspectJ mode are supported.

As JSR-107 permits the customization of the CacheResolver to use for
both regular and exception caches, JCacheConfigurer has been
introduced as an extension of CachingConfigurer and permits to define
those.

If an exception is cached and should be rethrown, it is cloned and
the call stack is rewritten so that it matches the calling thread each
time. If the exception cannot be cloned, the original exception is
returned.

Internally, the interceptors uses Spring's caching abstraction by default
with an adapter layer when a JSR-107 component needs to be called.
This is the case for CacheResolver and CacheKeyGenerator.

The implementation uses Spring's CacheManager abstraction behind the
scene. The standard annotations can therefore be used against any
CacheManager implementation.

Issue: SPR-9616
2014-04-07 12:07:20 +02:00
Stephane Nicoll 3e74d3b2fb Add putIfAbsent on Cache abstraction
This commit adds a putIfAbsent method to the Cache interface. This
method offers an atomic put if the key is not already associated in
the cache.

Issue: SPR-11400
2014-04-03 11:37:22 +02:00
Stephane Nicoll db23ec733b Add exception handling of asynchronous method
Prior to this commit, an exception thrown by an @Async void method
was not further processed as there is no way to transmit that
exception to the caller.

The AsyncUncaughtExceptionHandler is a new strategy interface that
can be implemented to handle unexpected exception thrown during the
invocation of such asynchronous method.

The handler can be specified using either the XML namespace or by
implementing the AsyncConfigurer interface with the EnableAsync
annotation.

Issue: SPR-8995
2014-04-02 15:04:40 +02:00
Stephane Nicoll 119dfd9cf9 Fix cache decoration
Prior to this commit, a cache that is added on-the-fly is not properly
decorated by the provided CacheManager implementation that supports
it (EhCache and JCache).

This commits adds an extra getMissingCache method to
the AbstractCacheManager that can be extended to provide a cache that
may exist in the native cache manager but is not yet known by the
spring abstraction.

Issue: SPR-11518
2014-04-01 14:48:35 +02:00
Stephane Nicoll 3c28301ded Provide common cache config
Prior to this commit, common cache operation settings had to be
repeated for every operation: cache name(s), custom cache manager
and custom key manager.

This commit introduces the @CacheConfig annotation to bet set at
class-level (either directly or as a meta-annotation). As the cache
name(s) can be rationalized there, the "value" of the various
annotations are no longer mandatory.

CacheAnnotationParser has an API breakage to be able to retrieve
information at class-level.

Issue: SPR-11316
2014-03-31 15:20:50 +02:00
Stephane Nicoll 6a8cf28665 polishing 2014-03-31 14:26:05 +02:00
Stephane Nicoll f06cad91c0 Add custom cache manager per cache operation
It is now possible to specify the CacheManager to use per operation.
The related cache annotation now has an extra attribute that defines
the name of the CacheManager bean to use.  The cache manager that
was previously used is therefore a 'default' cache manager (i.e. the
one to use if no custom cache manager has been set on the operation).

Issue: SPR-8696
2014-03-31 14:17:54 +02:00
Stephane Nicoll 81c208098f Custom KeyGenerator
This commit adds an extra parameter to the base @Cache method
annotations: keyGenerator. This parameter holds the name of the
KeyGenerator bean to use to compute the key for that specific
caching endpoint.

This gives therefore a third way to customize the key. These are:
1. Default KeyGenerator (global for all endpoints)
2. The 'key' attribute of the annotation, giving the SpEL expression to use
3. The 'keyGenerator' attribute of the annotation

The annotation attributes are therefore exclusive. Trying to specify
them both will result in an IllegalStateException.

The KeyGenerator to use for a given operation is cached on startup
so that multiple calls to it does not resolve the instance to use over and
over again.

Issue: SPR-10629
2014-03-31 14:15:27 +02:00
Juergen Hoeller b70148c12d Consistent PropertyAccessor method order as declared in the interface
Issue: SPR-11609
2014-03-26 21:47:56 +01:00
Juergen Hoeller 3388573646 AbstractApplicationEventMulticaster only caches if event type and source type are cache-safe
Issue: SPR-11606
2014-03-26 15:29:50 +01:00
Juergen Hoeller 90512f036b Fixed SPR issue reference and aligned exception messages
Issue: SPR-11592
2014-03-26 00:31:38 +01:00
Juergen Hoeller 9fc13e1d23 CacheAspectSupport checks Cache.get(key) once per invocation only
Issue: SPR-11592
2014-03-25 23:56:16 +01:00
Juergen Hoeller 8b73c0affb Added ASM-based tests for custom scoping annotations
Issue: SPR-11574
2014-03-24 11:51:21 +01:00
Juergen Hoeller 3aff973d13 Javadoc: @ComponentScan is subject to @Conditional as well
Issue: SPR-11579
2014-03-21 14:32:57 +01:00
Stephane Nicoll 4cd818b9e4 Harmonize log configuration
Prior to this commit, the codebase was using a mix of log4j.xml
and log4j.properties for test-related logging configuration. This
can be an issue as log4j takes the xml variant first when looking
for a default bootstrap configuration.

In practice, some modules declaring the properties variant were
taking the xml variant configuration from another module.

The general structure of the configuration has also been
harmonized to provide a standard console output as well as an
easy way to enable trace logs for the current module.
2014-03-20 09:43:29 -07:00
Sam Brannen 9cee70ff66 Polish ComponentScanParserTests and clean up warnings 2014-03-20 01:28:59 +01:00
Sam Brannen 99cd2f6098 Support meta-annotation overrides in ASM processing
Prior to this commit, Spring supported meta-annotation attribute
overrides in custom composed annotations with reflection-based
annotation processing but not with ASM-based annotation processing.

This commit ensures that meta-annotation attribute overrides are
supported in AnnotationMetadataReadingVisitor.getAnnotationAttributes().

Issue: SPR-11574
2014-03-19 23:44:13 +01:00
Sam Brannen b640b9fdfe Update TODOs for SPR-11574
Issue: SPR-11574
2014-03-18 18:33:26 +01:00
Sam Brannen 9ce0df89ff Support Class meta-annotation attributes with ASM
Prior to this commit, AnnotationAttributesReadingVisitor treated Class
annotation attributes as Strings instead of Classes. As a result,
look-ups for Class attributes in meta-annotations failed with an
IllegalArgumentException.

This commit fixes this issue by consistently treating Class attributes
as Classes in AnnotationAttributesReadingVisitor.

Issue: SPR-11557
2014-03-18 18:20:15 +01:00
Juergen Hoeller 38e7c4776b Cache.get(key, type) should also work in case of null value found in cache
Issue: SPR-11567
2014-03-18 00:50:59 +01:00
Sam Brannen e7b8a657b4 Add more tests for @ComponentScan as a meta-annotation
Issue: SPR-11557
2014-03-15 15:28:17 +01:00
Sam Brannen f1fbe85ff1 Investigate issue with @ComponentScan as meta-annotation
This commit introduces unit and integration tests that attempt to
reproduce the issue claimed by the reporter in SPR-11557. However, the
tests pass without any problems.

Issue: SPR-11557
2014-03-15 00:04:53 +01:00
Sam Brannen 3d506eb033 Clean up ConfigurationClassPostProcessorTests 2014-03-14 22:34:11 +01:00
Juergen Hoeller 99ea429fd7 Added specific unit test for scoped-proxy target not being an autowire candidate
Issue: SPR-11548
2014-03-14 20:40:24 +01:00
Juergen Hoeller 5308b3e358 Revised naming for prototype inner beans to avoid excessive unique name calculation
Restored original singleton-only adaptInnerBeanName behavior, avoiding endless unique name calculation for every single prototype instance. Non-named inner BeanDefinition objects now suffixed with an identity hex code analogous to non-named XML bean definitions, largely avoiding naming collisions to begin with. After SPR-11246, post-processors can deal with unstable classes per bean name, so occasional collisions aren't a hard problem anymore.

Issue: SPR-11545
2014-03-14 20:38:09 +01:00
Juergen Hoeller 791f58e6be Polishing 2014-03-13 17:31:39 +01:00
Sam Brannen a006ca2542 Remove trailing whitespace 2014-03-13 12:21:32 +01:00
Sam Brannen b364599278 Update links to Spring JIRA server 2014-03-10 12:26:29 +01:00
Juergen Hoeller bcde955ec9 Ignore placeholder resolution failure as well in case of ignoreResourceNotFound=true
Issue: SPR-11524
2014-03-07 13:39:01 +01:00
Juergen Hoeller e50cff47c1 KeyGenerators should not return a plain array parameter as raw key but rather always handle that case in a deepHashCode fashion
Issue: SPR-11505
2014-03-05 17:37:09 +01:00
Stephane Nicoll c146be2eb7 Merge pull request #477 from candrews/patch-1
* patch-1:
  Fix SimpleKey equality with array argument
2014-03-04 14:24:03 +01:00
Craig Andrews 6d8f3a0a20 Fix SimpleKey equality with array argument
Prior to this commit, an array argument was not handled properly in
SimpleKey#equals and SimpleKey#hashCode. As a result, two method
invocations with the same array argument lead to two different keys
and therefore two different entries in the cache.

This commit uses deepEquals and deepHashCode to properly handle
methods that have arguments that are array types.

Issue: SPR-11505
2014-03-04 14:18:11 +01:00
Juergen Hoeller cb41f42791 AbstractApplicationEventMulticaster filters listeners against their type first, avoiding eager retrieval of listener instances for non-matching events
Issue: SPR-11501
2014-03-04 13:31:40 +01:00
Sam Brannen fbdebc1bd6 Clean up warnings that show up in Gradle build 2014-02-26 14:05:26 +01:00
Sam Brannen 1ac08e4a1b Polish Javadoc for ConfigurationClassParser 2014-02-26 02:22:32 +01:00
Sam Brannen ce0d916492 Fix 'method' typo in @PropertySources 2014-02-25 15:56:39 +01:00
Juergen Hoeller 8a96d1a6ee Polishing 2014-02-14 23:40:03 +01:00
Juergen Hoeller 14e5a02870 Mixed polishing along with recent changes 2014-02-14 21:39:40 +01:00
Juergen Hoeller d550ffb37f Clarified CompositeCacheManager's applicability, added convenience constructor with given delegates, and fixed getCacheNames implementation to never return duplicates
Issue: SPR-11427
2014-02-14 01:41:53 +01:00
Sam Brannen 8028eae786 Fix CGLIB memory leak for method injection
This commit continues the work for fixing memory leaks resulting from
CGLIB subclass generation for beans relying on method injection.

- Set proxy callbacks on the CGLIB Factory (i.e., the instance) instead
  of in the generated subclass (i.e., via the Enhancer).

- Convert private inner classes in CglibSubclassingInstantiationStrategy
  to private static classes in order to avoid unnecessary coupling to
  classes generated using CGLIB.

- Tidy up XmlBeanFactoryTests.

- Update logic in serializableMethodReplacerAndSuperclass() so that it
  finally aligns with the decision made for SPR-356.

Issue: SPR-10785, SPR-356
2014-02-13 01:45:41 +01:00
Sam Brannen f2a4537b6c Test against CGLIB memory leak for method injection
This commit introduces a test in XmlBeanFactoryTests that verifies that
CGLIB generated subclasses for method injected beans are reused across
bean factories for identical bean definitions. In other words, by
verifying that the same CGLIB generated class is reused for identical
bean definitions, we can be certain that Spring is no longer generating
identical, duplicate classes that consume memory in the VM.

Issue: SPR-10785, SPR-11420
2014-02-13 00:28:37 +01:00
Juergen Hoeller 949338009b Ignore container callback and marker interfaces for auto-proxy decisions
Issue: SPR-11416
2014-02-12 00:01:20 +01:00
Juergen Hoeller 53aab24690 Polishing 2014-02-09 01:08:56 +01:00
Sam Brannen c335e99e3f Remove trailing whitespace from source code 2014-02-08 17:30:39 +01:00
Sam Brannen 1f778530b5 Polish test classes
- Consistent importing of org.junit.Assert.*;
- Proper declaration of expected exceptions via @Test(expected).
- Renamed SpEL ExpressionTestCase to AbstractExpressionTests.
- Formatting and test method naming conventions.
2014-02-08 17:24:11 +01:00
Juergen Hoeller 8c0e3040c2 Polishing 2014-02-07 18:06:13 +01:00
Juergen Hoeller 749b65b0b2 Polishing 2014-02-07 17:42:37 +01:00
Sam Brannen de5b7a378b Fix grammar and update link in Javadoc for SimpleThreadScope 2014-02-07 12:27:35 +01:00
Dave Brosius cdd2324ab5 fix log spelling typo 2014-02-06 19:58:20 -05:00
Juergen Hoeller 426f52b393 Polishing 2014-02-06 20:35:59 +01:00
Juergen Hoeller 8c4e372558 Introduced SpringNamingPolicy for CGLIB
Issue: SPR-11398
2014-02-06 20:25:11 +01:00
Sam Brannen b8ed2f4967 Ensure all tests are executed in the Gradle build
Prior to this commit several test classes named "*Test" were not
recognized as tests by the Gradle build. This is due to the configured
inclusion of '**/*Tests.*' which follows Spring's naming convention for
test classes.

This commit addresses this issue by:

 - Renaming real test classes consistently to "*Tests".
 - Renaming internal test classes to "*TestCase".
 - Renaming @WebTest to @WebTestStereotype.
 - Disabling broken tests in AnnoDrivenStaticEntityMockingControlTest.
 - Modifying the Gradle build configuration so that classes ending in
   either "*Tests" or "*Test" are considered test classes.

Issue: SPR-11384
2014-02-03 23:16:47 +01:00
Juergen Hoeller 5be8301128 Fixed isMatchingFieldError to properly handle empty field name
Also avoided unnecessary substring creation for field error access with wildcard.

Issue: SPR-11374
2014-01-31 12:47:08 +01:00
Juergen Hoeller c1eac209c3 Fixed LiveBeansView to not produce invalid JSON if last bean is not eligible
Also introducing overridable isBeanEligible template method.

Issue: SPR-11366
2014-01-30 12:26:22 +01:00
Sam Brannen 78542777d6 Introduce value attribute in @RestController
Stereotype annotations should support a 'value' attribute for
specifying the name of the Spring-managed component; however,
@RestController currently does not provide such an attribute.

This commit introduces a 'value' attribute in @RestController so that
developers can provide custom names for components annotated with
@RestController.

Issue: SPR-11360
2014-01-27 12:07:23 +01:00
Juergen Hoeller 61b6d398a5 Removed LocalDateToDateMidnightConverter pre-release since DateMidnight is deprecated as of Joda-Time 2.3; marked DateTimeToDateMidnightConverter as deprecated 2014-01-25 15:26:47 +01:00
Juergen Hoeller eeae5fba95 Fixed regression with constructing TypeDescriptor from null Class
Issue: SPR-11354
2014-01-24 13:16:35 +01:00
Sam Brannen 8faf01f56d Fix "coercion" spelling mistakes in Javadoc 2014-01-23 17:47:35 +01:00
Juergen Hoeller 3310ab55e0 Polishing
Issue: SPR-11344
(cherry picked from commit d434ef9)
2014-01-23 00:10:02 +01:00
Juergen Hoeller 12c393eb6d Switched 'order' attributes across namespaces to 'xsd:token'
Issue: SPR-10886
Issue: SPR-7342
2014-01-22 11:35:21 +01:00
Juergen Hoeller 84310c8a11 RemoteInvocation(Result) explicitly designed for JavaBean-style deserialization
Issue: SPR-11337
2014-01-21 12:49:16 +01:00