Commit Graph

1020 Commits

Author SHA1 Message Date
Sam Brannen fb83e83e78 Honor contract of @Repeatable in AnnotationUtils
Prior to this commit, the implementation of getRepeatableAnnotation()
in Spring's AnnotationUtils complied neither with the contract of
getAnnotationsByType() nor with the contract of
getDeclaredAnnotationsByType() as defined in AnnotatedElement in Java 8.

Specifically, unexpected results can be encountered when using Spring's
support for @Repeatable annotations: either annotations show up in the
returned set in the wrong order, or annotations are returned in the set
that should not even be found based on the semantics of @Repeatable.

This commit remedies this problem by deprecating the existing
getRepeatableAnnotation() methods and replacing them with new
getRepeatableAnnotations() and getDeclaredRepeatableAnnotations()
methods that comply with the contracts of Java's getAnnotationsByType()
and getDeclaredAnnotationsByType(), respectively.

Issue: SPR-13068
2015-06-20 01:21:39 +02:00
Sam Brannen 6c530b7bfb Delete trailing whitespace in XML files 2015-06-19 17:14:10 +02:00
Juergen Hoeller f1c7dc4f4b Introduced SimpleTransactionScope (analogous to SimpleThreadScope)
Issue: SPR-13085
2015-06-18 00:29:46 +02:00
Juergen Hoeller d7f8fa50be Polishing 2015-06-16 22:01:58 +02:00
Juergen Hoeller 92f1754b1e Fixed fallback mode in ObjenesisCglibAopProxy, plus consistent support for bypassing Objenesis (e.g. on Google App Engine)
This 4.2 commit revises SpringObjenesis towards a smart delegate, including support for a "spring.objenesis.ignore" system property.

Issue: SPR-13131
2015-06-16 22:01:37 +02:00
Stephane Nicoll 75c88ffbeb Remove deprecated warnings 2015-06-16 15:23:56 +02:00
Juergen Hoeller c41779f895 AsyncExecutionInterceptor supports Java 8's CompletableFuture as a return type
Issue: SPR-13128
2015-06-15 20:35:48 +02:00
Juergen Hoeller 06a5ed9cae AbstractApplicationContext resets common introspection caches after refresh
Issue: SPR-13093
2015-06-15 20:34:46 +02:00
Juergen Hoeller 10cb80a500 Removed superfluous @Ignore import
Issue: SPR-11807
2015-06-15 15:57:10 +02:00
Juergen Hoeller 1c01f575c2 ConfigurationClassParser ignores unresolvable member classes
Issue: SPR-13115
2015-06-15 15:46:14 +02:00
Stephane Nicoll 95acf8c989 Remove references to codehaus.org
Issue: SPR-13129
2015-06-15 15:44:29 +02:00
Sam Brannen 32c17bf540 Revise method and parameter names in annotation support
In AnnotatedElementUtils, all methods pertaining to merging annotation
attributes have been renamed to "getMerged*()" and "findMerged*()"
accordingly. Existing methods such as getAnnotationAttributes(..) have
been deprecated in favor of the more descriptive "merged" variants.
This aligns the naming conventions in AnnotatedElementUtils with those
already present in AnnotationReadingVisitorUtils.

The use of "annotationType" as a variable name for the fully qualified
class name of an annotation type has been replaced with
"annotationName" in order to improve the readability and intent of the
code base.

In MetaAnnotationUtils.AnnotationDescriptor, getMergedAnnotation() has
been renamed to synthesizeAnnotation(), and the method is now
overridden in UntypedAnnotationDescriptor to always throw an
UnsupportedOperationException in order to avoid potential run-time
ClassCastExceptions.

Issue: SPR-11511
2015-06-14 00:34:40 +02:00
Sam Brannen 60cdfa535e Polish ComponentScanParserScopedProxyTests 2015-06-13 16:09:03 +02:00
Sam Brannen 2d23f42609 Introduce alias for 'value' attribute in @Scope
Issue: SPR-11393
2015-06-13 16:07:29 +02:00
Juergen Hoeller 75edb3979e AspectJExpressionPointcut defensively catches exceptions thrown from ShadowMatch.matchesJoinPoint
Issue: SPR-13102
2015-06-11 14:44:19 +02:00
Juergen Hoeller e97506be55 Member classes get exposed to the import stack now
Issue: SPR-13101
2015-06-11 09:56:03 +02:00
Juergen Hoeller b02352d30f Enabled test for AspectJ pointcut matching against lambda-defined bean
Issue: SPR-11807
2015-06-10 15:03:06 +02:00
Stephane Nicoll b87816ed20 Add ResolvableTypeProvider
Provide a mean to detect the actual ResolvableType based on a instance as
a counter measure to type erasure.

Upgrade the event infrastructure to detect if the event (or the payload)
implements such interface. When this is the case, the return value of
`getResolvableType` is used to validate its generic type against the
method signature of the listener.

Issue: SPR-13069
2015-06-09 10:57:31 +02:00
Stephane Nicoll e8441edcb7 Remove commons pool 2.x workaround
While working on SPR-12532, an extra IdentityWrapper was added to work
around a backward compatible issue between commons pool 1.x and 2.x. This
issue (POOL-283) has actually been fixed in 2.4 and their IdentityWrapper
is using object equality so our wrapper is in the way.

Looking retrospectively, the code looks all fine without the workaround
and commons pool 2.4 or later so it has been removed.
2015-06-05 16:41:21 +02:00
Juergen Hoeller 869b0bc7ee Create enhanced FactoryBean instance before applying method interceptor (preferably via Objenesis)
Also removes "throws Exception" declaration from ThreadPoolExecutorFactoryBean's getObject method.

