Commit Graph

377 Commits

Author SHA1 Message Date
Skelotron b9e03cb06b SPR-16316 — fix transaction timeout value overflow 2018-01-07 23:48:24 +01:00
Juergen Hoeller b1c657fa4b Consistent nullability in DataAccessUtils through nullableSingleResult
Issue: SPR-16225
2017-11-26 17:16:39 +01:00
Juergen Hoeller efe943df72 WebSphereUowTransactionManager logs overridden application exceptions
Issue: SPR-16102
2017-10-24 13:14:22 +02:00
Juergen Hoeller c7100f771c Explicit notes on advice mode proxy vs aspectj
Issue: SPR-16092
2017-10-22 20:34:34 +02:00
Sam Brannen e9367a11f6 Delete unused import 2017-10-15 16:15:44 +02:00
Robin Wang d9c0151d41 Fix typo
Closes gh-1545
2017-10-01 09:23:07 +02:00
Juergen Hoeller e2882fe1db Build against EE 8 API level wherever possible
Upgrade to JAXB 2.3, JAX-WS 2.3, Annotations 1.3.1, Interceptor 1.2.1.
Also includes Log4J 2.9.1 and Asciidoctor 1.5.6.
2017-09-24 17:18:21 +02:00
Juergen Hoeller 9190b76ab9 Latest dependency updates (POI 3.17, Rome 1.8, EhCache 3.4, Caffeine 2.5.6, RxJava 2.1.4, Tomcat 8.5.21, JRuby 9.1.13, Rhino 1.7.7.2) 2017-09-23 11:28:19 +02:00
Juergen Hoeller 7ae59d0c2a Nullability refinements on private and static methods
Based on IntelliJ IDEA 2017.3 introspection results.

Issue: SPR-15756
2017-09-22 18:22:14 +02:00
Sebastien Deleuze 1bc93e3d0f Revisit nullability annotations
This commit introduces the following changes.

1) It adds a new Spring @NonNull annotation which allows to apply
@NonNullApi semantic on a specific element, like @Nullable does.
Combined with @Nullable, it allows partial null-safety support when
package granularity is too broad.

2) @Nullable and @NonNull can apply to ElementType.TYPE_USE in order
to be used on generic type arguments (SPR-15942).

3) Annotations does not apply to ElementType.TYPE_PARAMETER anymore
since it is not supported yet (applicability for such use case is
controversial and need to be discussed).

4) @NonNullApi does not apply to ElementType.FIELD anymore since in a
lot of use cases (private, protected) it is not part for the public API
+ its usage should remain opt-in. A dedicated @NonNullFields annotation
has been added in order to set fields default to non-nullable.

5) Updated Javadoc and reference documentation.

Issue: SPR-15756
2017-09-15 13:26:41 +02:00
Brian Clozel 2eeb428e95 Move modules to independent build files
The main `build.gradle` file contains now only the common build
infrastructure; all module-specific build configurations have
been moved to their own build file.

Issue: SPR-15885
2017-08-21 14:41:55 +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
Sebastien Deleuze 73cf07e9a4 Fix overridden methods nullability
Issue: SPR-15869
2017-08-17 15:02:59 +02:00
Juergen Hoeller 697d14a028 Unit tests for transaction annotations on parent interfaces
Issue: SPR-15833
2017-08-01 12:08:21 +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 fb4ddb0746 Make getters and setters null-safety consistent
This commit ensure that null-safety is consistent between
getters and setters in order to be able to provide beans
with properties with a common type when type safety is
taken in account like with Kotlin.

It also add a few missing property level @Nullable
annotations.

