Commit Graph

1168 Commits

Author SHA1 Message Date
Sebastien Deleuze af6a5566a3 Replace context by provider<T>() in Kotlin bean DSL
Spring Framework 5.1.0 exposed by mistake context in the Kotlin bean DSL
API in order to fix SPR-16269. Now that BeanFactory#getBeanprovider is
available, it should be exposed via a provider<Foo>() function in order
to provide a more clean API instead.

Issue: SPR-17352
2018-10-08 14:00:12 +02:00
Sebastien Deleuze 47d6e91227 Leverage non-default ctor support in Kotlin bean DSL
Since non-default constructors are now evaluated for autowiring,
there is no need anymore for setting autowiring mode or exposing
it in Kotlin bean DSL.

Issue: SPR-17292
2018-09-20 00:21:38 +02:00
Juergen Hoeller b6b880ce27 Polishing 2018-09-19 23:05:40 +02:00
Juergen Hoeller d3c08552e9 Revisit GenericApplicationContext.registerBean constructor handling
Support for Kotlin primary constructor and non-default public constructors in addition to default instantiation, aligned with AnnotationConfigApplicationContext and model attribute processing.

Issue: SPR-17292
2018-09-19 22:19:43 +02:00
Juergen Hoeller 0948edb39d Nested configuration class introspection check on concrete class
Issue: SPR-16839
2018-09-17 19:09:55 +02:00
Juergen Hoeller 77887ef739 BeanValidationPostProcessor validates singleton target behind proxy
Issue: SPR-17273
2018-09-13 20:24:27 +02:00
Juergen Hoeller 65c8fa400f Consistent ordered list access and lazy streaming for ObjectProvider
Includes fallback match for collection/map dependency if qualified.

Issue: SPR-17272
Issue: SPR-17197
2018-09-13 18:23:19 +02:00
Juergen Hoeller b6d32ef55f Bean definition DSL generates unique bean names for bean classes
Issue: SPR-17242
2018-09-12 14:59:10 +02:00
Juergen Hoeller b83bc39ecd Restrict nested configuration class introspection to component types
Issue: SPR-16839
2018-09-12 14:02:45 +02:00
Johnny Lim 43a814b070 Remove duplicate assertions in AsyncExecutionTests 2018-09-11 17:19:32 +02:00
Sam Brannen bff2d2cc85 Polishing 2018-09-04 14:47:37 +02:00
Korovin Anatoliy ab086f4225 Fix fragile tests for asynchronous events
This commit introduces a dependency on the Awaitility assertion
framework and makes use of asynchronous assertions in order to make
tests for asynchronous events more robust.

Issue: SPR-17211
2018-09-04 14:20:05 +02:00
Juergen Hoeller 95a56cd28d Polishing 2018-08-31 12:41:40 +02:00
Juergen Hoeller 1d59e52f11 EventListenerMethodProcessor accepts internal configuration classes
Issue: SPR-17160
2018-08-18 12:05:39 +02:00
Juergen Hoeller 109a2b49e5 Consistently skip unnecessary search on superclasses and empty elements
Includes caching of declared annotation arrays and combined searching for several annotation types (used in SpringCacheAnnotationParser).

Issue: SPR-16933
2018-08-15 17:30:14 +02:00
Sam Brannen aebbd949a8 Suppress deprecation warnings in AnnotationProcessorPerformanceTests 2018-08-13 12:35:19 +02:00
Juergen Hoeller 8bf8092740 Post-processors consistently ignore ScopedObject/AopInfrastructureBean
ScheduledAnnotationBeanPostProcessor also ignores TaskScheduler and ScheduledExecutorService, avoiding unnecessary annotation introspection on framework classes.

Issue: SPR-17166
Issue: SPR-16933
2018-08-11 22:20:07 +02:00
Juergen Hoeller 20f2e23bfb Polishing 2018-08-09 23:57:25 +02:00
Juergen Hoeller 3a5def047f @Scheduled supports "-" as cron expression value for disabled triggers
Issue: SPR-16858
2018-08-09 16:12:05 +02:00
Juergen Hoeller 8e571decc1 Polishing 2018-08-09 11:59:15 +02:00
Kazuhiro Sera be211ceead Fix typos detected by github.com/client9/misspell 2018-08-08 12:50:46 +02:00
Juergen Hoeller 1fd6248d84 Polishing 2018-07-27 17:46:21 +02:00
Juergen Hoeller a9c9ba6601 Generic matching for ObjectProvider stream and empty vararg resolution
Issue: SPR-11419
Issue: SPR-15338
2018-07-24 13:03:54 +02:00
Juergen Hoeller 1603c4ab2f Programmatic ObjectProvider retrieval through BeanFactory API
Introduces getBeanProvider(Class) and getBeanProvider(ResolvableType), also narrowing getBean(String, Class) and isTypeMatch(String, Class) to a non-null Class argument and enriching NoUniqueBeanDefinitionException with a full ResolvableType. In addition, ObjectProvider supports iterable/stream access for collection-style resolution of multiple matching beans now, and collection injection falls back to an empty collection in a single-constructor case with non-null arguments.

Issue: SPR-17075
Issue: SPR-11419
Issue: SPR-15338
2018-07-24 00:42:03 +02:00
Juergen Hoeller 252f52ab07 Tighten (IntroductionAware)MethodMatcher contract
Provides a non-null guarantee for MethodMatcher's targetClass argument and strict separation between IntroductionAwareMethodMatcher and regular MethodMatcher, enabling DefaultAdvisorChainFactory to defer its IntroductionAdvisor determination until encountering an actual IntroductionAwareMethodMatcher (even behind union/intersection).

Issue: SPR-17068
2018-07-20 00:17:31 +02:00
Juergen Hoeller 478d7255d2 GenericApplicationListenerAdapter caches resolved event types
Issue: SPR-16970
2018-07-19 16:34:19 +02:00
Juergen Hoeller 52d124de6f Use supplier-aligned type information for FactoryBean type resolution
Issue: SPR-17063
2018-07-19 13:14:20 +02:00
Juergen Hoeller 28f7b26294 Null-returning instance supplier resolves to NullBean
Issue: SPR-17057
2018-07-18 15:26:06 +02:00
Juergen Hoeller faef363e85 Evaluate @Cacheable(condition) once per method invocation only
Issue: SPR-17024
2018-07-16 13:04:14 +02:00
Juergen Hoeller f6fdffd663 Lazily retrieve delegate beans in AsyncConfigurer and CachingConfigurer
Introduces a configure method pattern for Supplier-style configuration and a common SingletonSupplier decorator for method reference suppliers. Also declares jcache.config and jcache.interceptor for non-null conventions.

Issue: SPR-17021
2018-07-14 19:29:32 +02:00
Juergen Hoeller fc699b2b37 @Bean provides autowireCandidate flag (analogous to XML definitions)
Issue: SPR-16204
2018-07-04 22:41:05 +02:00
Juergen Hoeller f2787cfb35 Same method filtering in ConstructorResolver and getTypeForFactoryMethod
Issue: SPR-16999
2018-07-03 15:53:17 +02:00
Juergen Hoeller 81cb740e0a New postProcessProperties variant on InstantiationAwareBeanPostProcessor
Allows for skipping the now-deprecated postProcessPropertyValues callback with its expensive PropertyDescriptor retrieval requirement. RequiredAnnotationBeanPostProcessor (which is dependent on postProcessPropertyValues) and the @Required annotation itself are also deprecated now: in favor of constructor injection (or afterPropertiesSet).

Issue: SPR-16918
2018-06-28 14:15:16 +02:00
Phillip Webb a89e716cc7 Use tabs rather than spaces in tests
Update tests to ensure that tabs are used instead of spaces. Also
consistently apply a new line at the end of each file.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 1c25cec44f Polish test code
Polish a few issue identified when adding checkstyle to the
build. Although checkstyle is not enforcing rules on tests,
these are a few minor changes that are still worth making.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Stephane Nicoll 1f3b4f1863 Polish "Add profile expression support"
Issue: SPR-12458
2018-06-15 16:01:16 +02:00
Sebastien Deleuze b71d0eeec9 Fix Kotlin bean DSL conditional handling
Issue: SPR-16412
2018-06-01 14:40:27 +02:00
Sebastien Deleuze a7a29a8226 Revisit PropertyResolver Kotlin extensions
Issue: SPR-16883
2018-05-31 12:20:37 +02:00
Juergen Hoeller 1b728fb244 Polishing 2018-05-30 11:10:37 +02:00
Juergen Hoeller 5bbeadec0c Detect nested configuration classes even for empty outer classes
Issue: SPR-16839
2018-05-29 21:47:53 +02:00
Johnny Lim fb898e1727 Remove inconsistent spaces 2018-05-05 11:07:35 +02:00
Juergen Hoeller 9281f820f1 Expose FactoryBean's raw object on retrieval during post-processing
Issue: SPR-16783
2018-05-02 15:21:40 +02:00
Juergen Hoeller c8b6233bd0 Introspect originating bean definition as configuration class candidate
Issue: SPR-16756
2018-05-02 15:20:42 +02:00
Juergen Hoeller eaff2c28a7 Consistent target method resolution for event and caching expressions
Issue: SPR-16779
2018-04-27 18:23:42 +02:00
Juergen Hoeller aa11721ff0 AopUtils.getMostSpecificMethod exposes dynamic proxy class methods
Includes efficient canApply check for IntroductionAwareMethodMatcher.

