Commit Graph

643 Commits

Author SHA1 Message Date
tianjunwei 03b409f891 Use dedicated addAdvisors
See gh-1469
2017-07-12 17:22:26 +02:00
Juergen Hoeller cc74a2891a @Nullable all the way: null-safety at field level
This commits extends nullability declarations to the field level, formalizing the interaction between methods and their underlying fields and therefore avoiding any nullability mismatch.

Issue: SPR-15720
2017-06-30 01:54:16 +02:00
Juergen Hoeller 87430f3cd3 ListenableFuture provides CompletableFuture adaptation via completable()
Issue: SPR-15696
2017-06-27 00:43:37 +02:00
Stephane Nicoll 58242f2249 Polish 2017-06-13 10:13:14 +02:00
Stephane Nicoll fc64b8040f Polish "Replace relevant code with lambda"
Closes gh-1454
2017-06-13 09:42:20 +02:00
diguage 4b1478d830 Replace relevant code with lambda
See gh-1454
2017-06-13 08:55:38 +02:00
Juergen Hoeller 738160538e TargetSource.getTarget() is nullable again (for compatibility with MethodInvocation.getThis)
Issue: SPR-15651
2017-06-13 03:11:36 +02:00
Juergen Hoeller 47ec966757 TargetSource.getTarget() is nullable again (for compatibility with MethodInvocation.getThis)
Issue: SPR-15651
2017-06-12 22:54:18 +02: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
Sebastien Deleuze 87598f48e4 Introduce null-safety of Spring Framework API
This commit introduces 2 new @Nullable and @NonNullApi
annotations that leverage JSR 305 (dormant but available via
Findbugs jsr305 dependency and already used by libraries
like OkHttp) meta-annotations to specify explicitly
null-safety of Spring Framework parameters and return values.

In order to avoid adding too much annotations, the
default is set at package level with @NonNullApi and
@Nullable annotations are added when needed at parameter or
return value level. These annotations are intended to be used
on Spring Framework itself but also by other Spring projects.

@Nullable annotations have been introduced based on Javadoc
and search of patterns like "return null;". It is expected that
nullability of Spring Framework API will be polished with
complementary commits.

In practice, this will make the whole Spring Framework API
null-safe for Kotlin projects (when KT-10942 will be fixed)
since Kotlin will be able to leverage these annotations to
know if a parameter or a return value is nullable or not. But
this is also useful for Java developers as well since IntelliJ
IDEA, for example, also understands these annotations to
generate warnings when unsafe nullable usages are detected.

Issue: SPR-15540
2017-05-27 08:57:01 +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
Juergen Hoeller 0183576215 Polishing 2017-05-23 22:05:22 +02:00
Juergen Hoeller 6c43d14a77 Async annotations on interface methods with CGLIB proxies
Issue: SPR-14949
2017-04-26 18:16:40 +02:00
John Ryan 33d7816de3 Remove extraneous asterisk
Closes gh-1397
2017-04-21 09:48:03 +02:00
Juergen Hoeller 43e806c733 Refined log message for interface-implementing method
Issue: SPR-15436
(cherry picked from commit 665e6cf)
2017-04-17 19:47:24 +02:00
Juergen Hoeller 0d0b879a23 CglibAopProxy logs explicit warning for interface-implementing method marked as final
Issue: SPR-15436
2017-04-17 15:02:13 +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
Stephane Nicoll bf6e7d0c26 Update copyright header
Closes gh-1382
2017-04-09 09:47:16 +02:00
John S. Ryan 9287bbb91a Fix typo in AfterReturningAdviceInterceptor JavaDoc
See gh-1382
2017-04-09 09:45:46 +02:00
Juergen Hoeller 67ea4b3a05 package-info for repackaged libraries (and other polishing) 2017-04-06 14:10:46 +02:00
Juergen Hoeller f4de1ea147 Polishing 2017-02-22 15:32:19 +01:00
Juergen Hoeller 5f531a7a7d Comparators entry point with generically typed factory methods
Issue: SPR-14779
2017-02-15 18:05:32 +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 ed40b1c8ee Remove outdated abstractions/delegates from core/util
Issue: SPR-15159
2017-01-23 13:41:55 +01:00
Juergen Hoeller fc629bb508 Polishing 2016-12-29 22:39:36 +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 a8741dd371 Polishing 2016-12-26 11:26:58 +01:00
Juergen Hoeller f51fe5fd39 Polishing 2016-12-23 12:27:07 +01:00
Juergen Hoeller d64d9ab370 Consistent ClassLoader propagation and ConcurrentHashMap setup for AspectJ pointcuts
Issue: SPR-15040
2016-12-22 17:00:04 +01:00
Juergen Hoeller 97ea22cb4a Defensively catch any exception from match attempts (for compatibility with AspectJ 1.8.10)
Issue: SPR-15019
2016-12-20 12:17:51 +01:00
Juergen Hoeller 3370f41c61 Defensively catch IllegalStateException from match attempts (for compatibility with AspectJ 1.8.10)
Issue: SPR-15019
2016-12-14 22:06:13 +01:00
Juergen Hoeller 6d1cae2f57 Avoid proxy replacement for generic return type signatures
Issue: SPR-15010
2016-12-14 22:00:41 +01:00
Juergen Hoeller 84d3808b3b Upgrade to Mockito 2.2
Issue: SPR-14880
2016-11-03 22:53:35 +01:00
Juergen Hoeller 36332441ae DefaultListableBeanFactory allows early type matching against ScopedProxyFactoryBean
Issue: SPR-14816
2016-10-28 23:37:58 +02:00
Juergen Hoeller 5ac5ec1046 No external locking for singleton advice/aspect beans
Issue: SPR-14324
2016-10-28 23:35:01 +02:00
Juergen Hoeller 3726c6f18d Polishing 2016-10-21 12:26:27 +02:00
Juergen Hoeller cfa0f6c84b Consistent final logger fields 2016-10-04 23:00:36 +02:00
Juergen Hoeller ab0d523cc0 Polishing
(cherry picked from commit 1932a9d)
2016-08-17 21:54:40 +02:00
Juergen Hoeller 214c919742 AspectJ bean pointcut supports qualifier match
Issue: SPR-11217
2016-08-17 00:43:41 +02:00
Juergen Hoeller b9ab895743 Inferred generics for newSetFromMap arrangements
Issue: SPR-13188
2016-07-26 21:26:31 +02:00
Juergen Hoeller e03dea1d64 Polishing 2016-07-26 17:15:19 +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 88fcd0a2ed Framework build compatible with JDK 9 (tests running against java.base module)
Issue: SPR-13344
2016-07-19 19:37:34 +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 a1f5fb53db Java 8 getParameterCount() instead of getParameterTypes().length
Issue: SPR-13188
2016-07-07 01:04:24 +02:00
Stephane Nicoll e4b0486c5a Add @FunctionalInterface on candidate interfaces
Issue: SPR-14432
2016-07-06 14:32:13 +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
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 51252ebbca Avoid defensive checks against Java 8 API (java.util.Optional etc)
This commit also fixes broken javadoc links and code references.