Issue: SPR-15792
2017-07-19 09:07:56 +02:00
Juergen Hoeller c292a89b24 Http(Async)Client not actually nullable, plus MethodInterceptor nullability
Issue: SPR-15720
2017-07-19 00:15:37 +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
Stephane Nicoll 1ab678a2a3 Polish "Refactor iterator of Map with Java8's Map.forEach"
Closes gh-1459
2017-06-13 16:06:20 +02:00
diguage 1ef5f61ab2 Refactor iterator of Map with Java8's Map.forEach
See gh-1459
2017-06-13 16:06:20 +02:00
Juergen Hoeller 779deb0fa7 Cleanup of duplicate semicolons
Issue: SPR-15654
2017-06-13 11:38:05 +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 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 1f28825f9d Add more @Nullable parameters based on null usage
Issue: SPR-15540
2017-05-31 21:42:23 +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 42d6d7ec4e Transaction annotations on interface methods with CGLIB proxies
Issue: SPR-14322
2017-04-26 18:16:31 +02:00
Juergen Hoeller 4e82bf30c6 TransactionSynchronization declared with default methods
Issue: SPR-14432
2017-03-14 15:18:53 +01:00
Juergen Hoeller 8b741508a6 Explicit notes on transaction phase processing
Issue: SPR-15323
2017-03-07 13:50:01 +01:00
Stephane Nicoll 05787f314f Update copyright header
Closes gh-1343
2017-03-03 09:28:56 +01:00
nkjackzhang 0e49c0e152 Remove unecessary "<<"
See gh-1343
2017-03-03 09:28:17 +01:00
Juergen Hoeller 2b3fb2f5cc Polishing 2017-02-28 18:37:33 +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 d4a1b59b4c Skip transaction/caching metadata retrieval for java.lang.Object methods
Also retrieves CacheConfig as merged annotation now, aligned with other caching annotations.