Issue: SPR-16757
2018-04-27 18:23:34 +02:00
Juergen Hoeller a2a8d0c754 Workaround for generic parameter types on inner class constructors
Issue: SPR-16734
2018-04-17 12:58:32 +02:00
Juergen Hoeller b95e05db04 AspectJExpressionPointcut consistently resolves superinterface methods
Includes efficient check for same ClassLoader in ClassUtils.isVisible, efficient MethodMatchers check for IntroductionAwareMethodMatcher, and supertype method resolution in MethodMapTransactionAttributeSource.

Issue: SPR-16723
2018-04-14 15:10:05 +02:00
sdeleuze 97ee94f4ca Expose env and context in Kotlin beans DSL
This commit introduces a deferred initialization of the declared beans
in order to make it possible to access to the environment (and even
to the context for advanced use-cases) in the beans { } Kotlin DSL.

Issues: SPR-16269, SPR-16412
2018-04-12 11:31:37 +02:00
Juergen Hoeller 61c3db0869 MethodHandles.Lookup.defineClass for CGLIB class definition purposes
Spring's CGLIB fork is patched with local copies of affected files here, introducing the notion of a "contextClass" (e.g. the proxy superclass) which gets passed through to ReflectUtils.defineClass for delegating to MethodHandles.Lookup.defineClass eventually, against a privateLookupIn(contextClass) lookup context on JDK 9/10/11.

Issue: SPR-15859
2018-04-11 12:47:55 +02:00
Juergen Hoeller cdaa247861 Unwind _TestTypes to top-level public test classes in AOP test suite 2018-04-11 12:43:49 +02:00
Juergen Hoeller 6102715b8d Consistent treatment of proxy classes and interfaces for introspection
Issue: SPR-16675
Issue: SPR-16677
2018-04-03 02:42:41 +02:00
Juergen Hoeller 912c270f2b Polishing 2018-03-31 17:49:21 +02:00
Juergen Hoeller 3c1adf7f6a ThreadPoolTaskExecutor/Scheduler cancels remaining Futures on shutdown
Issue: SPR-16607
2018-03-19 01:45:22 +01:00
Juergen Hoeller 914b2470dc Scope annotation in class hierarchies vs XML bean definition inheritance
Issue: SPR-16602
2018-03-16 18:49:00 +01:00
Stephane Nicoll cc12afdea2 Add support for deferred import selector group
This commit allows several DeferredImportSelector instances to be
grouped and managed in a centralized fashion. This typically allows
different instances to provide a consistent ordered set of imports to
apply.

Issue: SPR-16589
2018-03-13 16:52:26 -04:00
Stephane Nicoll fb7c4a3066 Polish 2018-03-11 10:26:41 +01:00
Sam Brannen 0f5a3e2647 Polish formatting in Groovy scripts 2018-03-07 16:09:04 +01:00
Sam Brannen df0b39e8ac Add missing packages to Groovy scripts 2018-03-07 16:09:03 +01:00
Juergen Hoeller 7d89de06e3 Enforce GMT timezone for testBindInstantFromJavaUtilDate
Issue: SPR-16534
2018-02-26 13:02:17 +01:00
Juergen Hoeller 37609e4ede Object/FieldError exposes source object through unwrap/contains methods
Issue: SPR-16372
2018-02-13 17:58:31 +01:00
igor-suhorukov 0ee505b73e Polish: assertion arguments should be passed in the correct order,
use assertNull instead of assertEquals(null, value),
declare delta as double value in assertEquals
2018-02-10 17:17:28 +01:00
Juergen Hoeller 9bb7fcd997 Object/FieldError provides access to source object (exception/violation)
Issue: SPR-16372
2018-02-09 18:42:56 +01:00
Juergen Hoeller 637e09f995 Polishing 2018-01-30 16:00:30 +01:00
Juergen Hoeller ef2e16912d Formatting support for java.time.Year and java.time.Month
Issue: SPR-16437
2018-01-30 15:54:47 +01:00
Juergen Hoeller 89d2bd954a Properly analyze Java 9 class cast messages for lambda event listeners
Issue: SPR-16435
2018-01-30 15:53:58 +01:00
Juergen Hoeller 13c735442c @Scheduled supports java.time.Duration format for its delay attributes
Issue: SPR-15455
2018-01-25 19:11:18 +01:00
Juergen Hoeller b160f93495 CacheProxyFactoryBean exposes all relevant CacheInterceptor callbacks
Issue: SPR-16295
2018-01-14 23:48:21 +01:00
Juergen Hoeller 13a8f90e08 ScheduledAnnotationBeanPostProcessor properly deals with nested proxies
Issue: SPR-16196
2018-01-12 16:48:17 +01:00
Juergen Hoeller 18d90ec140 Properly handle null FactoryBean instance
Issue: SPR-16250
2018-01-07 23:22:56 +01:00
sdeleuze 9f1d8517ba Polish Kotlin source code style 2017-11-21 15:59:23 +01:00
Juergen Hoeller 08c95fbcb3 Unit tests for configuration superclass inclusion
Issue: SPR-16217
2017-11-21 13:42:01 +01:00
Juergen Hoeller 40dacd3c1c Polishing 2017-11-20 22:27:07 +01:00
sdeleuze edf8232555 Avoid implicit autowiring with Kotlin secondary ctors
Autowiring implicitely Kotlin primary constructors
when there are secondary constructors has side effects
on ConstructorResolver. It seems reasonable to
require explicit @Autowired annotation in such case.

With this commit, implicit autowiring of Kotlin
primary constructors is only performed when there
is a primary constructor defined alone or with
a default constructor (define explicitly or
generated via the kotlin-noarg compiler plugin
or via optional constructor parameters with default
values).

Issue: SPR-16022
2017-11-14 09:25:46 +01:00
Juergen Hoeller e2bb06edbd Unit tests for unresolvable generics with partial mismatch
Issue: SPR-16179
2017-11-13 21:51:02 +01:00
Juergen Hoeller 3091feee23 SpringValidatorAdapter skips value retrieval for Set field without index
Issue: SPR-16177
2017-11-13 21:50:55 +01:00
Juergen Hoeller ffd6eff369 Scheduled task introspection through ScheduledTaskHolder interface
Issue: SPR-15982
2017-11-06 18:36:39 +01:00
Juergen Hoeller 9511d29adb Updated bean count expectations in ClassPathBeanDefinitionScannerTests
Issue: SPR-16152
2017-11-06 18:36:29 +01:00
Stephane Nicoll 1838ddb95d Support Ant-style package name with component index
This commit improves the component index so that it supports ant-style
package name (i.e. com.example.**.foo).

Issue: SPR-16152
2017-11-06 15:19:30 +01:00
Juergen Hoeller e5c8dc0d65 MessageSource.getMessage returns null default message as-is (again)
Issue: SPR-16127
2017-10-31 11:06:42 +01:00
Juergen Hoeller c3378fda33 AbstractMessageSource properly interacts with non-AbstractMessageSource parent
Issue: SPR-16047
2017-10-18 20:21:12 +02:00
Juergen Hoeller d1b5b5d2f7 Clarify destroy method suppression for DisposableBean vs (Auto)Closeable
Issue: SPR-16078

(cherry picked from commit dff2c84)
2017-10-16 23:53:02 +02:00
Juergen Hoeller ad4c8e7c0d Consistently sort BeanDefinitionRegistryPostProcessors
Issue: SPR-16043
2017-10-09 13:59:09 +02:00
Juergen Hoeller 30d67f7c42 Tests for @Lazy Validator setup
Issue: SPR-15807
2017-09-10 21:56:23 +02:00
Sebastien Deleuze 8b8a6766de Change BeanDefinitionDsl to implement ApplicationContextInitializer 2017-09-04 10:46:20 +02:00
Juergen Hoeller 30bd5827b0 ConfigurationClassEnhancer leniently allows for null bean references
Issue: SPR-15829
2017-09-01 14:05:14 +02:00
Juergen Hoeller b94302b5bd Enforce non-null value from getBean and at injection points
Bean-derived null values may still get passed into bean properties and injection points but only if those are declared as non-required. Note that getBean will never return null; a manual bean.equals(null) / "null".equals(bean.toString()) check identifies expected null values now.  This will only ever happen with custom FactoryBeans or factory methods returning null - and since all common cases are handled by autowiring or bean property values in bean definitions, there should be no need to ever manually check for such a null value received from getBean.