Issue: SPR-13095
2015-06-05 00:09:42 +02:00
Juergen Hoeller d195ad216a Polishing 2015-06-04 23:27:40 +02:00
Juergen Hoeller 9410dff99c AsyncResult allows for exposing an execution exception
Issue: SPR-13076
2015-06-04 23:25:18 +02:00
Sam Brannen 0db948e72d Polish Javadoc for @Scope 2015-06-04 15:42:15 -04:00
Sam Brannen ff8597fa80 Introduce alias for 'value' attribute in @ComponentScan.Filter
Issue: SPR-11393
2015-06-04 15:25:20 -04:00
Sam Brannen 39e820b4bf Polish Javadoc for @ComponentScan 2015-06-04 15:20:37 -04:00
Sam Brannen d4ee75ddf0 Log correct class name for introspection failure
Issue: SPR-13091
2015-06-03 21:31:12 -04:00
Sam Brannen d3b5aeb768 Introduce alias for 'value' attribute in @ImportResource
Issue: SPR-11393
2015-06-03 21:26:43 -04:00
Sam Brannen e5dc6e964c Introduce getAliasedStringArray() in AnnotationAttributes
Issue: SPR-11393
2015-06-03 21:26:43 -04:00
Stephane Nicoll 08c032d9fd Allow Cache annotations to not specify any cache name
Since Spring 4.1, a CacheResolver may be configured to customize the way
the cache(s) to use for a given cache operation are retrieved. Since a
CacheResolver implementation may not use the cache names information at
all, this attribute has been made optional.

However, a fix was still applied, preventing a Cache operation without a
cache name to be defined properly. We now allow this valid use case.

Issue: SPR-13081
2015-06-03 11:42:49 +02:00
Juergen Hoeller 4f1286a4c3 Lite configuration candidate check defensively handles method introspection failure
Issue: SPR-13091
2015-06-02 14:18:00 +02:00
Juergen Hoeller 11401bd5e4 Upgrade to Hibernate ORM 5.0 RC1 and Hibernate Validator 5.2 RC1
Includes other recent dependency updates (JRuby 1.7.20, Jetty 9.2.11, Tomcat 8.0.23, Reactor 2.0.3)

Issue: SPR-13088
2015-06-01 18:35:57 +02:00
Sam Brannen 81844191f8 Polish Javadoc for @ImportResource 2015-05-31 23:06:15 +02:00
Sam Brannen 4dffeeee64 Introduce alias for 'value' attribute in caching annotations
This commit introduces new 'cacheNames' attributes (analogous to the
existing attribute of the same name in @CacheConfig) as aliases for the
'value' attributes in @Cacheable, @CachePut, and @CacheEvict.

In addition, SpringCacheAnnotationParser.getAnnotations() has been
refactored to support synthesized annotations.

Issue: SPR-11393
2015-05-31 22:52:01 +02:00
Sam Brannen de06f422f3 Polish Javadoc for caching annotations 2015-05-31 22:51:53 +02:00
Sam Brannen 845f4f2bb7 Improve attribute alias support in @ComponentScan
Prior to this commit, @ComponentScan already had a value/basePackages
alias pair; however, the semantics were not properly enforced.

This commit addresses this issue by refactoring
ComponentScanAnnotationParser to ensure that it is not possible to
declare both of the aliased attributes. In addition, the 'value' and
'basePackages' attributes are now annotated with @AliasFor in order to
make the semantics clearer.

Issue: SPR-11393
2015-05-31 15:39:15 +02:00
Sam Brannen 94aa90646b Polish Javadoc for @ComponentScan 2015-05-31 15:32:56 +02:00
Sam Brannen e30c9b2ef3 Synthesize annotation from a map of attributes
Spring Framework 4.2 RC1 introduced support for synthesizing an
annotation from an existing annotation in order to provide additional
functionality above and beyond that provided by Java. Specifically,
such synthesized annotations provide support for @AliasFor semantics.
As luck would have it, the same principle can be used to synthesize an
annotation from any map of attributes, and in particular, from an
instance of AnnotationAttributes.

The following highlight the major changes in this commit toward
achieving this goal.

- Introduced AnnotationAttributeExtractor abstraction and refactored
  SynthesizedAnnotationInvocationHandler to delegate to an
  AnnotationAttributeExtractor.

- Extracted code from SynthesizedAnnotationInvocationHandler into new
  AbstractAliasAwareAnnotationAttributeExtractor and
  DefaultAnnotationAttributeExtractor implementation classes.

- Introduced MapAnnotationAttributeExtractor for synthesizing an
  annotation that is backed by a map or AnnotationAttributes instance.

- Introduced a variant of synthesizeAnnotation() in AnnotationUtils
  that accepts a map.

- Introduced findAnnotation(*) methods in AnnotatedElementUtils that
  synthesize merged AnnotationAttributes back into an annotation of the
  target type.

The following classes have been refactored to use the new support for
synthesizing AnnotationAttributes back into an annotation.

- ApplicationListenerMethodAdapter
- TestAnnotationUtils
- AbstractTestContextBootstrapper
- ActiveProfilesUtils
- ContextLoaderUtils
- DefaultActiveProfilesResolver
- DirtiesContextTestExecutionListener
- TestPropertySourceAttributes
- TestPropertySourceUtils
- TransactionalTestExecutionListener
- MetaAnnotationUtils
- MvcUriComponentsBuilder
- RequestMappingHandlerMapping

In addition, this commit also includes changes to ensure that arrays
returned by synthesized annotations are properly cloned first.

Issue: SPR-13067
2015-05-29 01:38:51 +02:00
Juergen Hoeller c622f4c487 Polishing 2015-05-23 22:24:10 +02:00
Sam Brannen ca66e076d1 Support annotation attribute aliases and overrides via @AliasFor
This commit introduces first-class support for aliases for annotation
attributes. Specifically, this commit introduces a new @AliasFor
annotation that can be used to declare a pair of aliased attributes
within a single annotation or an alias from an attribute in a custom
composed annotation to an attribute in a meta-annotation.