Issue: SPR-15296
2017-02-28 13:08:55 +01:00
Juergen Hoeller 0f51ff5ebc Reset global rollback-only status when rolling back to savepoint
Issue: SPR-6568
2017-02-17 23:40:44 +01:00
Juergen Hoeller e9019cd7d1 Polishing 2017-02-10 10:56:40 +01:00
Juergen Hoeller b630c9bea7 Clear synchronization before triggering afterCompletion callbacks
Issue: SPR-15194
Issue: SPR-11590
2017-02-10 10:39:33 +01:00
Juergen Hoeller acf511ac0e Polishing 2017-02-02 20:11:06 +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 1cb381e9a7 Consistent deprecation markers on JDK 9 2017-01-13 10:53:20 +01:00
Sam Brannen 9ed66bf2eb Clean up warnings across code base 2017-01-07 01:54:38 +01:00
Juergen Hoeller 953bc189e7 Stronger explanation of default rollback rules
Issue: SPR-14994
2016-12-09 15:05:20 +01:00
Juergen Hoeller a7ec6dc0af ImportRegistry properly tracks excluded superclasses
Issue: SPR-14972
2016-12-09 15:01:21 +01:00
Juergen Hoeller 2874066a97 DataSourceTransactionManager triggers flush callbacks on registered transaction synchronizations
Issue: SPR-14847
2016-10-28 15:23:57 +02:00
Juergen Hoeller 52b029d71d DefaultTransactionAttribute stores descriptor (method identification)
Issue: SPR-14760
2016-10-21 12:23:13 +02: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 eafaaa5cb8 Polishing 2016-10-12 17:11:04 +02:00
Juergen Hoeller ce42ed4d44 Polishing 2016-09-13 21:58:41 +02:00
Juergen Hoeller ab9fea6b8d Polishing
(cherry picked from commit 3767092)
2016-08-31 02:08:31 +02:00
Juergen Hoeller 58fa63fdd1 ApplicationListenerMethodAdapter resolves order on construction
Issue: SPR-14642
2016-08-30 20:50:02 +02:00
Juergen Hoeller bbc85ea466 Refined exception message
Issue: SPR-14609
(cherry picked from commit ab68673)
2016-08-24 15:08:12 +02:00
Juergen Hoeller 951ac5ea4f TransactionAspectSupport stores given PlatformTransactionManager instance as strong reference
Issue: SPR-14609
2016-08-24 14:31:02 +02:00
Juergen Hoeller 02374d7450 TransactionAspectSupport avoids hard references to transaction manager beans
Issue: SPR-14511
2016-07-26 21:29:34 +02:00
Juergen Hoeller e03dea1d64 Polishing 2016-07-26 17:15:19 +02:00
Juergen Hoeller e4def2f55d Aligned ConcurrentMap declaration with 4.3.x branch 2016-07-26 00:54:53 +02:00
Juergen Hoeller ae28815886 Polishing 2016-07-25 23:27:06 +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 dc1664939c Javadoc fixes and pruning of outdated references 2016-07-15 22:12:11 +02:00
Juergen Hoeller 04e9c2bf0c Aspect actually applies in PersistenceExceptionTranslationPostProcessorTests
Issue: SPR-14457
2016-07-13 22:31:41 +02:00
Stephane Nicoll e4b0486c5a Add @FunctionalInterface on candidate interfaces
Issue: SPR-14432
2016-07-06 14:32:13 +02:00
Juergen Hoeller 355c6f0715 Upgrade to JMS 2.0 and JCA 1.7
Issue: SPR-13793
2016-07-05 22:18:19 +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
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 d341624e91 Drop JDO support
Issue: SPR-14130
2016-07-04 23:34:48 +02:00
Stephane Nicoll 037746da44 Polish
Closes gh-1097
2016-07-01 14:26:48 +02:00
Juergen Hoeller 66ec1c1618 Add missing package-info files for common packages
Issue: SPR-14420
2016-06-30 21:39:06 +02:00
nkjackzhang 9656015d26 Fix typo in javadoc
See gh-1080
2016-06-16 12:11:14 +02:00
Juergen Hoeller a9fda3e7e2 Defensive catching of any Throwable subclasses instead of just Error
Issue: SPR-14329
2016-06-04 00:17:20 +02:00
Juergen Hoeller 1be544f8fa JtaTransactionManager explicitly resets transaction timeout after completion
Issue: SPR-14239
2016-05-03 13:30:51 +02:00
Juergen Hoeller f83cbff543 Consistent SmartLifecycle implementations
Issue: SPR-14233
2016-05-02 13:01:44 +02:00
Johnny Lim 44e652f99e Remove duplicate words
Closes gh-1039
2016-04-19 08:24:21 +02:00
Juergen Hoeller 74608e6b49 Polishing 2016-04-12 16:03:57 +02:00
Juergen Hoeller 831f09cf48 SimpleTransactionScope properly suspends and resumes scoped objects
Issue: SPR-14148
2016-04-12 16:02:36 +02:00
Juergen Hoeller 537193a4e0 Consistent license header 2016-04-11 20:49:38 +02:00
Juergen Hoeller 14bf6509ec Consistent cache key implementation across transaction and cache attribute sources
Includes consistent applicability of class-level metadata to user-level methods only.

Issue: SPR-14017
Issue: SPR-14095
2016-03-30 14:13:04 +02:00
Juergen Hoeller b7819e6ec8 AnnotationTransactionAttributeSource applies class-level metadata to user-level methods only
Issue: SPR-14095
2016-03-30 10:21:22 +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 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 25be5e060c TaskDecorator callback supported by common TaskExecutor implementations
Issue: SPR-13930
2016-02-17 16:58:02 +01:00
Juergen Hoeller 1d8a3e1f07 BeanFactoryAnnotationUtils searches on bean implementation classes and meta-annotations as well
Issue: SPR-13819
Issue: SPR-13452
2015-12-28 23:28:08 +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
Stephane Nicoll 752d3c715a Initiate structure for 4.3 XSDs 2015-12-17 15:43:23 +01:00
Johnny Lim 2defb6555e Fix broken Javadoc related to `<` and `>` 2015-11-12 11:22:08 +01:00
Juergen Hoeller 760bc719f2 Polishing 2015-11-09 15:03:14 +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 e35855f9b5 Avoid expensive annotation retrieval algorithm if no annotations present in the first place
Issue: SPR-13621
2015-11-05 12:26:54 +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
Juergen Hoeller ebe128e940 Polishing 2015-09-24 00:33:14 +02:00
Sam Brannen 164bed5c3f Use implicit aliases in @TransactionalEventListener 2015-08-28 20:04:52 +02:00
Stephane Nicoll a3f39d5257 Add missing 4.2 XSDs
Issue: SPR-13300
2015-08-01 09:50:36 +02:00
Sam Brannen 725292081e Introduce 'value' alias for 'attribute' in @AliasFor
SPR-11512 introduced support for annotation attribute aliases via
@AliasFor, requiring the explicit declaration of the 'attribute'
attribute. However, for aliases within an annotation, this explicit
declaration is unnecessary.