Issue: SPR-15829
2017-08-18 00:11:35 +02:00
Juergen Hoeller ec1eafc46f @Lazy falls back to empty map/list/set for non-required collection dependency
Issue: SPR-15858
2017-08-17 12:28:55 +02:00
Juergen Hoeller adeb521ce4 Polishing 2017-08-08 17:27:28 +02:00
Juergen Hoeller de09f8ca1f Support for Bean Validation 2.0 container elements (with BV 2.0 test setup)
Includes latest dependency updates (Hibernate Validator 6.0.1, Caffeine 2.5.4, Netty 4.1.14, Tomcat 8.5.19, Johnzon 1.1.2, JsonPath 2.4, Jython 2.7.1)

Issue: SPR-15839
Issue: SPR-15808
2017-08-08 17:26:30 +02:00
Juergen Hoeller ca0983cd85 Polishing 2017-08-01 12:08:57 +02:00
Juergen Hoeller dd2bbcb3ec Leniently handle lambda-defined listeners with ErrorHandler as well
Issue: SPR-15838
2017-08-01 12:06:41 +02:00
Juergen Hoeller 1fbd047003 checkConfigurationClassCandidate explicitly skips factory method definitions
Issue: SPR-14603
2017-08-01 12:05:26 +02:00
Sebastien Deleuze 29c112c010 Avoid requiring `it` parameter in Kotlin bean DSL
By using function literals with receiver, we can avoid requiring
lambda parameters for a shorter and nicer syntax. Based on a
proposal from Joseph Taylor.

Issue: SPR-15815
2017-07-25 11:21:08 +02:00
Juergen Hoeller ac1d3b22c9 Polishing 2017-07-19 22:22:27 +02:00
Juergen Hoeller 46eba3dbfa Nullability fine-tuning around declaration inconsistencies
Issue: SPR-15720
Issue: SPR-15792
2017-07-19 22:22:20 +02:00
Sebastien Deleuze ff85726fa9 Fix warnings in Kotlin tests 2017-07-19 08:12:48 +02:00
Sebastien Deleuze e2fd04dff3 Add a [] Kotlin extension for PropertyResolver#getRequiredProperty 2017-07-19 08:12:32 +02:00
Sebastien Deleuze f72e0daa54 Add an env accessor to BeanDefinitionContext
Issue: SPR-15755
2017-07-19 07:57:19 +02:00
Juergen Hoeller bca5a36216 Explicit error message for bean name clash with containing configuration class
Issue: SPR-15775
2017-07-18 00:54:49 +02:00
Sebastien Deleuze 1f011467b8 Introduce Kotlin functional bean definition DSL
As a follow-up of the ApplicationContext Kotlin extensions, close to
the Kotlin functional WebFlux DSL and partially inspired of the
Groovy/Scala bean configuration DSL, this commit introduces a
lightweight Kotlin DSL for functional bean declaration.

It allows declaring beans as following:

beans {
	bean<Foo>()
	profile("bar") {
		bean<Bar>("bar", scope = Scope.PROTOTYPE)
	}
	environment({ it.activeProfiles.contains("baz") }) {
		bean { Baz(it.ref()) }
		bean { Baz(it.ref("bar")) }
	}
}

Advantages compared to Regular ApplicationContext API are:
 - No exposure of low-level ApplicationContext API
 - Focused DSL easier to read, but also easier to write with a fewer
   entries in the auto-complete
 - Declarative syntax instead of functions with verbs like registerBeans
   while still allowing programmatic registration of beans if needed
 - Such DSL is idiomatic in Kotlin
 - No need to have an ApplicationContext instance to write how you
   register your beans since beans { } DSL is conceptually a
   Consumer<GenericApplicationContext>

This DSL effectively replaces ApplicationContext Kotlin extensions as
the recommended way to register beans in a functional way with Kotlin.

Issue: SPR-15755
2017-07-12 16:38:41 +02:00
Juergen Hoeller eb928ce456 Reliably detect event listener conditions on proxied beans
Issue: SPR-15678
2017-07-05 13:41:56 +02:00
Juergen Hoeller 5f4d1a4628 CronSequenceGenerator.isValidExpression actually validates cron fields
Issue: SPR-15604
2017-06-30 01:54:32 +02:00
Sebastien Deleuze d728d597f2 Add missing license headers in Kotlin files 2017-06-27 14:39:26 +02:00
Juergen Hoeller 87430f3cd3 ListenableFuture provides CompletableFuture adaptation via completable()
Issue: SPR-15696
2017-06-27 00:43:37 +02:00
Sebastien Deleuze 04d5a2951c Remove KClass based Kotlin extensions
Issue: SPR-15660
2017-06-13 18:43:59 +02:00
Juergen Hoeller 779deb0fa7 Cleanup of duplicate semicolons
Issue: SPR-15654
2017-06-13 11:38:05 +02:00
Stephane Nicoll 58242f2249 Polish 2017-06-13 10:13:14 +02:00
Sebastien Deleuze 86580b2358 Polishing 2017-06-09 01:49:56 +03:00
Sebastien Deleuze 8579ae66fc Add comprehensive tests of Kotlin extensions
This commit also removes extensions hidden by Java API (varargs).
2017-06-09 01:01:16 +03:00
Juergen Hoeller fd53d2a51a Consistent use of @Nullable in spring-test
This commit also removes nullability from two common spots: ResolvableType.getType() and TargetSource.getTarget(), both of which are never effectively null with any regular implementation. For such scenarios, a non-null empty type/target is the cleaner contract.

Issue: SPR-15540
2017-06-08 22:52:59 +02:00
Juergen Hoeller f813712f5b Consistent use of @Nullable across the codebase (even for internals)
Beyond just formally declaring the current behavior, this revision actually enforces non-null behavior in selected signatures now, not tolerating null values anymore when not explicitly documented. It also changes some utility methods with historic null-in/null-out tolerance towards enforced non-null return values, making them a proper citizen in non-null assignments.

Some issues are left as to-do: in particular a thorough revision of spring-test, and a few tests with unclear failures (ignored as "TODO: NULLABLE") to be sorted out in a follow-up commit.