To support @AliasFor within annotation instances, AnnotationUtils has
been overhauled to "synthesize" any annotations returned by "get" and
"find" searches. A SynthesizedAnnotation is an annotation that is
wrapped in a JDK dynamic proxy which provides run-time support for
@AliasFor semantics. SynthesizedAnnotationInvocationHandler is the
actual handler behind the proxy.

In addition, the contract for @AliasFor is fully validated, and an
AnnotationConfigurationException is thrown in case invalid
configuration is detected.

For example, @ContextConfiguration from the spring-test module is now
declared as follows:

    public @interface ContextConfiguration {

        @AliasFor(attribute = "locations")
        String[] value() default {};

        @AliasFor(attribute = "value")
        String[] locations() default {};

        // ...
    }

The following annotations and their related support classes have been
modified to use @AliasFor.

- @ManagedResource
- @ContextConfiguration
- @ActiveProfiles
- @TestExecutionListeners
- @TestPropertySource
- @Sql
- @ControllerAdvice
- @RequestMapping

Similarly, support for AnnotationAttributes has been reworked to
support @AliasFor as well. This allows for fine-grained control over
exactly which attributes are overridden within an annotation hierarchy.
In fact, it is now possible to declare an alias for the 'value'
attribute of a meta-annotation.

For example, given the revised declaration of @ContextConfiguration
above, one can now develop a composed annotation with a custom
attribute override as follows.

    @ContextConfiguration
    public @interface MyTestConfig {

        @AliasFor(
           annotation = ContextConfiguration.class,
           attribute = "locations"
        )
        String[] xmlFiles();

        // ...
    }

Consequently, the following are functionally equivalent.

- @MyTestConfig(xmlFiles = "test.xml")
- @ContextConfiguration("test.xml")
- @ContextConfiguration(locations = "test.xml").

Issue: SPR-11512, SPR-11513
2015-05-22 00:01:07 +02:00
Elizabeth Chatman 5652f02af0 Fix number parsing of @Scheduled attributes
See gh-801
2015-05-20 20:41:29 +02:00
Stephane Nicoll 0ed9ca097b Customize destruction callback for AutoCloseable beans
Previously, a Bean implementing `AutoCloseable` (or `Closeable`) was
always destroyed regardless of its bean definition. In particular, the
documented way of disabling the destruction callback via an empty String
did not work.

AutoCloseable beans are now treated pretty much as any other bean: we
still use the presence of the interface to optimize the check of a
destroy method and we only auto-discover the method name to invoke if
the inferred mode is enabled.

Issue: SPR-13022
2015-05-20 17:19:42 +02:00
Juergen Hoeller 271804f105 Polishing 2015-05-20 15:35:11 +02:00
Juergen Hoeller de893ada2b Compatibility with JSR-354 final (and its new Monetary singleton)
Includes support for currency detection with @NumberFormat.

Issue: SPR-12209
2015-05-20 15:15:29 +02:00
Juergen Hoeller b4095c3e1d Class identity comparisons wherever possible
Issue: SPR-12926
2015-05-20 14:34:16 +02:00
Stephane Nicoll cf391f5ce1 polish
Remove unused imports
2015-05-19 08:49:01 +02:00
Juergen Hoeller 6418b54f81 DataBinder tries ConversionService if PropertyEditor could not produce required type
Issue: SPR-13042
2015-05-18 23:53:39 +02:00
Sam Brannen 03ade48d68 Expound on inheritance semantics for @Conditional
Issue: SPR-11598
2015-05-13 16:06:36 +02:00
Juergen Hoeller ef7cf2c650 Revised description of event source parameter
Issue: SPR-13021
2015-05-13 14:58:02 +02:00
Juergen Hoeller 02da2e85ee DataBinder allows for adding custom Formatters as alternative to PropertyEditors (including per-field formatters)
Includes a generic FormatterPropertyEditorAdapter plus Number conversion support in TypeConverterDelegate.

Issue: SPR-7773
Issue: SPR-6069
2015-05-12 22:33:18 +02:00
Juergen Hoeller 64a01d64c5 Polishing 2015-05-11 14:42:45 +02:00
Philippe Marschall 994d86992c Avoid eager formatting in pre-condition checks
In general, the Spring Framework aims to construct error message
strings only if an actual error has occurred. This seems to be the
common pattern in the codebase and saves both CPU and memory. However,
there are some places where eager error message formatting occurs
unnecessarily.

This commit addresses this issue in the following classes:
AdviceModeImportSelector, AnnotationAttributes, and
ReadOnlySystemAttributesMap.

The change in ReadOnlySystemAttributesMap also avoids a potential
NullPointerException.

Issue: SPR-13007
2015-05-10 12:36:01 +02:00
Juergen Hoeller 1722fa6678 JSR-223 based StandardScriptFactory (including <lang:std> support)
This commit also completes 4.2 schema variants in spring-context.

Issue: SPR-5215
2015-05-08 23:56:08 +02:00
Sam Brannen 4bf32578b5 Rename MethodBasedEvaluationContextTest to *Tests 2015-05-08 18:44:49 +02:00
Juergen Hoeller dbd82d128d Polishing 2015-05-07 20:18:17 +02:00
Juergen Hoeller e87dc9f82d Test for AspectJ pointcuts with lambdas (currently marked as ignored)
Issue: SPR-11807
2015-05-07 19:59:54 +02:00
Juergen Hoeller 1cc042d4c7 Polishing 2015-05-07 16:03:15 +02:00
Sam Brannen 7a690df925 Remove trailing whitespace from Java source code 2015-05-06 20:08:42 +02:00
Sam Brannen 2015781ea1 Rename duplicate EnvironmentIntegrationTests to EnvironmentSystemIntegrationTests 2015-05-06 15:55:20 +02:00
Stephane Nicoll b8f10f69a9 Fix binary compatibility for SmartApplicationListener
Making sure that `GenericApplicationListenerAdapter` implements
`SmartApplicationListener` again as older code may try to cast an
instance to `SmartApplicationListener`.