This commit improves the readability of alias pairs declared within an
annotation by introducing a 'value' attribute in @AliasFor that is an
alias for the existing 'attribute' attribute. This allows annotations
such as @ContextConfiguration from the spring-test module to declare
aliases as follows.

public @interface ContextConfiguration {

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

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

    // ...
}

Issue: SPR-13289
2015-07-29 15:27:06 +02:00
Juergen Hoeller 14f27bda37 Prefer use of "Java EE" over "J2EE" 2015-07-27 15:32:56 +02:00
Juergen Hoeller f06581f5b8 Polishing 2015-07-22 14:20:12 +02:00
Juergen Hoeller edd6e76b9f Polishing 2015-07-21 22:58:34 +02:00
Juergen Hoeller a8fb551b1c Allow for overriding of computeTransactionAttribute
Issue: SPR-13246
2015-07-17 15:24:24 +02:00
Sam Brannen f300325b1b Polishing 2015-07-08 15:08:29 +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 f1c7dc4f4b Introduced SimpleTransactionScope (analogous to SimpleThreadScope)
Issue: SPR-13085
2015-06-18 00:29:46 +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
Sam Brannen d9f18f7355 Polish AnnotationTransactionAttributeSourceTests 2015-06-16 21:36:13 +01:00
Sam Brannen 32c17bf540 Revise method and parameter names in annotation support
In AnnotatedElementUtils, all methods pertaining to merging annotation
attributes have been renamed to "getMerged*()" and "findMerged*()"
accordingly. Existing methods such as getAnnotationAttributes(..) have
been deprecated in favor of the more descriptive "merged" variants.
This aligns the naming conventions in AnnotatedElementUtils with those
already present in AnnotationReadingVisitorUtils.

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

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

Issue: SPR-11511
2015-06-14 00:34:40 +02:00
Sam Brannen 6b7c1d72e8 Introduce alias for 'value' attribute in @Transactional
Issue: SPR-11393
2015-06-12 22:35:20 +02:00
Sam Brannen 6fc388315e Polish Javadoc for @Transactional 2015-06-12 21:59:44 +02:00
Sam Brannen 9afcd17c71 Introduce getAnnotationAttributes(..,Class) in AnnoElUtils 2015-05-29 21:36:00 +02:00
Juergen Hoeller b4095c3e1d Class identity comparisons wherever possible
Issue: SPR-12926
2015-05-20 14:34:16 +02:00
Stephane Nicoll cf391f5ce1 polish
Remove unused imports
2015-05-19 08:49:01 +02:00
Sam Brannen 122d3476d9 Polish Javadoc for condition annotation attributes 2015-04-24 01:38:13 +02:00
Sam Brannen ad6bea1cda Support abstract, bridge, & interface methods in AnnotatedElementUtils
This commit introduces support for finding annotations on abstract,
bridge, and interface methods in AnnotatedElementUtils.

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

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

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

 - Documented internal AnnotatedElementUtils.Processor<T> interface.

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

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

 - AnnotationUtils.isInterfaceWithAnnotatedMethods() is now package
   private.