Issue: SPR-13188
2016-07-05 02:09:00 +02:00
Juergen Hoeller fd9d518c36 Avoid potential deadlock in AbstractBeanFactoryPointcutAdvisor
Issue: SPR-14388
2016-06-22 14:41:20 +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 162aedccbe Polishing 2016-05-04 17:02:16 +02:00
Juergen Hoeller e6e3ca3e96 LazySingletonAspectInstanceFactoryDecorator uses shared singleton mutex
Issue: SPR-14241
2016-05-04 09:03:28 +02:00
Johnny Lim 44e652f99e Remove duplicate words
Closes gh-1039
2016-04-19 08:24:21 +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 54aeb7a5d6 Cache key classes implement Comparable and consistently provide a toString representation
Issue: SPR-14017
2016-03-26 14:32:10 +01:00
Juergen Hoeller 517ebd1d3e Consistent formatting 2016-03-24 19:22:50 +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 f2f87ff1e0 Explicit javadoc references to BeanFactory-based default executor lookup
Issue: SPR-14030
2016-03-11 23:52:31 +01:00
Juergen Hoeller 155fa3754b Consistent lazy resolution of default executor/scheduler for Async/ScheduledAnnotationBeanPostProcessor
Issue: SPR-14030
2016-03-11 23:23:58 +01:00
Juergen Hoeller ab16053ed4 Redistribute AOP Alliance interfaces in spring-aop again (as in Spring 2.x)
Issue: SPR-13984
2016-02-26 12:40:00 +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
Juergen Hoeller 4adb7e2500 AOP proxies with annotation-based aspects are serializable now
Issue: SPR-6910
2015-12-22 21:20:33 +01:00
Stephane Nicoll 752d3c715a Initiate structure for 4.3 XSDs 2015-12-17 15:43:23 +01:00
Juergen Hoeller 753347ea98 Consistent static final logger declarations 2015-12-16 20:44:00 +01:00
Juergen Hoeller 11806b9215 Class identity comparisons wherever possible (and further polishing)
Issue: SPR-12926
2015-12-09 12:28:09 +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
Sam Brannen de9c030ba1 Suppress warnings in Gradle build 2015-11-17 14:10:35 +01:00
Juergen Hoeller 4b2ce60d65 Polishing 2015-11-13 08:31:13 +01:00
Juergen Hoeller 98be36a306 Extended default collection size for common per-bean caches
Issue: SPR-13621
2015-11-13 08:31:00 +01:00
Juergen Hoeller 7b711c4aac AbstractAutoProxyCreator uses prefixed bean name as cache key
Issue: SPR-13655
2015-11-13 08:26:43 +01:00
Juergen Hoeller 90c9d96a4d Avoid exposeTargetClass attempt if bean name is null
Issue: SPR-13650
2015-11-13 08:23:15 +01:00
Johnny Lim 2defb6555e Fix broken Javadoc related to `<` and `>` 2015-11-12 11:22:08 +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
Juergen Hoeller 400749667a Polishing 2015-10-26 23:10:33 +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
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
Sam Brannen d91806d7ab Suppress warnings in Gradle build 2015-09-24 19:56:10 +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
Kazuki Shimizu 9524f96405 Fix default value of CommonsPool2TargetSource#maxWait
Issue: SPR-13350
2015-08-14 16:34:32 +02:00
Stephane Nicoll a3f39d5257 Add missing 4.2 XSDs
Issue: SPR-13300
2015-08-01 09:50:36 +02:00
Juergen Hoeller edd6e76b9f Polishing 2015-07-21 22:58:34 +02:00
Juergen Hoeller 2934256257 Polishing 2015-07-15 00:08:11 +02:00
Juergen Hoeller dd4bc630c3 Common code in AsyncExecutionAspectSupport allows for CompletableFuture processing with AspectJ as well
Issue: SPR-13128
2015-06-22 00:29:44 +02:00
Juergen Hoeller 600e5915b4 ObjenesisCglibAopProxy defensively catches Throwable
Issue: SPR-13131
2015-06-17 17:03:01 +02:00
Juergen Hoeller 9f64230131 TransactionAttributeSourcePointcut pointcut skips target classes with TransactionalProxy marker (e.g. Spring Data proxies)
This 4.2 commit also makes TransactionProxyFactoryBean expose the TransactionalProxy marker and refines SpringProxy marker handling.

Issue: SPR-13109
2015-06-17 13:02:26 +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
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 75edb3979e AspectJExpressionPointcut defensively catches exceptions thrown from ShadowMatch.matchesJoinPoint
Issue: SPR-13102
2015-06-11 14:44:19 +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 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
Stephane Nicoll 3d86f15a84 Merge BeanWrapperImpl and DirectFieldAccessor
`BeanWrapperImpl` and `DirectFieldAccessor` are two
`ConfigurablePropertyAccessor` implementations with different features
set.

This commit harmonizes the two implementations to use a common base class
that delegates the actual property handling to the sub-classes:

* `BeanWrapperImpl`:  `PropertyDescriptor` and introspection utilities
* `DirectFieldAccessor`: reflection on `java.lang.Field`