Issue: SPR-8201
2015-05-06 08:52:47 +09:00
Sam Brannen 572cbb0821 Consistently supply test name to @Parameters 2015-05-05 14:07:00 +02:00
Juergen Hoeller 706d3adf07 Consistently throw IllegalStateException from getAutowireCapableBeanFactory()
Issue: SPR-12932
2015-04-24 23:20:43 +02:00
Sam Brannen 122d3476d9 Polish Javadoc for condition annotation attributes 2015-04-24 01:38:13 +02:00
Sam Brannen ad6bea1cda Support abstract, bridge, & interface methods in AnnotatedElementUtils
This commit introduces support for finding annotations on abstract,
bridge, and interface methods in AnnotatedElementUtils.

 - Introduced dedicated findAnnotationAttributes() methods in
   AnnotatedElementUtils that provide first-class support for
   processing methods, class hierarchies, interfaces, bridge methods,
   etc.

 - Introduced find/get search algorithm dichotomy in
   AnnotatedElementUtils which is visible in the public API as well as
   in the internal implementation. This was necessary in order to
   maintain backwards compatibility with the existing API (even though
   it was undocumented).

 - Reverted all recent changes made to the "get semantics" search
   algorithm in AnnotatedElementUtils in order to ensure backwards
   compatibility, and reverted recent changes to
   JtaTransactionAnnotationParser and SpringTransactionAnnotationParser
   accordingly.

 - Documented internal AnnotatedElementUtils.Processor<T> interface.

 - Enabled failing tests and introduced
   findAnnotationAttributesFromBridgeMethod() test in
   AnnotatedElementUtilsTests.

 - Refactored ApplicationListenerMethodAdapter.getCondition() and
   enabled failing test in TransactionalEventListenerTests.

 - AnnotationUtils.isInterfaceWithAnnotatedMethods() is now package
   private.

Issue: SPR-12738, SPR-11514, SPR-11598
2015-04-24 00:55:48 +02:00
Sam Brannen e0d2dbd21d Polish Javadoc & TODOs in ApplicationListenerMethodAdapter
Issue: SPR-12738
2015-04-23 01:33:47 +02:00
Sam Brannen 86733a98da Polish ApplicationListenerMethodAdapter 2015-04-22 02:54:23 +02:00
Juergen Hoeller 9ed0a56d84 AbstractApplicationContext collects early ApplicationEvents and publishes them once the multicaster is available
Issue: SPR-12902
2015-04-16 18:16:15 +02:00
Juergen Hoeller aa49949d7a Bean type mismatch check accepts assignable values according to ClassUtils
Issue: SPR-12905
2015-04-16 18:15:33 +02:00
Juergen Hoeller e403aefe86 Proper exception in case of an @Bean method call encountering a bean type mismatch
Issue: SPR-12905
2015-04-15 23:37:51 +02:00
Juergen Hoeller 1da98b0542 @Bean-returned FactoryBean proxy delegates to actual target instance now
Issue: SPR-12915
2015-04-15 22:49:53 +02:00
Sam Brannen 96e6406b4b Clarify semantics for multiple profiles in @Profile 2015-04-15 21:56:31 +02:00
Juergen Hoeller fafb823e8d Polishing 2015-04-15 15:13:42 +02:00
Stephane Nicoll e5b505224b Improve exception message
Issue: SPR-12898
2015-04-10 09:20:51 +02:00
Stephane Nicoll 6bc14cc7ae Add cache-related logs
Add a trace log for cache hit and cache miss events.

Issue: SPR-11654
2015-04-07 14:27:43 +02:00
Juergen Hoeller 595cdf05e9 Polishing 2015-04-04 00:23:25 +02:00
Juergen Hoeller e1395a6c68 Avoid repeated exposure of SpringProxy/Advised for fallback interfaces as well
Issue: SPR-12870
2015-04-01 18:54:47 +02:00
Juergen Hoeller 2c637dcb2e ReaderEditor supports Reader injection analogous to InputStreamEditor (from Spring resource location)
Also, EncodedResource implements InputStreamSource now since it declares getInputStream() anyway.

Issue: SPR-12876
2015-04-01 17:02:55 +02:00
Juergen Hoeller ceb17fcaca CronSequenceGenerator explicitly rejects invalid incrementer delta
Issue: SPR-12871
2015-04-01 16:45:24 +02:00
Juergen Hoeller f9c2d1d171 DefaultAopProxyFactory falls back to JdkDynamicAopProxy when encountering JDK proxy as target
Issue: SPR-12870
2015-03-31 16:15:22 +02:00
Juergen Hoeller a15dc08bea @Import allows for importing regular component classes as well
Issue: SPR-11740
2015-03-31 11:39:20 +02:00
Juergen Hoeller 14c891c3b3 MethodValidationPostProcessor provides protected createMethodValidationAdvice template method
Issue: SPR-12863
2015-03-31 10:12:35 +02:00
Juergen Hoeller 7e22623758 Clarification: Lifecycle does not imply auto-startup semantics
Issue: SPR-12855
2015-03-30 21:06:12 +02:00
Juergen Hoeller beae336627 Polishing 2015-03-25 15:22:41 +01:00
Stephane Nicoll 314b069fd8 Only require an exception CacheResolver if necessary
Previously, a cache infrastructure with only a CacheResolver would have
worked fine until the JSR-107 API is added to the classpath. When this is
the case, the JCache support kicks in and an exception cache resolver is
all of the sudden required.

The CacheResolver _is_ different as the default implementation does look
different attributes so if a custom CacheResolver is set, it is not
possible to "reuse" it as a fallback exception CacheResolver.

Now, an exception CacheResolver is only required if a JSR-107 annotation
with an "exceptionCacheName" attribute is processed (i.e. the exception
CacheResolver is lazily instantiated if necessary).