Issue: SPR-12738, SPR-11514, SPR-11598
2015-04-24 00:55:48 +02:00
Sam Brannen 8ece1b145c Introduce failing/ignored tests for SPR-12738
Issue: SPR-12738
2015-04-23 01:33:46 +02:00
Sam Brannen 7f0f04dfe3 Support annotations on interfaces in AnnotatedElementUtils
This commit introduces support in AnnotatedElementUtils for finding
annotations declared on interfaces at the type level.

NB: this commit does not include support for finding annotations
declared on interface methods.

In order to maintain backward compatibility with @Transactional
annotation attribute processing, a new getAnnotationAttributes() method
has been added to AnnotatedElementUtils that provides a flag to control
whether interfaces should be searched.
SpringTransactionAnnotationParser and JtaTransactionAnnotationParser
have been updated accordingly to ensure that interfaces are not
unintentionally searched in the @Transactional resolution process.

This commit also introduces additional tests and updates TODOs for
SPR-12738.

Issue: SPR-12944, SPR-12738
2015-04-23 01:33:37 +02:00
Sam Brannen b9b0b78fa1 Support n meta-annotation levels on methods in AnnotationUtils
Prior to this commit, the search algorithm used by the
findAnnotation(Method, Class) method in AnnotationUtils only found
direct annotations or direct meta-annotations (i.e., one level of
meta-annotations).

This commit reworks the search algorithm so that it supports arbitrary
levels of meta-annotations on methods. To make this possible, a new
findAnnotation(AnnotatedElement, Class) method has been introduced in
AnnotationUtils.

This fix also allows for the @Ignore'd tests in
TransactionalEventListenerTests to be re-enabled.

Issue: SPR-12941
2015-04-22 02:26:24 +02:00
Sam Brannen 8a1f9f8aa3 Fix typo in exception message 2015-04-21 19:54:48 +02:00
Stephane Nicoll ca91956bdb Do not retain BeanFactory ref
This is a rework of fd7153f that also now clears the reference to the
BeanFactory when the context is disposed.

Issue: SPR-12518
2015-04-20 17:05:59 +02:00
Juergen Hoeller 13659d645b Consistent support for @Order annotation as alternative to Ordered interface
Issue: SPR-12806
2015-03-13 18:18:33 +01:00
Juergen Hoeller 5ec2cd7947 AbstractPlatformTransactionManager logs warning for custom isolation level in case of no actual transaction
Issue: SPR-12600
2015-03-06 17:45:45 +01:00
Juergen Hoeller fdd1f83639 Polishing
(cherry picked from commit 3783591)
2015-03-02 22:05:16 +01:00
Stephane Nicoll babbf6e871 Harmonize resources location
Issue: SPR-12766
2015-02-28 10:32:40 +01:00
Juergen Hoeller 2b3409461f Polishing 2015-02-27 22:29:42 +01:00
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
Juergen Hoeller 1cd4433621 Polishing 2015-01-22 18:44:07 +01:00
Stephane Nicoll a79fe25917 Restore default transaction manager by name lookup
Fix a regression introduced by 961574bd17 that prevents a proper lookup
of the default transaction manager by name as the absence of a qualifier
is represented by an empty string (passing the faulty null check).

Issue: SPR-12577
2014-12-31 15:21:43 +01:00
Juergen Hoeller 9ac02b319d Remove pre-3.2 deprecated classes and methods
Issue: SPR-12578
2014-12-30 20:05:15 +01:00
Stephane Nicoll 961574bd17 Fix regression in determineTransactionManager
One more (and hopefully last) attempt at making sure
determineTransactionManager does not break existing use cases.

This commit prevents any lookup if no transaction attributes are set
which is more compliant with the original version and prevents a lookup
if a non existing bean name is provided explicitly (as it can be the case
with Spring Boot).

Issue: SPR-12541
2014-12-28 18:17:01 +01:00
Stephane Nicoll 4a0ac97550 Fix regression in determineTransactionManager
The fix in cec26e9 for SPR-12541 actually introduced a regression
when the interceptor is enabled on a method that does not require any
transaction. In such a case we try to locate the default
PlatformTransactionManager instead of just returning what we have (that
is null).