Issue: SPR-15540
2017-06-07 14:19:15 +02:00
Sebastien Deleuze b47d713e14 Add missing @Nullable annotations on parameters
Issue: SPR-15540
2017-05-31 16:56:08 +02:00
Juergen Hoeller 3cc94ae8b5 Consistently accept "taskExecutor" bean of type Executor (as stated in @EnableAsync's javadoc)
Issue: SPR-15566
2017-05-25 23:37:02 +02:00
Andy Clement 109746a03b Adjust source in test class to work around eclipse compiler bug
Issue: SPR-15586
2017-05-24 13:24:24 -07:00
Juergen Hoeller cb3d1befcd LocalValidatorFactoryBean properly supports unwrap at ValidatorFactory level
Also documents limitation for Bean Validation 2.0's getClockProvider() method.

Issue: SPR-15561
Issue: SPR-13482
2017-05-18 21:00:56 +02:00
Juergen Hoeller 1f5eaf20b0 Basic test for functional bean registration within a configuration class
Issue: SPR-13779
2017-05-04 11:26:21 +02:00
Juergen Hoeller 8b50f887db Caching annotations on interface methods with CGLIB proxies
Issue: SPR-15271
2017-04-26 18:16:47 +02:00
Juergen Hoeller 6c43d14a77 Async annotations on interface methods with CGLIB proxies
Issue: SPR-14949
2017-04-26 18:16:40 +02:00
Juergen Hoeller 91df0653fe Polishing 2017-04-17 15:05:34 +02:00
Juergen Hoeller 9abf249cee Explicitly replace target ApplicationListener with singleton proxy, if any (avoiding double registration/invocation)
Issue: SPR-15452
2017-04-15 14:10:28 +02:00
Juergen Hoeller 15b5dd9f12 Polishing 2017-04-10 15:36:45 +02:00
Juergen Hoeller a95843a068 Dependency tracking for Supplier-created beans
Issue: SPR-15417
2017-04-07 18:01:28 +02:00
Juergen Hoeller 917207b7ae Support for @Order on nested configuration classes
Issue: SPR-15384
2017-04-04 17:17:03 +02:00
Sam Brannen 0b11785852 Improve tests for PropertySourcesPlaceholderConfigurer 2017-03-28 19:26:45 +02:00
Juergen Hoeller fc2e635c05 Lookup methods work on configuration classes as well
Issue: SPR-15316
2017-03-07 13:51:43 +01:00
Juergen Hoeller 6d6cf01a42 Polishing 2017-02-28 13:13:23 +01:00
Juergen Hoeller d003f6614b Tests for annotation lookups in interfaces (currently ignored for CGLIB proxies)
Issue: SPR-15271
Issue: SPR-14949
Issue: SPR-14322
2017-02-28 13:11:15 +01:00
Juergen Hoeller cbd19153c4 Polishing 2017-02-22 16:53:54 +01:00
Juergen Hoeller f4de1ea147 Polishing 2017-02-22 15:32:19 +01:00
Juergen Hoeller 7fb0ad37da ConfigurationClassEnhancer explicitly handles non-interceptable FactoryBeans
Issue: SPR-15275
2017-02-22 15:32:04 +01:00
Stephane Nicoll 73909f41cb Polish 2017-02-20 16:29:05 +01:00
Stephane Nicoll 1c74a1a0fe Improve allowNullValue handling when a null value is provided
This commit improves `AbstractValueAdaptingCache` to throw a dedicated
exception if `allowNullValues` is `false` and a `null` value is provided
anyway. This avoid a lower-level exception from the cache library that
will miss some context.

Issue: SPR-15173
2017-02-20 16:08:08 +01:00
Juergen Hoeller 1b2dc3638f Revisit Assert to avoid single-arg assert methods (with refined messages)
Issue: SPR-15196
2017-01-30 22:15:55 +01:00
Juergen Hoeller 7d3fcaa934 Consider abstract classes with @Lookup methods as candidate components
Issue: SPR-14550
2017-01-23 17:28:18 +01:00
Juergen Hoeller ac6aa53031 Drop outdated BeanFactoryLocator / beanRefContext.xml mechanism
Issue: SPR-15154
2017-01-17 13:58:37 +01:00
Juergen Hoeller d96738d613 Revised indexer implementation
Issue: SPR-11890
2017-01-17 12:59:42 +01:00
Juergen Hoeller d0e93284f3 SpringValidatorAdapter properly handles HV-5-style list constraint violations
Issue: SPR-15082
2017-01-12 21:16:56 +01:00
Juergen Hoeller b06423a5f8 AbstractMessageSource does not attempt to format code-as-default-message
Issue: SPR-15123
2017-01-12 21:16:48 +01:00
Sebastien Deleuze 0a988fd2b1 Remove object wrappers in Kotlin extensions
This commit also improve significantly Kotlin extensions
documentation.

Issue: SPR-15127
2017-01-11 08:52:01 +01:00
Sebastien Deleuze f8461d856a Support Gradle-style Kotlin bean API
val context = GenericApplicationContext {
    registerBean<Foo>()
    registerBean { Bar(it.getBean<Foo>()) }
}

Issue: SPR-15126
2017-01-10 21:43:27 +01:00
Mario Arias 1af905ca0a Add Model and ModelMap Kotlin extensions
Issue: SPR-15119
2017-01-10 14:22:54 +01:00
Sebastien Deleuze c5cfd8c8fc Make the Kotlin bean registration API even more idiomatic
Put the lambda parameter at the end and use a function
instead of a supplier to be able to register beans like this:

val context = GenericApplicationContext()
context.registerBean(Foo::class)
context.registerBean{ Bar(it.getBean(Foo::class)) }

Issue: SPR-15118
2017-01-10 10:38:24 +01:00
Sebastien Deleuze 715274e327 Avoid the need to specify Supplier in Kotlin bean registration API
Based on an idea from Mario Arias, we can avoid requiring specifying
explicitly Supplier lambda type in Kotlin API by declaring the supplier
parameter as "crossinline supplier: () -> T" instead of
"supplier: Supplier<T>".

Issue: SPR-15118
2017-01-09 20:22:30 +01:00
Juergen Hoeller a5c6658d2c Track bean dependencies for calls between @Bean methods within @Configuration classes
Issue: SPR-15069
2016-12-29 22:38:00 +01:00
Juergen Hoeller edc62be231 @Scheduled reliably applies after other post-processors and shuts down before TaskScheduler
Issue: SPR-14692
Issue: SPR-15067
2016-12-29 22:35:10 +01:00
Juergen Hoeller 209e7a700d Avoid FactoryBean initialization on isSingleton check for decorated bean definition
Issue: SPR-14892
Issue: SPR-15042
2016-12-28 17:27:06 +01:00
Juergen Hoeller bb94ba6e3f DateFormatter's ISO patterns use XXX timezone notation (as per SimpleDateFormat's javadoc)
Issue: SPR-14675
2016-12-26 22:31:27 +01:00
Sebastien Deleuze ff675f5226 Add Kotlin extensions for bean registration and retrieval
Issue: SPR-15048
2016-12-26 14:21:10 +01:00
Juergen Hoeller f805427629 Detect generic type match behind interface-based proxy as well
Issue: SPR-14097
2016-12-26 11:23:07 +01:00
Juergen Hoeller 3295a4e6ef ConfigurationClassParser enforces @Bean declaration order through ASM metadata
Issue: SPR-14505
2016-12-23 20:29:12 +01:00
Juergen Hoeller e788b8467d GenericApplicationContext offers Supplier-based registration with BeanDefinitionCustomizer callback
Issue: SPR-14832
2016-12-23 12:26:47 +01:00
Juergen Hoeller 9005481a49 Supplier registration support for annotated bean classes
Issue: SPR-14832
2016-12-20 19:57:44 +01:00
Juergen Hoeller f6b2a21206 ConfigurationClassPostProcessor programmatically registers unified ImportAwareBeanPostProcessor
Issue: SPR-14931
2016-12-20 12:16:16 +01:00
Juergen Hoeller 9c55d22f78 MBeanExporter silently ignores null beans
Issue: SPR-15031
2016-12-19 16:02:59 +01:00
Juergen Hoeller 3ee6286eb5 Support for functional instance supplier callback at BeanDefinition level
Issue: SPR-14832
2016-12-18 21:05:45 +01:00
Juergen Hoeller 4c005e6336 ResolvableType-based matching respects generic factory method return type
Includes consistent use of ResolvableType.resolve() wherever applicable.

Issue: SPR-15011
2016-12-17 23:10:48 +01:00
Juergen Hoeller 23f0418337 LocaleContextHolder provides support for framework-level default settings
Issue: SPR-15017
2016-12-15 15:43:40 +01:00
Kazuki Shimizu 9f229283fb Support lazy initialization of BindingResult when customize a MessageCodesResolver
Issue: SPR-15009
2016-12-14 00:50:25 +09:00
Juergen Hoeller 547b9638dc Collection injection may refer back to factory methods on same bean again
Issue: SPR-14996
2016-12-09 23:09:10 +01:00
Juergen Hoeller 845dbf040d Test injection point match for narrow target return type
Issue: SPR-14960
2016-11-30 23:47:32 +01:00
Juergen Hoeller 1ae17c27df Efficient ISO_LOCAL_* variants for printing LocalDate/LocalTime/LocalDateTime
Issue: SPR-14958
2016-11-30 23:41:00 +01:00
Juergen Hoeller 9bf4d7cf4e Polishing 2016-11-22 14:57:00 +01:00
Juergen Hoeller dc8cd4e4c0 Polishing
Issue: SPR-14888
2016-11-08 17:26:59 +01:00
Kazuki Shimizu 124f2128fa Detect invalid configuration for autoGrowCollectionLimit on DataBinder
Issue: SPR-14888
2016-11-09 01:00:27 +09:00
Juergen Hoeller 7f4904ed22 Avoid deprecated Mockito methods
Issue: SPR-14880
2016-11-04 20:39:53 +01:00
Juergen Hoeller ac774cdcef Avoid deprecated Mockito methods
Issue: SPR-14880
2016-11-04 12:24:46 +01:00
Juergen Hoeller 8053fefea8 Consistent support for early placeholder resolution in properties locations
Issue: SPR-10502
2016-11-03 14:33:48 +01:00
Juergen Hoeller b07d40cc44 Polishing
(cherry picked from commit 77e00f1)
2016-10-31 20:56:00 +01:00
Juergen Hoeller 2f9ed5917b Polishing 2016-10-28 23:49:21 +02:00
Juergen Hoeller dc080cb1be Revised NoSuchBeanDefinitionException message and ResolvableType handling
Includes consistent quoting of qualified type names in related classes.

Issue: SPR-14831
2016-10-28 23:39:05 +02:00
Juergen Hoeller c946924431 ApplicationListener detection for inner beans behind post-processors
Issue: SPR-14783
2016-10-28 23:35:56 +02:00
Juergen Hoeller bf9083d60f TypeDescriptor supports merged annotation lookups (for composable formatting annotations)
Issue: SPR-14844
2016-10-28 23:33:26 +02:00
Juergen Hoeller 08972eff9b Local merged annotation lookup in SpringCacheAnnotationParser
Issue: SPR-14781
Issue: SPR-14801
2016-10-28 23:32:55 +02:00
Juergen Hoeller 13001b9aff SimpleApplicationEventMulticaster just swallows event downcast exceptions
Issue: SPR-14846
2016-10-28 15:25:22 +02:00
Stephane Nicoll 56c48623fd Allow @Cacheable method to return Optional
This commit further refines 240f254 to also support java.util.Optional
for synchronized cache access (i.e. when the `sync` attribute on
`@Cacheable` is set to `true`).

Issue: SPR-14853
2016-10-27 09:47:15 +02:00
Stephane Nicoll 1f3b8ff2f7 LiveBeansView does not rely on application contexts order anymore
This commit makes sure that the `unregister` order of registered
application contexts has no incidence on the removal of the LiveBeansView
MBean.