The use case of having a CachingConfigurerSupport with only a
CacheResolver was still broken though since the JCache support only looks
for a JCacheConfigurer bean (per the generic type set on
AbstractCachingConfiguration). This has been fixed as well.

Issue: SPR-12850
2015-03-25 15:12:08 +01:00
Juergen Hoeller d23893fd25 Consistent javadoc param declarations for type variables 2015-03-25 00:44:01 +01:00
Juergen Hoeller b2308926bc Restored isTypeMatch null behavior and refined typeToMatch parameter name
Issue: SPR-12147
2015-03-23 21:57:03 +01:00
Juergen Hoeller 1a8c6fa5ee Deferred import processing reliably detects late registration attempts
Issue: SPR-12838
2015-03-23 19:58:02 +01:00
Juergen Hoeller 192462902e Consistent support for Java 8 default methods (in interfaces implemented by user classes)
Covers ReflectionUtils.doWithMethods as well as affected annotation post-processors.
Includes an extension of MethodMetadata for the detection of @Bean default methods.

Issue: SPR-12822
Issue: SPR-10919
2015-03-19 16:50:15 +01:00
Juergen Hoeller 778a01943b ResolvableType-based type matching at the BeanFactory API level
Issue: SPR-12147
2015-03-18 23:05:13 +01:00
Juergen Hoeller a3e5fbf5ed Revised DefaultManagedAwareThreadFactory to make its non-JNDI fallback work
Issue: SPR-12830
2015-03-18 21:21:46 +01:00
Juergen Hoeller c43acd7675 SpringValidatorAdapter allows for fine-tuning the FieldError representation
Issue: SPR-12819
2015-03-16 21:01:18 +01:00
Juergen Hoeller 768f6e836a Bean class name may contain SpEL expression for late resolution
Issue: SPR-12817
2015-03-16 20:53:41 +01:00
Juergen Hoeller 6c169bd644 Initial support for JSR-354 Money & Currency
Issue: SPR-12209
2015-03-13 19:40:00 +01:00
Juergen Hoeller 13659d645b Consistent support for @Order annotation as alternative to Ordered interface
Issue: SPR-12806
2015-03-13 18:18:33 +01:00
Juergen Hoeller f5b4e18209 @Configuration classes get processed according to their @Order (if applicable)
Issue: SPR-12657
2015-03-13 18:18:21 +01:00
Juergen Hoeller 9d497cbd98 @Bean definitions override scanned classes, plus check whether overriding is actually allowed
Issue: SPR-9567
Issue: SPR-9682
2015-03-13 18:18:06 +01:00
Stephane Nicoll 8f8a85912a Call AsyncUncaughtExceptionHandler when necessary
If a sub-class of Future (such as ListenableFuture) is used as a return
type and an exception is thrown, the AsyncUncaughtExceptionHandler is
called. Now checking for any Future implementation instead of a faulty
strict matching.

Issue: SPR-12797
2015-03-09 09:57:53 +01:00
Sam Brannen d90cee78ef Remove trailing whitespace in source code 2015-03-07 21:16:18 +01:00
Kazuki Shimizu c746b10da9 Support @NumberFormat as a meta-annotation
This commit ensures that @NumberFormat can be used as a
meta-annotation, as was already the case for @DateTimeFormat.

In addition, this commit polishes FormattingConversionServiceTests and
MvcNamespaceTests.

Issue: SPR-12743
2015-03-07 21:00:25 +01:00
Sam Brannen 789d904658 Assume TestGroup.PERFORMANCE for AnnotationProcessorPerformanceTests
This commit applies the TestGroup.PERFORMANCE assumption for all test
methods within AnnotationProcessorPerformanceTests.
2015-03-07 15:43:09 +01:00
Juergen Hoeller 71cdf856e1 (Reloadable)ResourceBundleMessageSource allows for custom PropertyResourceBundle/Properties subclasses
Issue: SPR-12666
2015-03-06 17:45:37 +01:00
Juergen Hoeller b541fc9366 Polishing 2015-03-05 18:56:57 +01:00
Stephane Nicoll 772a26a743 polishing
Issue: SPR-12761
2015-03-05 15:36:08 +01:00
Stephane Nicoll 31df7155ab Refine BeanPostProcessorChecker condition
Previously, adding `@EnableAsync` on a blank application would lead to an
info message stating that `ProxyAsyncConfiguration` is not eligible for
getting processed by all BeanPostProcessors. Concretely, this is ok as
such internal configuration is not meant to be a target of such post
processing.

Revisit the condition for non infrastructure bean only. Add the
infrastructure role to a set of internal configuration, including the
`ProxyAsyncConfiguration`.

Issue: SPR-12761
2015-03-05 11:37:11 +01:00
Juergen Hoeller fdd1f83639 Polishing
(cherry picked from commit 3783591)
2015-03-02 22:05:16 +01:00
Juergen Hoeller ab2c721875 LoadTimeWeavingConfiguration should not rely on private field injection
Issue: SPR-12776
(cherry picked from commit 1259671)
2015-03-02 21:58:01 +01:00
Sam Brannen 7edc7c2c8f Fully support XML config in GroovyBeanDefinitionReader
Prior to this commit, the GroovyBeanDefinitionReader claimed (via its
Javadoc) that it fully supported XML configuration files in addition to
its Groovy DSL; however, this was unfortunately inaccurate since XML
validation was disabled by default which led to certain features of XML
configuration not working. For example, it was impossible to define a
<qualifier> in an XML config file without specifying the 'type'
attribute (which has a default value defined in the spring-beans XSD).

This commit fixes this issue by ensuring that bean definitions in XML
resources are loaded with a "standard" XmlBeanDefinitionReader that is
created with default settings (i.e., with XML validation enabled). With
regard to backwards compatibility, bean definitions defined using the
Groovy DSL are still loaded with an XmlBeanDefinitionReader that has
XML validation disabled by default which is necessary for proper
parsing of the Groovy DSL.