This commit updates the determineTransactionManager condition again to
take that use case into account again.

Issue: SPR-12541
2014-12-28 17:38:06 +01:00
Juergen Hoeller b30843aee0 AbstractFallbackTransactionAttributeSource's DefaultCacheKey takes targetClass into account (again)
Issue: SPR-12536
(cherry picked from commit c087e51)
2014-12-22 18:46:07 +01:00
Stephane Nicoll fd7153ffbb Do not retain cache transaction managers
Previously, cache transaction managers may be  retained outside the
boundaries of an application context with AspectJ since an aspect is
basically a singleton for the current class loader.

This commit adds a "clearTransactionManagerCache" that is similar to the
"clearMetadataCache" introduced in CacheAspectSupport: whenever the
context is disposed, the cache is cleared to remove any reference to a
transaction manager defined by that context.

Issue: SPR-12518
2014-12-16 16:26:02 +01:00
Stephane Nicoll cec26e9ac4 Rework determineTransactionManager condition
SPR-11954 introduced a regression that when the "default" transaction
manager is cached, qualified transaction managers are not taken into
account anymore.

This commit rework the "determineTransactionManager" condition to
favor qualifier and "named" transaction managers. If none of these apply,
the default transaction manager is used as it should.

Also reworked the caching infrastructure so that a single cache holds
all transaction manager instances.

Issue: SPR-12541
2014-12-16 15:05:00 +01:00
Sam Brannen c2101cbcf4 Require non-empty values for TxMgr qualifiers & bean names 2014-12-12 21:01:00 +01:00
Sam Brannen 5b5cf37ac5 Polish Javadoc regarding default transaction manager 2014-12-12 20:56:59 +01:00
Juergen Hoeller ff8655846d TransactionAspectSupport.currentTransactionStatus() reliably throws NoTransactionException
Issue: SPR-9144
2014-10-27 15:47:52 +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 43597bfed4 Polishing 2014-10-16 17:26:10 +02:00
Juergen Hoeller e58b33a593 Consistent reset of resource holders on doBegin failure
Issue: SPR-12280
2014-10-06 20:31:45 +02:00
Juergen Hoeller 3a3c52dbdd Polishing 2014-10-01 01:10:25 +02:00
Juergen Hoeller fcb9dd1939 JtaTransactionManagerFactoryBean as an equivalent to <tx:jta-transaction-manager/>
Issue: SPR-12197
2014-09-30 20:14:51 +02:00
Juergen Hoeller 62340d6ccf Only release rolled-back database savepoints during managed nested transaction
Issue: SPR-12228
2014-09-22 17:29:10 +02:00
Juergen Hoeller d6370965eb Polishing 2014-08-11 15:20:09 +02:00
Stephane Nicoll 057efa0676 Align javadoc improvements 2014-07-30 09:29:24 +02:00
Juergen Hoeller 036896a6b8 Split configuration constants into local XConfigUtils classes instead of piling them up in AnnotationConfigUtils 2014-07-28 21:58:21 +02:00
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
Stephane Nicoll 4e257243f2 Reduce PlatformTransactionManager lookups
Prior to this commit, cache operations mentioning a qualifier led to
a lookup for the same PlatformTransactionManager over and over again.
The same applied when a transactionManager bean name was specified on
the interceptor.

This commit adds a cache to store the reference of such transaction
managers. As a convenience, the default PlatformTransactionManager is
also initialized if it has not been through configuration.

Issue: SPR-11954
2014-07-04 16:45:23 +02:00
Stephane Nicoll 5ed20d21b1 Add test
This commit adds a test that reproduces the behaviour described in
SPR-11915 and validates that the fix introduced in f8b6114440 works
as expected.