Rather than using the last application context's name to compute the
identity of the MBean to remove, the identity is stored when the MBean is
created.

This commit also adds missing tests.

Issue: SPR-14848
2016-10-26 15:03:14 +02:00
Juergen Hoeller f7d740fa69 ConversionService detects generic type declaration on target class behind proxy as well
Issue: SPR-14822
2016-10-21 12:24:12 +02:00
Stephane Nicoll fc8bad36c9 Fix formatting
Closes gh-1206
2016-10-15 11:55:07 +03:00
Philippe Marschall ae5b0c6fb5 Replace J2EE with Java EE
String with version 5 the name of Java Platform, Enterprise Edition
changed from J2EE to Java EE. However a lot of the documentation still
uses the term J2EE.

This commit includes the following changes:

 * replace J2EE with Java EE where appropriate

This is not a blind search and replace. The following occurrences
remain unchanged:

 * references to old J2EE releases, most notably 1.3 and 1.4.
 * references to "Expert One-On-One J2EE Design and Development"
 * references to "Core J2EE patterns"
 * XML namespaces
 * package names

Issue: SPR-14811
See gh-1206
2016-10-15 11:49:00 +03:00
Juergen Hoeller bf6653b837 Adapted to 4.3.3 backport
Issue: SPR-14728
2016-09-18 21:33:58 +02:00
Sam Brannen 8f62b63663 Introduce 'value' alias for @Bean's 'name' attribute
In order to simplify configuration for use cases involving @Bean where
only a bean name or aliases are supplied as an attribute, this commit
introduces a new 'value' attribute that is an @AliasFor 'name' in @Bean.

Issue: SPR-14728
2016-09-17 16:16:06 +02:00
Stephane Nicoll dcade06fa0 Support for candidate components index
This commit adds a "spring-context-indexer" module that can be added to
any project in order to generate an index of candidate components defined
in the project.

`CandidateComponentsIndexer` is a standard annotation processor that
looks for source files with target annotations (typically `@Component`)
and references them in a `META-INF/spring.components` generated file.

Each entry in the index is the fully qualified name of a candidate
component and the comma-separated list of stereotypes that apply to that
candidate. A typical example of a stereotype is `@Component`. If a
project has a `com.example.FooService` annotated with `@Component` the
following `META-INF/spring.components` file is generated at compile time:

```
com.example.FooService=org.springframework.stereotype.Component
```

A new `@Indexed` annotation can be added on any annotation to instructs
the scanner to include a source file that contains that annotation. For
instance, `@Component` is meta-annotated with `@Indexed` now and adding
`@Indexed` to more annotation types will transparently improve the index
with additional information. This also works for interaces or parent
classes: adding `@Indexed` on a `Repository` base interface means that
the indexed can be queried for its implementation by using the fully
qualified name of the `Repository` interface.

The indexer also adds any class or interface that has a type-level
annotation from the `javax` package. This includes obviously JPA
(`@Entity` and related) but also CDI (`@Named`, `@ManagedBean`) and
servlet annotations (i.e. `@WebFilter`). These are meant to handle
cases where a component needs to identify candidates and use classpath
scanning currently.

If a `package-info.java` file exists, the package is registered using
a "package-info" stereotype.

Such files can later be reused by the `ApplicationContext` to avoid
using component scan. A global `CandidateComponentsIndex` can be easily
loaded from the current classpath using `CandidateComponentsIndexLoader`.

The core framework uses such infrastructure in two areas: to retrieve
the candidate `@Component`s and to build a default `PersistenceUnitInfo`.
Rather than scanning the classpath and using ASM to identify candidates,
the index is used if present.

As long as the include filters refer to an annotation that is directly
annotated with `@Indexed` or an assignable type that is directly
annotated with `@Indexed`, the index can be used since a dedicated entry
wil be present for that type. If any other unsupported include filter is
specified, we fallback on classpath scanning.

In case the index is incomplete or cannot be used, The
`spring.index.ignore` system property can be set to `true` or,
alternatively, in a "spring.properties" at the root of the classpath.

Issue: SPR-11890
2016-09-01 15:30:47 +02:00
Juergen Hoeller 4ef428de28 Polishing 2016-08-30 23:57:11 +02:00
Sam Brannen d6d05e8ca0 Remove trailing whitespace in Java source code 2016-08-29 15:25:10 +02:00
Juergen Hoeller ab0d523cc0 Polishing
(cherry picked from commit 1932a9d)
2016-08-17 21:54:40 +02:00
Juergen Hoeller 6a0d9d3d97 Consistent support for CompilationCustomizers as well as custom CompilerConfiguration
Issue: SPR-14585
2016-08-17 11:29:49 +02:00
Juergen Hoeller 433764d217 GroovyScriptFactory supports CompilationCustomizer next to GroovyObjectCustomizer
Issue: SPR-14585
2016-08-17 00:47:50 +02:00
Juergen Hoeller 214c919742 AspectJ bean pointcut supports qualifier match
Issue: SPR-11217
2016-08-17 00:43:41 +02:00
Juergen Hoeller fae503d568 MethodBasedEvaluationContext reliably exposes varargs
Issue: SPR-14554
2016-08-09 21:24:38 +02:00
Juergen Hoeller 328e04f167 JndiPropertySource defensively skips invalid JNDI lookup for property name with colon in resource-ref mode
Issue: SPR-14518
2016-07-27 22:37:25 +02:00
Juergen Hoeller 5db449556b Polishing 2016-07-27 16:21:55 +02:00
Juergen Hoeller 316244d2bd Isolated circular import detection for scanned configuration classes
Issue: SPR-14517
2016-07-27 16:21:48 +02:00
Juergen Hoeller e03dea1d64 Polishing 2016-07-26 17:15:19 +02:00
Juergen Hoeller 4a85309a04 Consistent throwing of BeanNotOfRequiredTypeException even for existing proxy
Issue: SPR-14504
2016-07-24 15:31:00 +02:00
Juergen Hoeller 0e3f0bd9d0 Avoid JDK proxy against CGLIB Factory interface and assert required type when resolving dependency
Issue: SPR-14478
2016-07-20 18:05:51 +02:00
Juergen Hoeller a4743c07d4 Polishing 2016-07-19 20:09:00 +02:00
Juergen Hoeller aaac199e8b Consistently use constructor-based instantiation instead of Class.newInstance / BeanUtils.instantiate
Issue: SPR-14486
2016-07-19 19:21:06 +02:00
Juergen Hoeller 3d3407c789 Consistent alias processing behind AnnotatedTypeMetadata abstraction (also for ASM)
Issue: SPR-14427
2016-07-15 13:59:25 +02:00
Juergen Hoeller e431624e84 CronSequenceGenerator prevents stack overflow in case of inverted range
Issue: SPR-14462
2016-07-14 21:11:28 +02:00
Stephane Nicoll ff738e7670 Polish contribution
Closes gh-1070
2016-07-14 11:12:06 +02:00
spodgurskiy f075aac7f9 Fix MethodBasedEvaluationContext.lazyLoadArguments
This commit fix a potential `ArrayIndexOutOfBoundsException` if
`lazyLoadArguments` is called with an empty variable argument.

See gh-1070
2016-07-14 10:58:21 +02:00
Stephane Nicoll 11ed26584d Polish 2016-07-11 10:50:44 +02:00
Stephane Nicoll 15c3cdd48d Fix NoOpCache handling of get(key,callable)
This commit fixes the method that takes a Callable to actually always
invoke it rather than returning null.

Issue: SPR-14445
2016-07-11 10:34:27 +02:00
Juergen Hoeller 6aa5931e28 Polishing 2016-07-07 01:05:25 +02:00
Juergen Hoeller a1f5fb53db Java 8 getParameterCount() instead of getParameterTypes().length
Issue: SPR-13188
2016-07-07 01:04:24 +02:00
Juergen Hoeller bc2c22d51e Streamline XML namespace support towards unversioned schemas
This commit also removes support code for outdated options which were only available in older schema versions.

Issue: SPR-13499
2016-07-05 20:50:03 +02:00
Juergen Hoeller acdb43f470 Remove remaining JRuby and Commons Pool test resources
Issue: SPR-14429
2016-07-05 20:47:39 +02:00
Sam Brannen 1391248ea6 Introduce log4j 2 for Spring's test suite
This commit adds a test runtime dependency on log4j 2 for every project
and migrates all log4j.properties files to log4j2-test.xml files.

Issue: SPR-14431
2016-07-05 19:19:09 +02:00
Stephane Nicoll 00d2606b00 Explicit type can be replaced by <>
Issue: SPR-13188
2016-07-05 17:00:34 +02:00
Stephane Nicoll 3096888c7d Better synchronization in ConcurrentMapCache
Issue: SPR-13810
2016-07-05 16:44:07 +02:00
Juergen Hoeller b5db5d3aac Broadly remove deprecated core classes and methods
Issue: SPR-14430
2016-07-05 15:52:49 +02:00
Juergen Hoeller 0fc0ce78ae Drop deprecated dependencies on Log4j, JRuby, JExcel, Burlap, Commons Pool/DBCP
This commit also removes outdated support classes for Oracle, GlassFish, JBoss.