Issue: SPR-12769
2015-02-28 23:12:13 +01:00
Stephane Nicoll babbf6e871 Harmonize resources location
Issue: SPR-12766
2015-02-28 10:32:40 +01:00
Juergen Hoeller 2b3409461f Polishing 2015-02-27 22:29:42 +01:00
Sam Brannen fcd60b269e Polish ScheduledTaskRegistrar(Tests) 2015-02-27 19:26:17 +01:00
Juergen Hoeller 81102deedf Avoid potential deadlocks between event multicaster and singleton registry through shared lock
Issue: SPR-12739
2015-02-26 18:35:06 +01:00
Juergen Hoeller 09fde31732 Support for Hibernate Validator 5.2
Issue: SPR-12758
2015-02-26 18:33:53 +01:00
Juergen Hoeller 626748d718 Renamed ScheduledTaskRegistrarTest to ScheduledTaskRegistrarTests
Issue: SPR-12748
2015-02-26 18:33:37 +01:00
Tobias Montagna-Hay 64467b4f59 Provide accessors to scheduled tasks
Updated ScheduledTaskRegistrar to offer accessors to the tasks
it is responsible to schedule.

Issue: SPR-12748
2015-02-26 14:05:45 +01:00
Stephane Nicoll dff2a3d180 Reduce logging level of EventListenerMethodProcessor
Reduce logging level when no target annotation is found a on bean. For
consistency, update ScheduledAnnotationBeanPostProcessor and
JmsListenerAnnotationBeanPostProcessor that define the same log
statement.

Issue: SPR-12574
2015-02-26 13:33:19 +01:00
Juergen Hoeller bb5b5d52ed Revised condition override check based on method names instead of bean names
Issue: SPR-12744
2015-02-25 18:45:28 +01:00
Sam Brannen c3408d869c @NumberFormat & @DateTimeFormat are now @Documented 2015-02-23 23:34:55 +02:00
Juergen Hoeller e3d1a1dda2 @Resource injection points support @Lazy as well
Issue: SPR-12654
2015-02-20 21:53:34 +01:00
Stephane Nicoll 152a7b645f Support for Collection-based return type
If an `@EventListener` annotated method returns a Collection or an Array,
each individual items are now published as an event instead of publishing
one event with said collection.

Issue: SPR-12733
2015-02-20 09:40:16 +01:00
Stephane Nicoll 8fcbdaee24 Handle receive timeout in JmsInvokerClientInterceptor
JmsInvokerClientInterceptor defines a receiveTimeout field but does not
handle such timeout. This commit adds an additional callback that throws
an RemoteTimeoutException instead.

Sub-classes can override the onReceiveTimeout to throw a different
exception or return a fallback RemoteInvocationResult.

Issue: SPR-12731
2015-02-19 17:13:48 +01:00
Stephane Nicoll aabf73dea4 Add Commons Pool 2 support
Deprecated CommonsPoolTargetSource (supporting commons pool 1.5+) in
favor of CommonsPool2TargetSource with a similar contract.

Commons Pool 2.x uses object equality while Commons Pool 1.x used
identity equality. This clearly means that Commons Pool 2 behaves
differently if several instances having the same identity according to
their `Object#equals(Object)` method are managed in the same pool. To
provide a smooth upgrade, a backward-compatible pool is created by
default; use `setUseObjectEquality(boolean)` if you need the standard
Commons Pool 2.x behavior.

Issue: SPR-12532
2015-02-19 13:07:04 +01:00
Stephane Nicoll 1aec6a6cc2 Detect Order on target class as well
Previously, the `@Order` annotation was managed in an inconsistent way
when placed at the implementation level. For simple beans, it was
discovered properly but wasn't for beans requiring a proxy.

OrderComparator.SourceProvider now explicitly allows to return several
order sources; the default implementation returns not only the factory
method (if  any) but also the target class if it happens to be different
from the class of the bean.

Issue: SPR-12636
2015-02-19 09:47:20 +01:00
Juergen Hoeller 1273c90a64 ScheduledAnnotationBeanPostProcessor uses target class as cache key in case of proxy
Issue: SPR-12709
2015-02-18 16:16:05 +01:00
Stephane Nicoll 8eb7beebc8 Order ApplicationListener using @Order
AnnotationListener implementations can now be ordered either using the
`@Order` annotation or by implementing the Ordered interface.

Issue: SPR-12410
2015-02-16 10:41:26 +01:00
Stephane Nicoll 66735d01cf Add exception-handler attribute support for AspectJ
Previously, the exception-handler attribute was not taken care of when
task:annotation-driven is used in AspectJ mode. This commit provides the
expected behavior.

Issue: SPR-12619
2015-02-12 15:25:51 +01:00
Juergen Hoeller 058714b03a Polishing 2015-02-10 19:30:59 +01:00
Juergen Hoeller 981aefc2c0 Properly honor conditions on overriding bean methods
Issue: SPR-12694
2015-02-10 19:26:19 +01:00
Stephane Nicoll 6b3092c236 Clear expression caches on context shutdown
Issue: SPR-12691
2015-02-10 14:47:15 +01:00
Stephane Nicoll 37c04bd9c8 Fix usage of Java8 API 2015-02-10 09:47:34 +01:00
Stephane Nicoll 4741a12fdc Support for transactional event listener
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
2015-02-10 09:14:33 +01:00
Stephane Nicoll f0fca890bb Annotation-based event listeners
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
2015-02-10 09:13:02 +01:00
Stephane Nicoll 6d6422acde Support for generics-based events
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
2015-02-10 09:08:12 +01:00
Stephane Nicoll 982f9ce6c9 Allow MBeans to be excluded additively
Previously, one could only set the list of bean names to exclude from
auto-detection and there was no way to add additional bean names.

MBeanExporter now exposes a addExcludedBean method that can be invoked
during the initialization phase to add bean names to ignore.