Issue: SPR-11915
2014-07-01 17:21:08 +02:00
Juergen Hoeller 03f3412434 WebSphereUowTransactionManager exposes SmartTransactionObject
Issue: SPR-11876
2014-06-19 22:30:10 +02:00
Sam Brannen e3e8a3eb40 Fix grammar in Javadoc for Propagation 2014-05-28 00:17:03 +02:00
Philippe Marschall 4ff1e197e3 Clean up spring-tx tests warnings
Clean up compiler warnings in the tests of spring-tx. This commit
adds type parameters to all the types (mostly `List` and `Map`). In
addition it uses Java 5 autoboxing to get rid of several `new Integer`
(except in cases where it's needed).

After this commit the only warnings in spring-tx left are in
`TransactionAttributeSourceTests`` that code would never compile with
generics.
2014-04-22 07:31:12 +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 14e5a02870 Mixed polishing along with recent changes 2014-02-14 21:39:40 +01:00
Juergen Hoeller cead06a3d9 Polishing 2014-02-12 00:12:52 +01:00
Juergen Hoeller 09e2e5897d Removed outdated hibernate3 references across the codebase
Issue: SPR-9028
2014-02-06 22:15:59 +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 640d8cb67f Consistent implementation of AsyncListenableTaskExecutor
Issue: SPR-11282
2014-01-03 21:57:07 +01:00
Juergen Hoeller 82ea9ece5c Refined logging to include target class for each transactional method name
Also simplified cache key 'hashCode' implementation, relying on 'equals' to differentiate between same method on different target classes.

Issue: SPR-11267
2014-01-01 18:36:48 +01:00
Juergen Hoeller 2a52decbbc Polishing (including removal of javadoc imports that show as package cycles in IntelliJ) 2013-12-02 23:57:00 +01:00
Juergen Hoeller 41332728f9 Use AnnotationTransactionAttributeSource class name to avoid hard dependency on transaction.annotation package 2013-12-02 23:55:41 +01:00
Juergen Hoeller ce917d5cbb Polishing around @EnableTransactionManagement
Issue: SPR-10864
2013-12-02 11:00:26 +01:00
Juergen Hoeller e8dead247c @EnableTransactionManagement and co get detected on superclasses as well
Issue: SPR-10864
2013-12-02 10:59:30 +01:00
Phillip Webb a31ac882c5 Fix various javadoc warnings 2013-11-26 13:25:37 -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 f888b8816f Re-enabled tests for meta-annotations on interfaces
Issue: SPR-11108
2013-11-23 00:43:29 +01:00
Juergen Hoeller f39bb02628 Polishing 2013-11-22 23:29:54 +01:00
Sam Brannen ad402dcb4a Status quo for composable stereotypes on interfaces
The tests introduced in this commit demonstrate the current lacking
support for composable stereotypes on interfaces (using @Transactional)
as a concrete example.

Issue: SPR-11108
2013-11-22 16:37:48 +01:00
Juergen Hoeller e146e53d9b Added support for the JCA 1.7 getActivationName() method
Issue: SPR-11067
2013-11-04 23:14:57 +01:00
Juergen Hoeller 49758a2a96 Added convenience classes for typical JSR-236 setup in a Java EE 7 environment
Introduced DefaultManagedTaskExecutor, DefaultManagedTaskScheduler and DefaultManagedAwareThreadFactory classes, revised related javadoc, and deprecated unsupported JBossWorkManagerTaskExecutor in favor of JSR-236 setup on WildFly 8.

Issue: SPR-8195
2013-11-02 20:14:02 +01:00
Phillip Webb d371886988 Allow null method for getTransactionAttribute
Update MatchAlwaysTransactionAttributeSource.getTransactionAttribute
to allow a null method argument. Passing a null method is not
recommended and is not indicated as valid in the Javadoc, however,
this was allowed in previous versions of Spring.

Issue: SPR-11048
2013-10-30 22:43:29 -07:00
Juergen Hoeller 4bcfbc3ba3 Apply name-matching transaction attributes to user-level methods only
In particular, do not apply them to GroovyObject methods and other kinds of synthetic methods in language runtimes. The only exception are bridge methods since those do eventually point to a user-level generic method.

Issue: SPR-10803
2013-10-30 12:38:45 +01:00
Juergen Hoeller f669a40bd6 Removed deprecated TransactionAspectUtils class 2013-10-30 00:54:29 +01:00
Juergen Hoeller 74794190a5 Implement java.io.Flushable wherever applicable 2013-10-14 23:52:31 +02:00
Juergen Hoeller df18e9173d Revised PersistenceExceptionTranslationInterceptor to lazily retrieve PersistenceExceptionTranslator beans on demand
Issue: SPR-10894
2013-09-04 18:33:25 +02:00
Juergen Hoeller 0b37cec287 Consistent support for JTA 1.1 TransactionSynchronizationRegistry
JtaTransactionManager's configuration options for a TransactionSynchronizationRegistry are now in sync with the options for UserTransaction/TransactionManager. Specifically, there are setTransactionSynchronizationRegistry/getTransactionSynchronizationRegistry methods for programmatic configuration now.  Motivated by Spring's adapting to a Hibernate JtaPlatform, specifically the Hibernate 4.3 changes in that area.

Issue: SPR-10839
2013-09-03 17:57:31 +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 6d3649858e Allow meta-annotations to override attributes from their parent
Issue: SPR-10181
2013-08-21 17:35:56 +02:00
Juergen Hoeller e4d83bbefe Refined javadoc for WebLogic/WebSphere transaction setup
Issue: SPR-10777
(cherry picked from commit 9035a97)
2013-08-01 17:27:12 +02:00
Juergen Hoeller 2e4eb9fc10 Resource-based PlatformTransactionManager implementations defensively catch Throwable in doBegin in order to reliably close resource in case of OutOfMemoryError
Issue: SPR-10755
2013-07-24 15:29:10 +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 d3a4068768 Minimized ASM usage
In particular, avoid accidental usage of ASM for core JDK types - which will fail in case of a new bytecode version in the JDK, even if the application itself has been compiled with an earlier bytecode target.

Issue: SPR-10292
2013-04-23 13:49:25 +02:00
Juergen Hoeller 52fd84bb57 JTA 1.2 support, in particular for the javax.transaction.Transactional annotation
Issue: SPR-9139
2013-03-27 22:33:17 +01:00
Juergen Hoeller 9c52ae9558 Removed OC4J support (including documentation references) 2013-03-19 14:53:26 +01:00
Juergen Hoeller 36942f6018 JtaTransactionManager relies on presence of JTA 1.1 API 2013-03-19 13:27:00 +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
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
Carson McDonald 39c236baa8 Fix minor javadoc typos 2013-02-28 15:56:58 -08:00
Juergen Hoeller 1af28efe39 @Transactional in AspectJ mode works with CallbackPreferringPlatformTransactionManager (WebSphere) as well
Effectively, AbstractTransactionAspect got refactored into around advice, reusing former TransactionInterceptor code which now lives in slightly generalized form in TransactionAspectSupport, and using a workaround for rethrowing checked exceptions.

Issue: SPR-9268
2013-02-10 18:06:50 +01:00
Phillip Webb 065b1c0e46 Fix unused local variable warnings 2013-01-25 14:35:19 -08:00
Juergen Hoeller 1a929f22e0 EntityManagerFactoryUtils finds default EntityManagerFactory in parent contexts as well
Also introduces consistent use of getBean(Class) for similar use cases across the framework, accepting a locally unique target bean even if further matching beans would be available in parent contexts (in contrast to BeanFactoryUtils.beanOfType's behavior).

Issue: SPR-10160
2013-01-22 21:12:05 +01:00
Juergen Hoeller f6d7518013 SpringContextResourceAdapter implements equals/hashCode according to the JCA 1.5 contract
Issue: SPR-9162
2013-01-10 17:00:44 +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 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 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