Issue: SPR-14429
2016-07-05 15:46:53 +02:00
Juergen Hoeller 54004e0d78 Upgrade to JPA 2.1+ and Bean Validation 1.1+; remove native support for Hibernate 3.6 and 4.x
Issue: SPR-13481
Issue: SPR-13827
2016-07-04 23:37:23 +02:00
Juergen Hoeller e15f7efff8 InjectionPoint propagated for shortcut bean name resolution as well
Issue: SPR-14400
2016-06-26 00:18:54 +02:00
Juergen Hoeller 8cb9d5ebae EnableAspectJAutoProxy features exposeProxy flag (analogous to XML namespace)
Issue: SPR-10454
2016-06-20 13:50:04 +02:00
Juergen Hoeller d51c22a789 Consistent processing of empty values and catching of RuntimeExceptions for Formatters
Issue: SPR-14345
2016-06-09 10:49:15 +02:00
Juergen Hoeller c6f63bdb30 Assertions for error codes in case of formatting failures
Issue: SPR-14345
2016-06-08 15:54:00 +02:00
Juergen Hoeller ae11387b4a Removal of @Ignore'd tests
Issue: SPR-6310
Issue: SPR-6327
2016-06-02 11:47:22 +02:00
Juergen Hoeller 24f5f368b0 Consistent meta-annotation attributes lookup through ASM
Issue: SPR-14257
2016-05-30 22:39:27 +02:00
Juergen Hoeller 03affa02db ConfigurationClassParser detects @Bean methods in interface hierarchies as well
Issue: SPR-14288
2016-05-27 22:34:09 +02:00
Stephane Nicoll 66bab2a9fc Revert "Manage asynchronous EventListener with replies"
This reverts commit bee1b77af5.
2016-05-06 13:38:03 +02:00
Juergen Hoeller 1b1aac9172 Unit tests for AsyncResult callback behavior
Issue: SPR-14249
2016-05-05 20:40:30 +02:00
Sam Brannen a1a87679da Support test annotations on interfaces
Prior to Java 8 it never really made much sense to author integration
tests using interfaces. Consequently, the Spring TestContext Framework
has never supported finding test-related annotations on interfaces in
its search algorithms.

However, Java 8's support for interface default methods introduces new
testing use cases for which it makes sense to declare test
configuration (e.g., @ContextConfiguration, etc.) on an interface
containing default methods instead of on an abstract base class.

This commit ensures that all non-repeatable, class-level test
annotations in the Spring TestContext Framework can now be declared on
test interfaces. The only test annotations that cannot be declared on
interfaces are therefore @Sql and @SqlGroup.

Issue: SPR-14184
2016-05-05 19:54:44 +02:00
Sam Brannen 7b13311f03 Delete unused imports 2016-05-03 20:12:37 +02:00
Juergen Hoeller fdb31cd715 Check actual cache value for unwrapped Optional
Issue: SPR-14230
2016-04-29 10:56:26 +02:00
Juergen Hoeller 240f254bfc Allow @Cacheable method to return java.util.Optional variant of cached value
Includes renaming of internal delegate to CacheOperationExpressionEvaluator.

Issue: SPR-14230
2016-04-28 23:16:43 +02:00
Sam Brannen 4a4cd5bde8 Polish CronSequenceGenerator and tests 2016-04-23 18:05:54 +02:00
Ruslan Sibgatullin 31d634e6bf Added cron expression validation method for CronSequenceGenerator
It's handy to know in advance whether or not expression that is
passed to CronSequenceGenerator or CronTrigger constructor would
not results in IllegalArgumentException. The only way to do it
now is to try\catch an instance creation but it's kinda ugly.
2016-04-23 17:56:29 +03:00
Johnny Lim 44e652f99e Remove duplicate words
Closes gh-1039
2016-04-19 08:24:21 +02:00
Stephane Nicoll bee1b77af5 Manage asynchronous EventListener with replies
This commit makes sure to reject an `@EventListener` annotated method
that also uses `@Async`. In such scenario, the method is invoked in a
separate thread and the infrastructure has no handle on the actual reply,
if any.

The documentation has been improved to refer to that scenario.

Issue: SPR-14113
2016-04-15 13:22:11 +02:00
Juergen Hoeller b28d96af7d ScheduledAnnotationBeanPostProcessor accepts non-void methods as well
Issue: SPR-14175
2016-04-14 21:59:02 +02:00
Juergen Hoeller 999112216d AopUtils.canApply properly matches package-visible methods (aligned with advice matching within proxies)
Also, AbstractAutoProxyCreator considers Pointcut as infrastructure class, analogous to Advice and Advisor.

Issue: SPR-14174
2016-04-14 21:46:25 +02:00
Juergen Hoeller dcfa4740ee Polishing
(cherry picked from commit 09b7735)
2016-04-13 13:56:37 +02:00
Juergen Hoeller da112611a5 SpringCacheAnnotationParser properly accepts empty @Caching annotation
Issue: SPR-14162
2016-04-12 23:19:51 +02:00
Stephane Nicoll 10554a85c9 Polish 2016-04-12 08:34:38 +02:00
Juergen Hoeller b6f1afd471 Polishing 2016-04-11 21:20:31 +02:00
Juergen Hoeller 537193a4e0 Consistent license header 2016-04-11 20:49:38 +02:00
Juergen Hoeller 4407bd794d Polishing 2016-04-10 05:40:35 +02:00
Sam Brannen 3597879608 Revert merged support for @ManagedNotification & @ManagedOperationParameter
This commit reverts the recently added merged annotation support for
Spring's JMX annotations by once again using the simpler searches for
repeatable annotations in AnnotationUtils.

Issue: SPR-13973
2016-03-29 17:51:47 +02:00
Sam Brannen 4fa11e334f Test @ManagedNotification as a merged, composed annotation
Issue: SPR-13973
2016-03-26 20:10:20 +01:00
Sam Brannen a8b5ea1c51 Polishing 2016-03-26 01:27:37 +01:00
Sam Brannen 4836d06704 Test @Scheduled as a merged composable annotation
Issue: SPR-13973
2016-03-26 00:47:02 +01:00
Juergen Hoeller 517ebd1d3e Consistent formatting 2016-03-24 19:22:50 +01:00
Juergen Hoeller 9af12d290e Polishing 2016-03-23 18:39:29 +01:00
Juergen Hoeller 5025c615b1 Consistent use of AnnotatedElementUtils.findMergedAnnotation/hasAnnotation
Issue: SPR-13440
2016-03-23 18:39:20 +01:00
Juergen Hoeller 3c18a4533a Ignored test removed (not intended to work)
Issue: SPR-14058
2016-03-23 18:15:29 +01:00
Sam Brannen 59c88eb3c0 Support @Cache* as merged composed annotations
Prior to this commit, @Cacheable, @CacheEvict, @CachePut, and @Caching
could be used to create custom stereotype annotations with hardcoded
values for their attributes; however, it was not possible to create
composed annotations with attribute overrides.

This commit addresses this issue by refactoring
SpringCacheAnnotationParser to use the newly introduced
findAllMergedAnnotations() method in AnnotatedElementUtils. As a
result, @Cacheable, @CacheEvict, @CachePut, and @Caching can now be
used to create custom composed annotations with attribute overrides
configured via @AliasFor.