Issues: SPR-12206 - SPR-12805
2015-05-21 13:49:55 +02:00
Juergen Hoeller b4095c3e1d Class identity comparisons wherever possible
Issue: SPR-12926
2015-05-20 14:34:16 +02:00
Sam Brannen 1f54ba001b Polish Javadoc for AopUtils, Advised, & related classes 2015-05-09 20:32:27 +02:00
Juergen Hoeller dbd82d128d Polishing 2015-05-07 20:18:17 +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 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 bc6a98c144 Polishing (in particular updating javadoc references to Apache Commons) 2015-03-13 18:19:10 +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
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
Juergen Hoeller ee74fe6c27 Latest dependency updates (HttpClient 4.4, TestNG 6.8.21, SnakeYAML 1.15, FreeMarker 2.3.22, JRuby 1.7.19, JAMon 2.81, JiBX 1.2.6, XMLUnit 1.6, JsonPath 1.2) 2015-03-02 20:00:17 +01:00
Stephane Nicoll babbf6e871 Harmonize resources location
Issue: SPR-12766
2015-02-28 10:32:40 +01:00
Juergen Hoeller 287045ef74 Allow for shared Objenesis caching in ObjenesisCglibAopProxy
Issue: SPR-12755
2015-02-26 18:34:52 +01:00
Stephane Nicoll 44075d7205 Add missing test
Add test that wasn't committed because it matches the ignore list.
2015-02-25 13:29:10 +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
John Tims 4c00a3b4c8 fix javadoc typo 2015-02-12 08:43:01 +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 86b8112c90 Polishing 2014-12-29 15:13:40 +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 1146d5ba1d Polishing 2014-10-29 22:44:59 +01:00
Juergen Hoeller 8325b10080 Consistent formatting of license headers, package javadocs, and import declarations 2014-10-21 01:44:07 +02:00
Juergen Hoeller fb08644e46 ExposeInvocationInterceptor declares itself as PriorityOrdered now
Issue: SPR-12351
2014-10-20 15:45:09 +02:00
Juergen Hoeller 5a631177ff Consistent use of LinkedHashSet for interfaces (since interface order may matter in subtle cases) 2014-10-07 16:37:59 +02:00
Juergen Hoeller 9d832816a8 Further locking optimizations for the retrieval of non-singleton beans
Issue: SPR-12250
2014-10-06 17:42:51 +02:00
Juergen Hoeller 98eb0f75bc Polishing 2014-09-02 22:15:53 +02:00
Juergen Hoeller 51e4b07856 JamonPerformanceMonitorInterceptor tracks exceptions as well (consistent with JAMon's other interceptors)
Issue: SPR-12068
2014-08-18 21:50:24 +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 ad475ffadf Consistent vararg declarations for String array setters 2014-08-08 17:17:09 +02:00
Stephane Nicoll 3da68cfe21 Remove unused imports 2014-08-04 14:13:40 +02:00
Stephane Nicoll 9fe7780865 Revert accidental class name change 2014-07-30 08:53:14 +02:00
Kang Baek-kyu c7babab2dd Fix javadoc typo 2014-07-30 08:47:01 +02:00
Juergen Hoeller 9d6c38bd54 Consistent bracket alignment 2014-07-18 17:21:58 +02:00
Stephane Nicoll b676c41805 Add missing 4.1 XSDs
This commit adds the missing 4.1 XSDs for the following components:

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

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

Issue: SPR-11990
2014-07-14 17:59:54 +02:00
Juergen Hoeller 442bd682a7 Polishing
Issue: SPR-11910
2014-06-26 18:14:51 +02:00
Juergen Hoeller a9b650fd0f DefaultAdvisorChainFactory never passes null into ClassFilter, enabling async advisor to work without target class as well
Issue: SPR-11910
2014-06-26 18:12:44 +02:00
Juergen Hoeller 46dc07a005 AsyncExecutionInterceptor uses submitListenable if method signature indicates ListenableFuture
Issue: SPR-11909
2014-06-26 15:19:17 +02:00
Juergen Hoeller 18131bf611 Consistent declaration of private static final logger variables
Issue: SPR-11905
2014-06-24 14:02:05 +02:00
Juergen Hoeller 03ce4a5024 Polishing 2014-05-20 00:31:24 +02:00
Juergen Hoeller 7230d6a1aa Polishing 2014-05-15 17:07:13 +02:00
Juergen Hoeller b0f0d2f289 Polishing 2014-05-15 14:39:06 +02:00
Juergen Hoeller 1b2014a52d AbstractAutoProxyCreator and AbstractAdvisingBeanPostProcessor consistently not considering configuration callbacks and internal language interfaces as reasonable proxy interfaces
Issue: SPR-11715
2014-04-29 19:07:29 +02:00
Juergen Hoeller a0658c5832 AbstractAdvisingBeanPostProcessor uses target class check for existing proxy but checks against actual exposed object otherwise (catching introductions)
Issue: SPR-11725
2014-04-29 15:44:55 +02:00
Juergen Hoeller be5f2a8b4e Polishing 2014-04-28 23:37:07 +02:00
Juergen Hoeller ce4912b627 AspectJExpressionPointcut defensively handles fallback expression parsing
Issue: SPR-9335
2014-04-28 21:49:36 +02:00
Juergen Hoeller 9353332a61 Polishing 2014-04-23 23:55:43 +02:00
Philippe Marschall fc3df29b2e Clean up spring-aop tests warnings
Clean up compiler warnings in the tests of spring-aop. This commit
adds type parameters to all the types.
2014-04-22 07:27:43 +02:00
Sam Brannen a0b6175d78 Update doc for DefaultAopProxyFactory re: CGLIB 2014-04-21 11:11:14 -04:00
Juergen Hoeller 90309ab0b5 CglibAopProxy detects package-visible methods when defined in a different ClassLoader
Issue: SPR-11618
2014-04-16 18:07:10 +02:00
Stephane Nicoll db23ec733b Add exception handling of asynchronous method
Prior to this commit, an exception thrown by an @Async void method
was not further processed as there is no way to transmit that
exception to the caller.

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

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

Issue: SPR-8995
2014-04-02 15:04:40 +02:00
Stephane Nicoll dcf5f4a6a3 javax.annotation.Priority alternative to @Order
This commit rationalizes the use of @Order so that the standard
@Priority annotation can be used instead. The handling of both
annotations are now defined in OrderUtils.

This also updates the link to the JavaEE API so that we refer to
JavaEE7 instead of JavaEE6.

Issue: SPR-11639
2014-04-01 14:30:47 +02:00
Stephane Nicoll 4cd818b9e4 Harmonize log configuration
Prior to this commit, the codebase was using a mix of log4j.xml
and log4j.properties for test-related logging configuration. This
can be an issue as log4j takes the xml variant first when looking
for a default bootstrap configuration.

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

The general structure of the configuration has also been
harmonized to provide a standard console output as well as an
easy way to enable trace logs for the current module.
2014-03-20 09:43:29 -07:00
Juergen Hoeller 189cd663c5 Polishing 2014-03-15 00:46:06 +01:00
Juergen Hoeller 949338009b Ignore container callback and marker interfaces for auto-proxy decisions
Issue: SPR-11416
2014-02-12 00:01:20 +01:00
Sam Brannen 1f778530b5 Polish test classes
- Consistent importing of org.junit.Assert.*;
- Proper declaration of expected exceptions via @Test(expected).
- Renamed SpEL ExpressionTestCase to AbstractExpressionTests.
- Formatting and test method naming conventions.
2014-02-08 17:24:11 +01:00
Juergen Hoeller 8c4e372558 Introduced SpringNamingPolicy for CGLIB
Issue: SPR-11398
2014-02-06 20:25:11 +01:00
Juergen Hoeller 56b7d7a94a Consistently declare @SuppressWarnings("serial") instead of dummy serialVersionUID 2014-01-26 00:11:11 +01:00
Juergen Hoeller 3310ab55e0 Polishing
Issue: SPR-11344
(cherry picked from commit d434ef9)
2014-01-23 00:10:02 +01:00
Juergen Hoeller 6a6a23f0a3 Avoid class loading during AspectJ expression evaluation
Fixed through downcasting to AspectJ's ReflectionType and ReflectionBasedReferenceTypeDelegate, obtaining the myClass field there. We only fall back to regular class loading if we encounter any other kind of type.

Issue: SPR-11344
(cherry picked from commit c406c56)
2014-01-23 00:06:43 +01:00
Juergen Hoeller 12c393eb6d Switched 'order' attributes across namespaces to 'xsd:token'
Issue: SPR-10886
Issue: SPR-7342
2014-01-22 11:35:21 +01:00
Juergen Hoeller f15a5fef8e Fixed assert in setAspectJAdvisorFactory()
Issue: SPR-11330
2014-01-20 17:37:50 +01:00
Juergen Hoeller 675b650290 Polishing 2014-01-05 00:16:01 +01:00
Juergen Hoeller a2d40f3f16 Polishing 2014-01-04 22:48:06 +01:00
Juergen Hoeller 0de307bb65 Consistent equals/hashCode/toString implementations in AnnotationMatchingPointcut/ClassFilter/MethodMatcher
Issue: SPR-11275
Issue: SPR-11276
2014-01-04 22:47:33 +01:00
Juergen Hoeller 61a3d04e91 Set scoped proxy role to same role as target definition
This allows scoped proxy definitions to override regular application bean definitions (again).

Issue: SPR-11229
2013-12-16 21:47:35 +01:00
Juergen Hoeller 9fbb57c3ec Fixed CGLIB class validation to not raising warning for static final methods
Issue: SPR-11107
2013-12-11 12:34:59 +01:00
Juergen Hoeller 8580d2d19e Fixed detection of generic types and qualifier annotations on scoped-proxy factory methods
Issue: SPR-11116
2013-12-08 23:24:16 +01:00
Juergen Hoeller 8f1fefc159 Fixed javadoc 2013-12-02 14:55:56 +01:00
Phillip Webb 043a41e382 Consistent whitespace after imports
Update code to have a consistent number of new-line characters after
import statements.
2013-11-26 15:14:43 -08:00
Eric Dahl e9f78f6043 Fix various typos
Fix a variety of typos throughout the project, primarily in
comments (javadoc or otherwise) but also in a handful of log messages
and a couple exception messages.

ISSUE: SPR-11123
2013-11-25 15:58:27 -08:00
Phillip Webb 59002f2456 Fix remaining compiler warnings
Fix remaining Java compiler warnings, mainly around missing
generics or deprecated code.

Also add the `-Werror` compiler option to ensure that any future
warnings will fail the build.

Issue: SPR-11064
2013-11-25 12:52:42 -08:00
Juergen Hoeller eed1a323d1 Polishing (along with SPR-10992) 2013-11-04 23:44:47 +01:00
Juergen Hoeller 62157fe38f Refined logging for advisors which are currently in creation
Issue: SPR-10430
2013-10-30 00:29:21 +01:00
Juergen Hoeller d3f063d0f9 After-returning advice strictly follows AspectJ's rules for return value matching
Issue: SPR-10834
2013-09-26 20:27:45 +02:00
Oliver Gierke 1f9e8f68d4 Add support for Objenesis proxy creation.
Extended DefaultAopProxyFactory to create Objenesis based proxies if the
library is on the classpath. This allows classes without a default
constructor being CGLib proxied. We're now falling back to original CGLib
based behavior in case the proxy creation using Objenesis fails.

Objenesis 2.0 is now inlined into spring-core to avoid interfering with
other Objenesis versions on the classpath.

Issue: SPR-10594
2013-09-12 16:32:27 -07:00
Juergen Hoeller 091712df06 Consistent use of Class<?> 2013-08-28 00:03:58 +02:00
Juergen Hoeller 3d462b6dd9 Added missing spring.schemas entries for 4.0 xsds
Also fixing an old XmlBeanFactory test that relies on "ref local" which is gone in the 4.0 xsd now, redeclaring the affected file to an older xsd version.
2013-08-22 19:36:53 +02:00
Juergen Hoeller 1420b970a7 Introduced DefaultParameterNameDiscoverer which checks JDK 8's standard reflection first and then falls back to ASM-based debug symbol analysis
Also, StandardReflectionParameterNameDiscoverer calls "Parameter.isNamePresent()" now to return null (and pass on to the next discoverer) if no JDK 8 parameters are available. Note that this requires OpenJDK 8 b100 or higher to compile now.

Issue: SPR-10532
2013-08-08 15:52:43 +02:00
Juergen Hoeller f329140dd4 Fixed ClassFilterAwareUnionMethodMatcher equals implementation
Issue: SPR-10604
2013-08-02 10:34:28 +02:00
Juergen Hoeller b6c54c3637 Moved executor null check to AsyncExecutionInterceptor, allowing AbstractAsyncExecutionAspect to fall back to sync execution (as in 3.2.1)
Issue: SPR-10636
2013-07-24 15:30:18 +02:00
Juergen Hoeller 01a71ef5ef Polishing 2013-07-24 13:40:15 +02:00
Phillip Webb 587877c6da Add MemorySafeUndeclaredThrowableStrategy
Port the latest unreleased UndeclaredThrowableStrategy implementation
from cglib to fix a memory-leak present in v3.

Issue: SPR-10709
2013-07-19 14:36:19 -07:00
Carson McDonald ae74a2158a Fix typo {explictly => explicitly}
- cherry-pick of pull request #257, which originally applied to 3.2.x
2013-05-31 08:22:36 +02:00
Juergen Hoeller 814d24e64f Consistent detection of Order annotation in superclasses and interfaces
Issue: SPR-10514
2013-05-16 18:05:56 +02:00
Juergen Hoeller 59ef34d769 Polishing 2013-05-14 21:20:24 +02:00
Rob Winch 9468548116 Add @Override to remaining source files
Issue: SPR-10130
2013-05-13 17:04:56 -05:00
Juergen Hoeller 0fc5a5d912 Introduced 4.0 versions of all XML configuration schemas
Removed spring-beans.dtd (the 1.x variant) and spring-oxm-1.5.xsd (pre-Spring-Framework variant), in order to raise the backwards compatibility limit a little bit at least. We'll keep supporting the 2.0 and 2.5 xsd versions for the time being, as well as spring-beans-2.0.dtd.

Removed the ref 'local' attribute in spring-beans-4.0.xsd since 'local' lost its differentiating role to a regular bean ref back in the 3.1 days when we started allowing for the same bean id to reappear in a different beans section of the same configuration file (with a different profile).

Issue: SPR-10437
2013-05-07 18:11:51 +02:00
Juergen Hoeller 0a8f5b2919 Removed deprecated helper classes and methods (that have been deprecated since 3.0 or before) 2013-05-02 17:25:10 +02:00
Juergen Hoeller 853826a774 Use JDK 1.6's Collections.newSetFromMap instead of manually accessing Maps with dummy Boolean values 2013-03-28 22:14:26 +01:00
Juergen Hoeller 27693bbc83 CustomizableTraceInterceptor relies on JDK 1.5+ Matcher.quoteReplacement method now 2013-03-19 13:15:45 +01:00
Phillip Webb 4e1cab28df Merge branch '3.2.x'
* 3.2.x: (28 commits)
  Hide 'doc' changes from jdiff reports
  Document @Bean 'lite' mode vs @Configuration
  Final preparations for 3.2.2
  Remove Tiles 3 configuration method
  Polishing
  Extracted buildRequestAttributes template method from FrameworkServlet
  Added "beforeExistingAdvisors" flag to AbstractAdvisingBeanPostProcessor
  Minor refinements along the way of researching static CGLIB callbacks
  Compare Kind references before checking log levels
  Polish Javadoc in RequestAttributes
  Fix copy-n-paste errors in NativeWebRequest
  Fix issue with restoring included attributes
  Add additional test for daylight savings glitch
  Document context hierarchy support in the TCF
  Fix test for daylight savings glitch
  Make the methodParameter field of HandlerMethod final
  Disable AsyncTests in spring-test-mvc
  Reformat the testing chapter
  Document context hierarchy support in the TCF
  Document context hierarchy support in the TCF
  ...
2013-03-13 14:01:46 -07:00
Juergen Hoeller 43c1cec79b Added "beforeExistingAdvisors" flag to AbstractAdvisingBeanPostProcessor
Just AsyncAnnotationBeanPostProcessor switches "beforeExistingAdvisors" to "true" by default. So effectively, MethodValidation/PersistenceExceptionTranslationPostProcessor apply after existing advisors by default again, fixing the 3.1->3.2 regression.

Issue: SPR-10309
2013-03-13 16:58:00 +01:00
David Harkness 801f196de0 Compare Kind references before checking log levels
Assuming reference comparisons are much quicker than checking
likely-nested logger levels, perform the former first.

Also, since the reference can match only one of the instances,
use "else if" to short-circuit the search.
2013-03-13 08:52:21 -07:00
Phillip Webb 05765d7520 Replace EasyMock with Mockito
Issue: SPR-10126
2013-03-06 11:06:15 -08:00
Chris Beams ce4be3b46b Merge branch '3.2.x' into master
Conflicts:
	gradle.properties
	spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java
	spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java
	spring-core/src/main/java/org/springframework/core/convert/support/StringToEnumConverterFactory.java
	spring-core/src/main/java/org/springframework/core/env/ReadOnlySystemAttributesMap.java
	spring-jdbc/src/main/java/org/springframework/jdbc/datasource/LazyConnectionDataSourceProxy.java
	spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/AbstractLobHandler.java
	spring-web/src/main/java/org/springframework/http/client/BufferingClientHttpRequestWrapper.java
	spring-web/src/main/java/org/springframework/http/client/SimpleBufferingClientHttpRequest.java
	spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java
	spring-web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java
2013-03-04 15:41:15 +01:00
Juergen Hoeller 89c3d03083 @Async's qualifier works for target class annotations behind a JDK proxy as well
Also optimized AsyncExecutionAspectSupport's Executor-per-Method caching to use a ConcurrentHashMap.

Issue: SPR-10274
2013-02-08 16:08:05 +01:00
Juergen Hoeller 2aaa66f86b Allow for ordering of mixed AspectJ before/after advices
Issue: SPR-9438
2013-02-07 22:02:40 +01:00
Juergen Hoeller d3969de101 Allow for ordering of mixed AspectJ before/after advices
Issue: SPR-9438
2013-02-07 14:11:24 +01:00
Phillip Webb f464a45ba4 Polish formatting
Minor formatting polish across that codebase. Primarily fixing
whitespace issues.
2013-02-04 10:35:25 -08:00
Phillip Webb d89e30b864 Fix unnecessary @SupressWarnings annotations 2013-01-29 15:37:25 -08:00
Phillip Webb 6a1e841952 Fix unused type compiler warnings 2013-01-25 14:35:07 -08:00
Phillip Webb 88f5dd6ce1 Fix 'is already an instance of type' warnings 2013-01-25 11:29:54 -08:00
Juergen Hoeller 97ae403b53 AbstractAdvisingBeanPostProcessor caches per bean target class, working for null bean names as well
Issue: SPR-10144
2013-01-10 17:00:41 +01:00
Chris Beams 51b307681a Fix warnings due to unused import statements
Issue: SPR-9431
2013-01-04 11:04:54 +01:00
Phillip Webb 42b5d6dd7e Remove duplicate test classes
Prior to this commit many test utility classes and sample beans were
duplicated across projects. This was previously necessary due to the
fact that dependent test sources were not shared during a gradle
build. Since the introduction of the 'test-source-set-dependencies'
gradle plugin this is no longer the case.

This commit attempts to remove as much duplicate code as possible,
co-locating test utilities and beans in the most suitable project.
For example, test beans are now located in the 'spring-beans'
project.

Some of the duplicated code had started to drift apart when
modifications made in one project where not ported to others. All
changes have now been consolidated and when necessary existing tests
have been refactored to account for the differences.

Conflicts:
	spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java
	spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java
	spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java
2013-01-04 10:02:29 +01:00
Chris Beams 961dbdb68a Merge branch '3.2.x' into master
* 3.2.x:
  Exclude spring-build-src from maven publish
  Move spring-build-junit into spring-core
  Relocate MergePlugin package
  Develop a gradle plugin to add test dependencies
  Expose Gradle buildSrc for IDE support
  Fix [deprecation] compiler warnings
  Upgrade to xmlunit version 1.3
  Improve 'build' folder ignores
  Fix regression in static setter method support
  Fix SpEL JavaBean compliance for setters

Conflicts:
	spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java
2013-01-02 10:36:57 +01:00
Chris Beams 70eaf02b7f Revert "Merge branch 'SPR-10130' into cleanup-master"
This reverts commit 45fa50821a, reversing
changes made to a312d900f8.
2013-01-02 10:33:59 +01:00
Phillip Webb 65fb26f847 Move spring-build-junit into spring-core
Move code from spring-build-junit into spring-core/src/test along with
several other test utility classes. This commit removes the temporary
spring-build-junit project introduced in commit
b083bbdec7.
2013-01-01 19:49:45 -08:00
Phillip Webb 6626a38730 Fix [deprecation] compiler warnings
Fix deprecation compiler warnings by refactoring code or applying
@SuppressWarnings("deprecation") annotations. JUnit tests of
internally deprecated classes are now themselves marked as
@Deprecated.

Numerous EasyMock deprecation warnings will remain until the
migration to mockito can be completed.
2013-01-01 13:42:15 -08:00
Chris Beams d5c6d797e5 Merge branch '3.2.x' into master
* 3.2.x:
  Add aop target source test to TestGroup.PERFORMANCE
2012-12-29 01:05:56 +01:00
Chris Beams 55a05744f7 Merge branch 'SPR-9984' into 3.2.x
* SPR-9984:
  Add aop target source test to TestGroup.PERFORMANCE
2012-12-29 01:05:46 +01:00
Chris Beams 90d1886cbd Add aop target source test to TestGroup.PERFORMANCE
Issue: SPR-9984
2012-12-29 01:04:57 +01:00
Chris Beams b2a048b6f3 Update Apache license headers for affected sources 2012-12-28 23:57:33 +01:00
Chris Beams 3b40ce76bf Add @Override annotations to main sources
Issue: SPR-10130
2012-12-28 23:53:24 +01:00
Chris Beams 8472a2b2ab Update Apache license headers for affected sources 2012-12-28 23:09:31 +01:00
Phillip Webb d66c733ef4 Replace EasyMock with Mockito in test sources
Issue: SPR-10126
2012-12-28 23:07:04 +01:00
Chris Beams 4c8cd7b0bd Add @Override annotations to test sources
Issue: SPR-10129
2012-12-28 23:05:44 +01:00
Chris Beams 4c7cafbde6 Fix "unnecessary @SuppressWarnings" warnings 2012-12-28 22:50:46 +01:00
Phillip Webb 6c14eaad61 Fix [cast] compiler warnings 2012-12-28 22:41:06 +01:00
Phillip Webb b0986049a3 Fix [serial] compiler warnings
Fix serialization warnings by applying @SuppressWarnings("serial")
when appropriate.

In certain cases and for unknown reasons, a correctly-placed
@SuppressWarnings("serial") annotation will fix the warning at the
javac level (i.e. the Gradle command-line), but will produce an
"unnecessary @SuppressWarnings" warning within Eclipse. In these
cases, a private static final serialVersionUID field has been added
with the default value of 1L.
2012-12-28 22:41:06 +01:00
Chris Beams 9540d2c81b Replace <code> with {@code} throughout Javadoc
Issue: SPR-10128
2012-12-28 22:36:02 +01:00
Chris Beams 8597ec25ec Fix various Javadoc warnings
Issue: SPR-10128
2012-12-28 22:36:02 +01:00
Phillip Webb 2cf45bad86 Replace space indentation with tabs
Issue: SPR-10127
2012-12-28 20:49:56 +01:00
Phillip Webb 1762157ad1 Remove trailing whitespace in source files
find . -type f -name "*.java" -or -name "*.aj" | \
    xargs perl -p -i -e "s/[ \t]*$//g" {} \;

Issue: SPR-10127
2012-12-28 20:49:45 +01:00
Juergen Hoeller 047db8cdf8 Fixed AbstractAutoProxyCreator to accept null bean names again
Issue: SPR-10108
2012-12-20 17:33:26 +01:00
Juergen Hoeller b9df7d68d9 Consistent fine-tuning of synchronized and concurrent data structures
In particular, avoiding synchronized Sets and Maps wherever possible (preferring a ConcurrentHashMap even instead of a synchronized Set) and specifying appropriate ConcurrentHashMap initial capacities (even if we end up choosing 16).
2012-12-12 23:46:26 +01:00
Chris Beams f26534700a Eliminate all Javadoc warnings
- Support external Javadoc links using Gradle's javadoc.options.links

 - Fix all other Javadoc warnings, such as typos, references to
   non-existent (or no longer existent) types and members, etc,
   including changes related to the Quartz 2.0 upgrade (SPR-8275) and
   adding the HTTP PATCH method (SPR-7985).

 - Suppress all output for project-level `javadoc` tasks in order to
   hide false-negative warnings about cross-module @see and @link
   references (e.g. spring-core having a @see reference to spring-web).
   Use the `--info` (-i) flag to gradle at any time to see project-level
   javadoc warnings without running the entire `api` task. e.g.
   `gradle :spring-core:javadoc -i`

 - Favor root project level `api` task for detection of legitimate
   Javadoc warnings. There are now zero Javadoc warnings across the
   entirety of spring-framework. Goal: keep it that way.

 - Remove all @link and @see references to types and members that exist
   only in Servlet <= 2.5 and Hibernate <= 4.0, favoring 3.0+ and 4.0+
   respectively. This is necessary because only one version of each of
   these dependencies can be present on the global `api` javadoc task's
   classpath. To that end, the `api` task classpath has now been
   customized to ensure that the Servlet 3 API and Hibernate Core 4 jars
   have precedence.

 - SPR-8896 replaced our dependency on aspectjrt with a dependency on
   aspectjweaver, which is fine from a POM point of view, but causes
   a spurious warning to be emitted from the ant iajc task that it
   "cannot find aspectjrt on the classpath" - even though aspectjweaver
   is perfectly sufficient. In the name of keeping the console quiet, a
   new `rt` configuration has been added, and aspectjrt added as a
   dependency to it. In turn, configurations.rt.asPath is appended to
   the iajc classpath during both compileJava and compileTestJava for
   spring-aspects.

Issue: SPR-10078, SPR-8275, SPR-7985, SPR-8896
2012-12-12 12:55:10 +01:00
Juergen Hoeller 801d4714b1 Fixed CGLIB proxy class leaks through further equals/hashCode implementations in Spring AOP pointcuts
Issue: SPR-8008
2012-12-12 03:29:43 +01:00
Ezequiel Ballesi b43bc8659a Remove unused imports 2012-11-26 16:57:57 -08:00
Juergen Hoeller 0a3ea42fe1 DefaultSingletonBeanRegistry avoids singletonObjects lock wherever possible for non-singleton factory performance
Issue: SPR-9819
2012-11-08 23:21:18 +01:00
Dave Syer 3e296974c4 Throw on advise returning null for primitive type
Throw an AopInvocationException when an AOP advisor returns null on
a method that should return a primitive type.

Issue: SPR-4675
2012-10-30 16:09:13 -07:00
Chris Beams dfe05305e2 Upgrade to JUnit 4.11 snapshot in support of JDK7
Class#getDeclaredMembers returns arbitrary results under JDK7. This
results in non-deterministic execution of JUnit test methods, often
revealing unintended dependencies between methods that rely on a
specific order to succeed.

JUnit 4.11 contains support for predictable test ordering [1], but at
the time of this commit, JUnit 4.11 has not yet been released.
Therefore we are testing against a snapshot version [2], which has been
uploaded to repo.springsource.org [3] for easy access. Note that this
artifact may be removed when JUnit 4.11 goes GA.

 - Care has been taken to ensure that spring-test's compile-time
   dependency on JUnit remains at 4.10. This means that the spring-test
   pom.xml will continue to have an optional <dependency> on JUnit
   4.10, instead of the 4.11 snapshot.

 - For reasons not fully understood, the upgrade to the 4.11 snapshot
   of junit-dep caused NoSuchMethodErrors around certain Hamcrest
   types, particularly CoreMatchers and Matchers. import statements
   have been updated accordingly throughout affected test cases.

 - Runtime errors also occurred around uses of JUnit @Rule and
   ExpectedException. These have been reverted to use simpler
   mechanisms like @Test(expected) in the meantime.

 - Some test methods with order-based dependencies on one another have
   been renamed in order to fall in line with JUnit 4.11's new method
   ordering (as opposed to actually fixing the inter-test
   dependencies). In other areas, the fix was as simple as adding a
   tearDown method and cleaning up state.

 - For no apparent reason, the timeout in AspectJAutoProxyCreatorTests'
   testAspectsAndAdvisorNotAppliedToPrototypeIsFastEnough method begins
   to be exceeded. Prior to this commit the timeout value was 3000 ms;
   on the CI server under Linux/JDK6 and JDK7, the test begins taking
   anywhere from 3500-5500 ms with this commit. It is presumed that
   this is an incidental artifact of the upgrade to JUnit 4.11. In any
   case, there are no changes to src/main in this commit, so this
   should not actually represent a performance risk for Spring
   Framework users. The timeout has been increased to 6000 ms to
   accommodate this situation.

[1]: https://github.com/KentBeck/junit/pull/293
[2]: https://github.com/downloads/KentBeck/junit/junit-dep-4.11-SNAPSHOT-20120805-1225.jar
[3]: https://repo.springsource.org/simple/ext-release-local/junit/junit-dep/4.11.20120805.1225

Issue: SPR-9783
2012-09-11 15:04:56 +02:00
Phillip Webb a9a90cabad Protect against non-deterministic method order in JDK7
- Allow reset of GlobalAdvisorAdapterRegistry

   Provide a reset() method allowing the GlobalAdvisorAdapterRegistry
   instance to be replaced with a fresh instance. This method has
   primarily been added to allow unit tests to leave the registry
   in a known state.

 - Protect against the fact that calls to configuration class methods
   my occur in a random order.

Issue: SPR-9779
2012-09-11 15:04:55 +02:00
Juergen Hoeller 430db261e7 BeanFactoryAnnotationUtils throws NoSuchBeanDefinitionExceptions instead of IllegalStateExceptions
Issue: SPR-9652
2012-09-10 15:26:43 +02:00
Phillip Webb 77c9321967 Sort candidate @AspectJ methods deterministically
Update the ReflectiveAspectJAdvisorFactory class to sort candidate
AOP methods based on their annotation first and method name second.

Prior to this the order of aspects created from annotated methods
could differ depending on the underling JVM, as first noticed under
JDK7 in SPR-9729.

 - ConvertingComparator and InstanceComparator have been introduced in
   support of this change, per SPR-9730.

 - A shared static INSTANCE field has been added to ComparableComparator
   to avoid unnecessary instantiation costs within ConvertingComparator
   as well as to prevent generics warnings during certain caller
   scenarios.

Issue: SPR-9729, SPR-9730
2012-09-06 16:06:16 +02:00
Chris Beams 92500ab902 Upgrade to CGLIB 3 and inline into spring-core
CGLIB 3 has been released in order to depend on ASM 4, which Spring now
depends on internally (see previous commit).

This commit eliminates spring-beans' optional dependency on cglib-nodep
v2.2 and instead repackages net.sf.cglib => org.springframework.cglib
much in the same way we have historically done with ASM.

This change is beneficial to users in several ways:

 - Eliminates the need to manually add CGLIB to the application
   classpath; especially important for the growing number of
   @Configuration class users. Java-based configuration functionality,
   along with proxy-target-class and method injection features now
   work 'out of the box' in Spring 3.2.

 - Eliminates the possibility of conflicts with other libraries that
   may dependend on differing versions of CGLIB, e.g. Hibernate
   3.3.1.ga and its dependency on CGLIB 2.1.3 would easily cause a
   conflict if the application were depending on CGLIB 3 for
   Spring-related purposes.

 - Picks up CGLIB 3's changes to support ASM 4, meaning that CGLIB is
   that much less likely to work well in a Java 7 environment due to
   ASM 4's support for transforming classes with invokedynamic
   bytecode instructions.

On CGLIB and ASM:

  CGLIB's own dependency on ASM is also transformed along the way to
  depend on Spring's repackaged org.springframework.asm, primarily to
  eliminate unnecessary duplication of ASM classfiles in spring-core and
  in the process save around 100K in the final spring-core JAR file size.

  It is coincidental that spring-core and CGLIB currently depend on the
  exact same version of ASM (4.0), but it is also unlikely to change any
  time soon. If this change does occur and versions of ASM drift, then
  the size optimization mentioned above will have to be abandoned. This
  would have no compatibility impact, however, so this is a reasonable
  solution now and for the forseeable future.

On a mysterious NoClassDefFoundError:

  During the upgrade to CGLIB 3.0, Spring test cases began failing due to
  NoClassDefFoundErrors being thrown from CGLIB's DebuggingClassWriter
  regarding its use of asm-util's TraceClassVisitor type. previous
  versions of cglib-nodep, particularly 2.2, did not cause this behavior,
  even though cglib-nodep has never actually repackaged and bundled
  asm-util classes. The reason for these NoClassDefFoundErrors occurring
  now is still not fully understood, but appears to be due to subtle JVM
  bytecode preverification rules. The hypothesis is that due to minor
  changes in DebuggingClassWriter such as additional casts, access to
  instance variables declared in the superclass, and indeed a change in
  the superclass hierarchy, preverification may be kicking in on the
  toByteArray method body, at which point the reference to the missing
  TraceClassVisitor type is noticed and the NCDFE is thrown. For this
  reason, a dummy implementation of TraceClassVisitor has been added to
  spring-core in the org.springframework.asm.util package. This class
  simply ensures that Spring's own tests never result in the NCDFE
  described above, and more importantly that Spring's users never
  encounter the same.

Other changes include:

 - rename package-private Cglib2AopProxy => CglibAopProxy
 - eliminate all 'cglibAvailable' checks, warnings and errors
 - eliminate all 'CGLIB2' language in favor of 'CGLIB'
 - eliminate all mention in reference and java docs of needing to add
   cglib(-nodep) to one's application classpath

Issue: SPR-9669
2012-08-10 00:38:49 +02:00
Chris Beams f6de5d4360 Reflect @Async executor qual. 3.2=>3.1.2 backport
@Async executor qualification has been backported to 3.1.2. This commit
updates all @since tags appropriately, as well as carrying over the
changes backported to the spring-task-3.1 schema.

Issue: SPR-6847, SPR-9443
2012-06-27 23:04:25 +02:00
Chris Beams a4b00c732b Introduce BeanFactoryAnnotationUtils
Commit 096693c46f refactored and
deprecated TransactionAspectUtils, moving its #qualifiedBeanOfType
and related methods into BeanFactoryUtils. This created a package cycle
between beans.factory and beans.factory.annotation due to use of the
beans.factory.annotation.Qualifier annotation in these methods.

This commit breaks the package cycle by introducing
beans.factory.annotation.BeanFactoryAnnotationUtils and moving these
@Qualifier-related methods to it. It is intentionally similar in name
and style to the familiar BeanFactoryUtils class for purposes of
discoverability.

There are no backward-compatibilty concerns associated with this change
as the cycle was introduced, caught and now fixed before a release.

Issue: SPR-6847
2012-05-26 14:22:57 +03:00
Chris Beams ed0576c181 Support executor qualification with @Async#value
Prior to this change, Spring's @Async annotation support was tied to a
single AsyncTaskExecutor bean, meaning that all methods marked with
@Async were forced to use the same executor. This is an undesirable
limitation, given that certain methods may have different priorities,
etc. This leads to the need to (optionally) qualify which executor
should handle each method.

This is similar to the way that Spring's @Transactional annotation was
originally tied to a single PlatformTransactionManager, but in Spring
3.0 was enhanced to allow for a qualifier via the #value attribute, e.g.

  @Transactional("ptm1")
  public void m() { ... }

where "ptm1" is either the name of a PlatformTransactionManager bean or
a qualifier value associated with a PlatformTransactionManager bean,
e.g. via the <qualifier> element in XML or the @Qualifier annotation.

This commit introduces the same approach to @Async and its relationship
to underlying executor beans. As always, the following syntax remains
supported

  @Async
  public void m() { ... }

indicating that calls to #m will be delegated to the "default" executor,
i.e. the executor provided to

  <task:annotation-driven executor="..."/>

or the executor specified when authoring a @Configuration class that
implements AsyncConfigurer and its #getAsyncExecutor method.

However, it now also possible to qualify which executor should be used
on a method-by-method basis, e.g.

  @Async("e1")
  public void m() { ... }

indicating that calls to #m will be delegated to the executor bean
named or otherwise qualified as "e1". Unlike the default executor
which is specified up front at configuration time as described above,
the "e1" executor bean is looked up within the container on the first
execution of #m and then cached in association with that method for the
lifetime of the container.

Class-level use of Async#value behaves as expected, indicating that all
methods within the annotated class should be executed with the named
executor. In the case of both method- and class-level annotations, any
method-level #value overrides any class level #value.

This commit introduces the following major changes:

 - Add @Async#value attribute for executor qualification

 - Introduce AsyncExecutionAspectSupport as a common base class for
   both MethodInterceptor- and AspectJ-based async aspects. This base
   class provides common structure for specifying the default executor
   (#setExecutor) as well as logic for determining (and caching) which
   executor should execute a given method (#determineAsyncExecutor) and
   an abstract method to allow subclasses to provide specific strategies
   for executor qualification (#getExecutorQualifier).

 - Introduce AnnotationAsyncExecutionInterceptor as a specialization of
   the existing AsyncExecutionInterceptor to allow for introspection of
   the @Async annotation and its #value attribute for a given method.
   Note that this new subclass was necessary for packaging reasons -
   the original AsyncExecutionInterceptor lives in
   org.springframework.aop and therefore does not have visibility to
   the @Async annotation in org.springframework.scheduling.annotation.
   This new subclass replaces usage of AsyncExecutionInterceptor
   throughout the framework, though the latter remains usable and
   undeprecated for compatibility with any existing third-party
   extensions.

 - Add documentation to spring-task-3.2.xsd and reference manual
   explaining @Async executor qualification

 - Add tests covering all new functionality

Note that the public API of all affected components remains backward-
compatible.

Issue: SPR-6847
2012-05-20 15:18:10 +03:00
Chris Beams 3fb11870d9 Polish async method execution infrastructure
In anticipation of substantive changes required to implement @Async
executor qualification, the following updates have been made to the
components and infrastructure supporting @Async functionality:

 - Fix trailing whitespace and indentation errors
 - Fix generics warnings
 - Add Javadoc where missing, update to use {@code} tags, etc.
 - Avoid NPE in AopUtils#canApply
 - Organize imports to follow conventions
 - Remove System.out.println statements from tests
 - Correct various punctuation and grammar problems
2012-05-20 15:17:28 +03:00
Chris Beams f3bcb6e2e4 Update spring.schemas to reflect 3.2 schemas
Commit 180c5b2ef6 introduced 3.2 versions
of all spring-* schemas; this commit updates spring.schemas mapping
files to include these new versions.
2012-05-18 14:31:33 +03:00
Philippe Marschall 13239a0c3d Fix compiler warnings
This patch fixes several compiler warnings that do not point to code
problems. Two kinds of warnings are fixed. First in a lot of cases
@SuppressWarnings("unchecked") is used although there are no unchecked
casts happening. This seems to be a leftover from when the code base
was on Java 1.4, now that the code base was moved to Java 1.5 these are
no longer necessary. Secondly there some places where the raw types of
List and Class are used where there wildcard types (List<?> and
Class<?>) would work just as well without causing any raw type warnings.

These changes are beneficial particularly when working in Eclipse or
other IDEs because it reduces 'noise', helping to isolate actual
potential problems in the code.

The following changes have been made:

 - remove @SuppressWarnings where no longer needed

 - use wildcard types instead of raw types where possible
2012-05-17 14:32:34 +03:00
Stevo Slavic effb762558 Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.

This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.

Issue: SPR-9113
2012-04-30 11:31:02 +03:00
Chris Beams 180c5b2ef6 Introduce 3.2 versions of Spring XML namespaces
Copy spring-*-3.1.xsd => spring-*-3.2.xsd; this commit introduces no
substantive changes, but rather prepares for them by creating a clean
baseline. All internal references to 3.1 schemas (e.g. spring-tool) have
also been updated.
2012-03-26 20:06:06 +03:00
Chris Beams 6235a341a7 Remove bundlor support 2012-01-31 14:37:11 +01:00
Chris Beams 02a4473c62 Rename modules {org.springframework.*=>spring-*}
This renaming more intuitively expresses the relationship between
subprojects and the JAR artifacts they produce.

Tracking history across these renames is possible, but it requires
use of the --follow flag to `git log`, for example

    $ git log spring-aop/src/main/java/org/springframework/aop/Advisor.java

will show history up until the renaming event, where

    $ git log --follow spring-aop/src/main/java/org/springframework/aop/Advisor.java

will show history for all changes to the file, before and after the
renaming.

See http://chrisbeams.com/git-diff-across-renamed-directories
2012-01-31 14:37:10 +01:00