Issue: SPR-12686
2015-02-09 09:41:03 +01:00
Stephane Nicoll c7b324b89b Move cached expression evaluation abstraction
Move MethodCacheKey and related classes to the expression package so that
other parts of the framework can benefit ot it.

CacheExpressionEvaluator is a base class that can be used to cache SpEL
expressions based on its annotation source (i.e. method). Sub-classing
that base class provides a simple to use API to retrieve Expression
instances efficiently.

Issue: SPR-12622
2015-01-26 14:44:14 +01:00
Juergen Hoeller 0479ca68fe ScheduledAnnotationBeanPostProcessor registers tasks in ContextRefreshedEvent phase (again)
Issue: SPR-12641
2015-01-22 18:42:30 +01:00
Sam Brannen 7a6dfe3765 Make MBeanServer integration tests more robust
This commit overhauls several of the tests that interact with an
MBeanServer with the goal of increasing the reliability of these tests.

 - MBeanClientInterceptorTests now uses JUnit "assumptions" instead of
   preemptively returning from test methods, thus allowing such methods
   to be properly marked as "ignored" instead of "passed".

 - MBeanClientInterceptorTests now uses JUnit's support for expected
   exceptions where appropriate.

 - MBeanClientInterceptorTests and RemoteMBeanClientInterceptorTests now
   use Spring's SocketUtils to find an available TCP port when starting
   an MBeanServer instead of aborting the tests when the default JMX
   port is not available.

Issue: SPR-12601
2015-01-12 12:19:11 +01:00
Sam Brannen 08f3a79821 Fix broken test in EnableSchedulingTests
Commit 65d163e changed the textual message of an exception thrown by
ScheduledAnnotationBeanPostProcessor.afterSingletonsInstantiated(), and
this in turn caused the withAmbiguousTaskSchedulers_andSingleTask()
method in EnableSchedulingTests to start failing (albeit only during
'Performance' builds).

This commit updates the assertion to match the current implementation of
ScheduledAnnotationBeanPostProcessor.
2015-01-10 22:30:06 +01:00
Juergen Hoeller 9ac02b319d Remove pre-3.2 deprecated classes and methods
Issue: SPR-12578
2014-12-30 20:05:15 +01:00
Juergen Hoeller 1cefeb2af0 Prevent NPE in AbstractApplicationEventMulticaster's non-caching code path
Issue: SPR-12545
2014-12-30 10:01:58 +01:00
Juergen Hoeller bc075c713f Polishing 2014-12-29 20:34:18 +01:00
Juergen Hoeller 6f2de283c4 Doc: base-packages can be comma/semicolon/space/tab/linefeed-separated
Issue: SPR-12523
2014-12-29 13:39:48 +01:00
Juergen Hoeller 0919a15f91 Spring's JMX support can rely on native MXBean detection on Java 6+
Issue: SPR-12574
2014-12-29 13:26:32 +01:00
Juergen Hoeller d4a5059097 AnnotationJmxAttributeSource uses AnnotationUtils for consistent meta-annotation handling and diagnostics
Issue: SPR-12572
2014-12-29 13:17:49 +01:00
Stephane Nicoll cae217de94 Handle scoped proxy properly in MBeanExporter
Previously, if a bean has a scoped proxy and is annotated to be exposed
to the JMX domain, both the scoped proxy and the target instance were
exposed in the JMX domain, resulting in a duplicate entries. Worse, if
such bean defines an explicit name, the application wouldn't start
because of a name conflict.

This commit deals explicitely with scoped proxy and make sure to only
expose the relevant bean.

Issue: SPR-12529
2014-12-23 16:03:52 +01:00
Juergen Hoeller 809ee0d350 Annotation post-processors clear old InjectionMetadata registrations on refresh
Issue: SPR-12526
2014-12-23 14:02:00 +01:00
Juergen Hoeller ad71c6a91c AbstractApplicationEventMulticaster populates ListenerRetriever cache in fully synchronized fashion
Issue: SPR-12545
(cherry picked from commit 61a6bc0)
2014-12-22 18:46:22 +01:00
Juergen Hoeller b30843aee0 AbstractFallbackTransactionAttributeSource's DefaultCacheKey takes targetClass into account (again)
Issue: SPR-12536
(cherry picked from commit c087e51)
2014-12-22 18:46:07 +01:00
Stephane Nicoll 67f184293b Improve performance of generateKey
Only compute the error message to display when the generated key is
actually null instead of using Assert.notNull as the cache operation
'toString()' method is non trivial and gets computed regardless of the
result.

Issue: SPR-12527
2014-12-10 14:34:11 +01:00
Juergen Hoeller bb1d1e916e Polishing 2014-12-07 20:52:18 +01:00
Juergen Hoeller 03d4e1bc22 Consistent bridge method handling in annotation post-processors
Issue: SPR-12490
Issue: SPR-12495
2014-12-07 20:51:35 +01:00
Stephane Nicoll c1f1cac359 Remove DisposableBeanMethodInterceptor
Previously, any @Configuration class was enhanced to namely implement
DisposableBean in order to remove static callbacks that were registered
for that class. This leads to problem if an ApplicationContext is created
and destroyed within the lifecycle on another ApplicationContext in the
same class loader.

It turns out that the destruction callback is no longer necessary as the
interceptors are now stateless: the VM is free to reclaim any of those if
necessary.

Issue: SPR-12445
2014-12-02 13:56:50 +01:00
Juergen Hoeller c85686ac78 Polishing 2014-12-01 19:16:31 +01:00
Juergen Hoeller fa0ef2d87e BeanFactory accepts getBean arguments for non-prototype beans as well
Issue: SPR-12488
2014-12-01 19:05:26 +01:00
Juergen Hoeller c5c5473d44 Common annotation processing for imported and nested classes within configuration classes
Issue: SPR-12486
2014-12-01 18:54:56 +01:00
Sebastien Deleuze f39c505069 Remove a Groovy test already covered by testConfigFileParsingError()
The removed test testConfigFileParsingErrorWhenNamedBeans() could cause
a groovyc compilation error, for example when using latest IntelliJ IDEA.