Issue: SPR-13475
2016-03-21 12:54:09 +01:00
Sam Brannen 4cd7ba12bb Polishing 2016-03-19 14:39:01 +01:00
Juergen Hoeller a1a06cd665 @EnableScheduling tests do not expect exception in case of scheduler ambiguity anymore
Issue: SPR-14030
2016-03-19 13:18:24 +01:00
Sam Brannen 5045579028 Revise EnableSchedulingTests
- Fast tests now always run (i.e., are no longer limited to the
  performance build
- Failing tests have been @Ignore'd

Issue: SPR-14030
2016-03-19 12:38:47 +01:00
Juergen Hoeller 6e3fac85f3 AnnotationAwareOrderComparator uses DecoratingProxy interface for target class introspection
Issue: SPR-13884
2016-03-18 22:12:10 +01:00
Juergen Hoeller 431ca9314a Leniently allow constructor argument matches if required name is not resolvable
Issue: SPR-13987
2016-03-18 18:51:33 +01:00
Juergen Hoeller a95bf6e0fc Current InjectionPoint/DependencyDescriptor as factory method argument
Issue: SPR-14033
2016-03-18 15:30:33 +01:00
Sam Brannen e904ce4ead Polish QualifierAnnotationAutowireContextTests 2016-03-15 18:17:50 +01:00
Sam Brannen e83e3ec9de Add failing test for @Qualifier as composed annotation
Issue: SPR-14058
2016-03-15 18:13:59 +01:00
Stephane Nicoll 33a4e9e57f Prevent non public bean to be exposed to JMX
Previously, a package private `@ManagedResource` annotated bean was
registered to the JMX domain even if any attempt to invoke an operation
on it will fail since it has to be public.

This commit validates that any `@ManagedResource` annotated bean is
public and throws an InvalidMetadataException otherwise. Note that the
actual bean type does not have to be public as long as the class
annotated with `@ManagedResource` in the hierarchy is pubic and no extra
operations or attributes are defined on the child.

Issue: SPR-14042
2016-03-15 09:51:20 +01:00
Phillip Webb 094cf6cafb Support *Aware for @ComponentScan custom filters
Support a limited set of *Aware interfaces for TypeFilters created
via the @ComponentScan annotation.

Issue: SPR-14009
2016-03-11 12:40:42 -08:00
Juergen Hoeller b4de66ff9a Test for placeholder-specified default value within @Value
Issue: SPR-14025
2016-03-11 15:00:01 +01:00
Juergen Hoeller b944283354 ConstructorResolver exposes parameter signature from user-declared class (in case of a CGLIB-generated subclass)
Issue: SPR-14015
2016-03-11 12:52:40 +01:00
Stephane Nicoll 8e24a4153c Support ResolvableTypeProvider on simple event pojo
Previously, the generic type of a simple pojo event implementing
ResolvableTypeProvider wasn't detected properly. This commit fixes the
logic when the generic type is not provided to reuse what
PayloadApplicationEvent is already doing anyway.

Issue: SPR-14029
2016-03-09 11:55:20 +01:00
Sam Brannen 61824b1ade Remove trailing whitespace from source code 2016-02-29 18:52:57 +01:00
Juergen Hoeller 8e5e384de7 Test for constructor with unresolvable parameter name
Issue: SPR-13987
2016-02-29 11:18:23 +01:00
Juergen Hoeller 7b1fcfc7c3 Consistently strict parsing of date overflows (using java.time's strict resolution style)
Issue: SPR-13567
2016-02-23 16:12:26 +01:00
Juergen Hoeller a3789120c9 Support for @PropertySource annotations with custom implementation types
Issue: SPR-8963
2016-02-22 23:25:50 +01:00
Juergen Hoeller b9fe6d89da Avoid NPE in case of @Lazy @Autowired(required=false)
Issue: SPR-13967
2016-02-22 23:21:59 +01:00
Juergen Hoeller 700ab2fc98 DataBinder test for java.util.Optional property
Issue: SPR-13933
2016-02-19 19:21:09 +01:00
Juergen Hoeller a7ad49adcf Placeholder configurers allow for trimming of property values
Issue: SPR-5839
2016-02-19 19:19:39 +01:00
Juergen Hoeller 5ed9046886 BeanMethodInterceptor does not pass on null arguments for singleton beans
Issue: SPR-13887
2016-02-19 14:00:52 +01:00
Juergen Hoeller ea4a766df7 Consistent support for SpEL next to placeholders in annotation attributes
Issue: SPR-13625
2016-02-17 23:00:07 +01:00
Juergen Hoeller 51c35bf81c SpringValidatorAdapter exposes String attributes as MessageSourceResolvable
Issue: SPR-13406
2016-02-16 22:16:19 +01:00
Juergen Hoeller 4a0fa69ce4 Injection support for Collection/Map beans and self references
Issue: SPR-13585
Issue: SPR-12180
Issue: SPR-7915
Issue: SPR-8450
2016-01-25 21:25:48 +01:00
Juergen Hoeller 64ce8a81c3 Polishing 2016-01-25 20:33:48 +01:00
Juergen Hoeller d18b3f049a Tests for @Enable/@ComponentScan without @Configuration
Issue: SPR-10660
2016-01-25 20:32:45 +01:00
Andy Clement a12f23936c Allow use of '&' prefix to access factory bean in SpEL
Prior to this change SpEL did not have an syntactic
construct enabling easy access to a FactoryBean. With this
change it is now possible to use &foo in an expression when
the factory bean should be returned.

Issue: SPR-9511
2016-01-21 16:14:16 -08:00
Stephane Nicoll eb49f3c225 Add interface-based detection test
Add a test that explicitely validates that `@ManagedResource` and friends
can be set on an interface.

Issue: SPR-13138
2016-01-18 14:14:17 +01:00
Juergen Hoeller 182b1e99e3 TODO marker for test which fails as of AspectJ 1.9 beta 3
Issue: SPR-13839
2016-01-15 17:43:59 +01:00
Juergen Hoeller 27c2e8c80d Polishing 2015-12-29 21:40:20 +01:00
Juergen Hoeller 388bd87ef0 ComponentScan annotation is repeatable now
Issue: SPR-13151
2015-12-29 21:40:08 +01:00
Juergen Hoeller 4f955932a7 @Value can be used as aliased meta-annotation
Issue: SPR-13603
2015-12-29 18:02:16 +01:00
Juergen Hoeller 470ea977e1 Consistent validation of annotated methods behind AOP proxies
Issue: SPR-13816
2015-12-23 20:47:28 +01:00
Juergen Hoeller 1cfeb07fa5 Consistent use of varargs plus related polishing
(cherry picked from commit deae872)
2015-12-23 00:31:11 +01:00
Stephane Nicoll 0194988425 Store by value support for ConcurrentMapCacheManager
ConcurrentMapCacheManager and ConcurrentMapCache now support the
serialization of cache entries via a new `storeByValue` attribute. If it is
explicitly enabled, the cache value is first serialized and that content
is stored in the cache.

The net result is that any further change made on the object returned
from the annotated method is not applied on the copy held in the cache.

Issue: SPR-13758
2015-12-22 13:50:23 +01:00
Stephane Nicoll d444ef4871 Support for bean refs in event SpEL condition
Issue: SPR-13814
2015-12-22 11:30:40 +01:00
Stephane Nicoll 9b5e47026c Support for bean refs in caching SpEL expressions
Issue: SPR-13182
2015-12-22 11:05:24 +01:00
Stephane Nicoll 19d97c4253 Support for multi-threaded cache access
Previously, if a `@Cacheable` method was accessed with the same key by
multiple threads, the underlying method was invoked several times instead
of blocking the threads while the value is computed. This scenario
typically affects users that enable caching to avoid calling a costly
method too often. When said method can be invoked by an arbitrary number
of clients on startup, caching has close to no effect.

This commit adds a new method on `Cache` that implements the read-through
pattern:

```
<T> T get(Object key, Callable<T> valueLoader);
```

If an entry for a given key is not found, the specified `Callable` is
invoked to "load" the value and cache it before returning it to the
caller. Because the entire operation is managed by the underlying cache
provider, it is much more easier to guarantee that the loader (e.g. the
annotated method) will be called only once in case of concurrent access.

A new `sync` attribute to the `@Cacheable` annotation has been addded.
When this flag is enabled, the caching abstraction invokes the new
`Cache` method define above. This new mode bring a set of limitations:

* It can't be combined with other cache operations
* Only one `@Cacheable` operation can be specified
* Only one cache is allowed
* `condition` and `unless` attribute are not supported

The rationale behind those limitations is that the underlying Cache is
taking care of the actual caching operation so we can't really apply
any SpEL or multiple caches handling there.

Issue: SPR-9254
2015-12-21 13:34:35 +01:00
Juergen Hoeller fca5365cf1 Avoid scoped destruction callbacks in case of no post-processor actually applying
Issue: SPR-13744
2015-12-18 16:54:05 +01:00
Juergen Hoeller 967ef73765 Detect @Autowired constructors for configuration classes
Issue: SPR-13471
2015-12-18 15:31:31 +01:00
Stephane Nicoll 9e7c791a0f Automatically autowire a bean with one constructor
Previously, if a managed bean had only one non-default constructor, we
should still annotate it with `@Autowired` to properly use constructor
injection. Not doing so resulted in an error as the container was
trying to call the default (non-existing) constructor.

This commit updates this behaviour to automatically applyed the
autowiring semantic to any bean that has only one constructor. As
before, if more than one constructor is defined, `@Autowired` must be
specified to teach the container the constructor it has to use.

Issue: SPR-12278
2015-12-18 14:04:18 +01:00
Sam Brannen 5b3edcd9f9 Spring Cleaning in December
- Delete unused imports
- Delete unused code
- Clean up warnings
2015-12-17 20:27:33 +01:00
Juergen Hoeller def10343ea Unit tests for @Value Resource resolution
Issue: SPR-13731
2015-11-30 10:41:55 +01:00
Juergen Hoeller dd647659b3 Rearranged cache test class names across several modules 2015-11-26 16:30:44 +01:00
Juergen Hoeller 1da564d2f0 Joda/DateTimeFormatterRegistrar also supports YearMonth and MonthDay
Issue: SPR-13518
2015-11-25 23:39:14 +01:00
Juergen Hoeller bc0b707175 JodaTimeFormatterRegistrar supports Duration and Period as well
Issue: SPR-6706
2015-11-25 23:10:32 +01:00
Stephane Nicoll c90ca15add Fix caching tests
Update assertion to validate the proper exception type is thrown.
2015-11-25 17:49:44 +01:00
Juergen Hoeller 24e4f56d7e Test case for event listener methods on bean with potentially inactive scope
Also taking the opportunity to refine the "No Scope registered" exception message a bit.

Issue: SPR-13681
2015-11-25 16:56:39 +01:00
Juergen Hoeller d5ca5b74a5 DateTimeFormatterRegistrar supports Duration and Period as well
Issue: SPR-13721
2015-11-25 00:21:03 +01:00
Juergen Hoeller 20a286b4d6 ASM ClassWriter uses application ClassLoader for its getCommonSuperClass check
Issue: SPR-13695
2015-11-24 17:38:02 +01:00
Juergen Hoeller 3aefc96593 @ManagedOperationParameter declares @Target/@Retention/@Documented/@Repeatable now
This also turns @ManagedNotification into a repeatable annotation and consistently applies findAnnotation/getRepeatableAnnotations.

Issue: SPR-13700
2015-11-24 17:37:51 +01:00
Andy Clement 29303ef591 Allow MapAccessor to be compilable in SpEL expressions
With this change the MapAccessor now extends CompilablePropertyAccessor
rather than just PropertyAccessor. This means that any expression that
ends up using the MapAccessor is now compilable for fast performance.

Issue: SPR-13638
2015-11-23 09:25:57 -08:00
Juergen Hoeller 3cb926e01c Task list getters never return null now
Issue: SPR-13680
2015-11-13 20:26:44 +01:00
Juergen Hoeller d5efe4f983 Detect event listener methods behind interface proxies as well
Issue: SPR-13650
2015-11-09 15:00:03 +01:00
Stephane Nicoll 2a2a8d3f93 Allow null values to be cached with `@CacheResult`
Even though the JSR-107 spec forbids to store null values, our cache
abstraction allows that behaviour with a special handled (and this is
the default behaviour).

While this was working fine with our own set of annotations, the
JSR-107 interceptor counterpart was interpreting the spec sensu strictu.

We now allow for that special case as well.

Issue: SPR-13641
2015-11-09 13:04:40 +01:00
Juergen Hoeller 2ba5cb2734 Polishing 2015-11-05 12:30:29 +01:00
Juergen Hoeller 8c4b8d253a Auto-adapt reflective arguments in case of vararg array type mismatch
Issue: SPR-13328
2015-10-26 22:43:37 +01:00
Juergen Hoeller 66177dfd8c StreamUtils.emptyInput() for consistent empty InputStream exposure
Issue: SPR-13563
2015-10-12 22:25:40 +02:00
Juergen Hoeller dbec2121a0 EventListenerMethodProcessor does not validate target classes behind proxies anymore
Issue: SPR-13526
Issue: SPR-13538
2015-10-07 13:25:14 +02:00
Juergen Hoeller 427767f21e Fixed event listener caching through equals/hashCode on SyntheticParameterizedType
Issue: SPR-13540
2015-10-06 00:05:51 +02:00
Juergen Hoeller 668f5db582 Consistent use of UTC for DateTime tests
Issue: SPR-13536
2015-10-05 21:31:56 +02:00
Sam Brannen 3845eb3cbc Migrate Groovy tests to JUnit 4
Issue: SPR-13514
2015-09-28 21:19:53 +02:00
Sam Brannen d5ee787e1e Migrate JUnit 3 tests to JUnit 4
This commit migrates all remaining tests from JUnit 3 to JUnit 4, with
the exception of Spring's legacy JUnit 3.8 based testing framework that
is still in use in the spring-orm module.

Issue: SPR-13514
2015-09-27 21:17:51 +02:00
Juergen Hoeller 54d3d782a9 Polishing 2015-09-23 22:44:52 +02:00
Juergen Hoeller a23629f60f Context namespace exposes value-separator attribute for property-placeholder element
Issue: SPR-7794
2015-09-23 22:39:23 +02:00
Sam Brannen 54703bf3f8 Introduce ignored, failing tests for SPR-13475
This commit introduces ignored, failing tests that demonstrate that the
@Cache* annotations are not yet supported as merged composed annotations.

Issue: SPR-13475
2015-09-23 00:27:14 -04:00
Sam Brannen d66f85bd66 Polishing 2015-09-22 15:57:32 -04:00
Juergen Hoeller fbce18418a Context namespace exposes null-value attribute for property-placeholder element
Issue: SPR-13461
2015-09-21 20:47:03 +02:00
Juergen Hoeller 4dee9cbf62 ConcurrentMapCache.putIfAbsent properly supports nulls
Issue: SPR-13458
2015-09-10 14:02:18 +02:00
Sam Brannen 22e84a87f4 Polish proxy tests 2015-09-08 18:34:47 +02:00
Juergen Hoeller a8432bc8a1 Tests for enum array with varargs (and related refinements)
Issue: SPR-13328
2015-09-08 11:13:23 +02:00
Juergen Hoeller 811de8e50b AbstractApplicationContext allows for re-refresh and re-close
Issue: SPR-13425
2015-09-04 14:38:23 +02:00
Juergen Hoeller 7118fcff0d MethodValidationInterceptor falls back to invocation attempt with resolved bridge method (for Hibernate Validator 5.2 compatibility)
Issue: SPR-12237
2015-08-27 19:13:29 +02:00
Juergen Hoeller 3430f7623c Consistent detection of meta-annotation attributes via ASM
Issue: SPR-13394
2015-08-25 21:52:11 +02:00
Sam Brannen f47bbb0d9e Polish tests 2015-08-12 19:35:45 +02:00
Juergen Hoeller e0f012f32d Removal of redundant JdkVersion checks in the test suite
Issue: SPR-13312
2015-08-12 18:42:36 +02:00
Juergen Hoeller d8794a1edc Test against EhCache 3.0 M2 (as a JCache provider)
Includes latest dependency updates (Jackson 2.6.1, Jetty 9.3.2, Undertow 1.2.10)

Issue: SPR-13342
2015-08-12 16:16:25 +02:00
Juergen Hoeller 9ef38807e6 Polishing 2015-07-30 19:34:33 +02:00
Juergen Hoeller 1a636b1023 Polishing 2015-07-21 20:33:13 +02:00
Sam Brannen 0153913ef4 Polish and simplify EnableSchedulingTests 2015-07-20 14:55:48 +02:00
Juergen Hoeller cad0665187 Fixed exception message expectation plus formatting
Issue: SPR-13236
2015-07-20 13:01:14 +02:00
Juergen Hoeller c3e57dd245 AsyncAnnotationBeanPostProcessor tries to find TaskExecutor by type/name
Issue: SPR-13248
2015-07-17 18:55:46 +02:00
Juergen Hoeller 9f15f347bf Renamed 'name' attribute to 'scopeName' (in order to avoid common override conflicts)
Issue: SPR-13239
2015-07-17 15:23:47 +02:00
Juergen Hoeller ef781b6353 Fixed default formatters test to reliably work with any system locale
Issue: SPR-13232
2015-07-15 02:18:04 +02:00
Juergen Hoeller 2934256257 Polishing 2015-07-15 00:08:11 +02:00
Juergen Hoeller f4f508d869 Revisit date-time tests for compatibility with JDK 9 build 72
Issue: SPR-13232
2015-07-14 23:58:30 +02:00
Stephane Nicoll bf786c3176 Support for multiple events per method
In addition to specifying the event type to listen to via a method
parameter, any @EventListener annotated method can now alternatively
define the event type(s) to listen to via the "classes" attributes (that
is aliased to "value").

Something like

@EventListener({FooEvent.class, BarEvent.class})
public void handleFooBar() { .... }

Issue: SPR-13156
2015-07-08 14:51:07 +02:00
Sam Brannen 6c530b7bfb Delete trailing whitespace in XML files 2015-06-19 17:14:10 +02:00
Juergen Hoeller d7f8fa50be Polishing 2015-06-16 22:01:58 +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 10cb80a500 Removed superfluous @Ignore import
Issue: SPR-11807
2015-06-15 15:57:10 +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 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 ff8597fa80 Introduce alias for 'value' attribute in @ComponentScan.Filter
Issue: SPR-11393
2015-06-04 15:25:20 -04:00
Sam Brannen d3b5aeb768 Introduce alias for 'value' attribute in @ImportResource
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
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
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 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
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
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
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 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
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 e0d2dbd21d Polish Javadoc & TODOs in ApplicationListenerMethodAdapter
Issue: SPR-12738
2015-04-23 01:33:47 +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 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
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 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 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 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
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
Sam Brannen fcd60b269e Polish ScheduledTaskRegistrar(Tests) 2015-02-27 19:26:17 +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
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
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 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
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 981aefc2c0 Properly honor conditions on overriding bean methods
Issue: SPR-12694
2015-02-10 19:26:19 +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
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
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 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 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 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 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 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 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
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 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 f46c706e44 Bean method metadata exposed through AnnotatedBeanDefinition
Issue: SPR-12232
2014-09-26 14:46:09 +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 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 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 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 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