Issue: SPR-12435
2014-11-25 12:03:28 +01:00
Juergen Hoeller 5e3edc667e Support @Validated at method level for overriding validation groups
Issue: SPR-9174
2014-11-24 23:42:48 +01:00
Juergen Hoeller afc77ff525 AnnotationBeanPostProcessors defensively catch and translate NoClassDefFoundErrors from class introspection
Issue: SPR-12461
2014-11-22 21:34:59 +01:00
Juergen Hoeller b4167be52d GroovyBeanDefinitionReader consistently throws BeanDefinitionParsingException for invalid files of any name
Issue: SPR-12435
2014-11-22 16:08:28 +01:00
Juergen Hoeller 4bd75e4146 BeanMethodInterceptor forwards user-provided arguments to getBean(name, args)
Issue: SPR-12443
2014-11-22 16:06:25 +01:00
Juergen Hoeller 6a96850aa7 Polishing 2014-11-06 14:29:43 +01:00
Juergen Hoeller 3c3e07e324 Defensive handling of manually registered singleton names (based on Spring Integration test failure)
Issue: SPR-12404
2014-11-01 23:03:02 +01:00
Juergen Hoeller 0e36402bd2 Revised retrieval of cache strategy beans
Issue: SPR-12336
2014-11-01 08:26:48 +01:00
Juergen Hoeller 65d163e604 Revised scheduling lifecycle integration
ScheduledAnnotationBeanPostProcessor uses getBean(Class) for TaskScheduler/ScheduledExecutorService retrieval, allowing for a scheduler bean to be flagged as primary, and for a TaskScheduler bean to override a ScheduledExecutorService bean.

ContextLifecycleScheduledTaskRegistrar hooks into SmartInitializingSingleton's afterSingletonsInstantiated callback instead of ContextRefreshedEvent, as a natural consequence of SmartInitializingSingleton's introduction in Spring Framework 4.1 GA.
2014-10-31 17:26:23 +01:00
Juergen Hoeller 7d2231541b Unit tests for java.util.Optional with autowired collections on @Autowired fields/methods and @Bean method parameters
Issue: SPR-9132
2014-10-31 15:28:49 +01:00
Stephane Nicoll 5aefcc802e Prevent early bean initialization with @EnableCaching
Prior to this commmit, any configuration class holding a CacheManager
bean would be eagerly instantiated. This is because the
CacheConfiguration infrastructure requests all beans of type
CacheManager.

This commit defers the resolution of the CacheManager as late
as possible.

Issue: SPR-12336
2014-10-31 14:37:30 +01:00
Juergen Hoeller 5f160c17cd MBeanExporter logs lazy bean retrieval exceptions on the server at warn level
Issue: SPR-12399
2014-10-30 21:57:19 +01:00
Juergen Hoeller 1146d5ba1d Polishing 2014-10-29 22:44:59 +01:00
Juergen Hoeller c7a93a80d4 Configuration class parsing reuses metadata from AnnotatedBeanDefinition as far as possible
Issue: SPR-12394
2014-10-29 22:08:48 +01:00
Juergen Hoeller 725ad0df50 SimpleMetadataReaderFactory is capable of resolving inner class names with dot syntax now (analogous to ClassUtils.forName)
Issue: SPR-12390
2014-10-29 22:03:01 +01:00
Sang Gi Ryu d62522982f Performance improvement
Use entrySet instead of keySet followed by a lookup per key as the
former is more efficient.

Issue: SPR-12363
2014-10-24 10:53:40 +02:00
Sam Brannen 4412bc68aa Polish Javadoc 2014-10-23 01:06:12 +02:00
Juergen Hoeller 2956049c30 Polishing 2014-10-22 17:04:50 +02:00
Juergen Hoeller a2731f1a4f Revised test for ImportBeanDefinitionRegistrar double scan
Issue: SPR-12334
(cherry picked from commit 6e5711a)
2014-10-22 02:27:41 +02:00
Juergen Hoeller 38030ef237 Test for ImportBeanDefinitionRegistrar double scan
Issue: SPR-12334
2014-10-21 23:45:03 +02:00
Juergen Hoeller ad62b2afb1 Consistent throwing of BeanInstantiationException for factory methods, including a hint about circular references
Issue: SPR-12317
2014-10-21 21:40:43 +02:00
Juergen Hoeller 8325b10080 Consistent formatting of license headers, package javadocs, and import declarations 2014-10-21 01:44:07 +02:00
Juergen Hoeller 77a62ec8b8 Polishing 2014-10-20 17:42:18 +02:00
Juergen Hoeller 01724d3b6d Explicitly detect (and prevent) private @Scheduled methods on CGLIB proxies
Issue: SPR-12308
2014-10-07 16:32:09 +02:00
Juergen Hoeller 70fec47944 Provider declaration for @Value method argument works again
Issue: SPR-12297
2014-10-06 18:08:19 +02:00
Juergen Hoeller 05c995cfb3 DecoratingClassLoader and its subclasses register themselves as parallel capable on Java 7+
Issue: SPR-12285
2014-10-02 14:33:13 +02:00
Juergen Hoeller 3a3c52dbdd Polishing 2014-10-01 01:10:25 +02:00
Juergen Hoeller 7f9baa3a09 Polishing 2014-09-26 22:38:41 +02:00
Phillip Webb 3827e048d1 Protect against NPE when escaping LiveBeansView
Issue: SPR-12252
2014-09-26 12:32:04 -07:00
Juergen Hoeller f46c706e44 Bean method metadata exposed through AnnotatedBeanDefinition
Issue: SPR-12232
2014-09-26 14:46:09 +02:00
Juergen Hoeller 92f7121478 LiveBeansView escapes double quotes in resource descriptions
Issue: SPR-12252
2014-09-26 14:01:35 +02:00
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