Commit Graph

176 Commits

Author SHA1 Message Date
Chris Beams 87a021d5c9 Add <license> section to 3.1.x Maven poms
Issue: SPR-8927
2012-01-31 15:18:05 +01:00
Chris Beams 41c405998e Convert CRLF=>LF on files missed earlier
Complete pass with `dos2unix` found additional files missed on earlier
related commit.

Issue: SPR-5608
2011-12-22 14:06:44 +01:00
Chris Beams 88913f2b23 Convert CRLF (dos) to LF (unix)
Prior to this change, roughly 5% (~300 out of 6000+) of files under the
source tree had CRLF line endings as opposed to the majority which have
LF endings.

This change normalizes these files to LF for consistency going forward.

Command used:

$ git ls-files | xargs file | grep CRLF | cut -d":" -f1 | xargs dos2unix

Issue: SPR-5608
2011-12-21 14:52:47 +01:00
Chris Beams e158f61e93 Increment version to 3.1.1.BUILD-SNAPSHOT 2011-12-16 11:59:06 +01:00
Chris Beams ac107d0c2a Release Spring Framework 3.1.0.RELEASE 2011-12-13 16:35:49 +00:00
Juergen Hoeller 0f75cebdff @Transactional qualifiers match against transaction manager definitions in parent contexts as well (SPR-7679) 2011-12-11 13:26:36 +00:00
Juergen Hoeller 9d93b5429f fixed assertion message 2011-12-09 16:01:06 +00:00
Juergen Hoeller e7d1b5e0ee JDO PersistenceManager synchronization performs close attempt after completion (if necessary; SPR-8846) 2011-11-28 19:38:28 +00:00
Juergen Hoeller c9b36fb4e6 TransactionSynchronizationManager eagerly cleans up void ResourceHolders on any access (SPR-8844, SPR-8845) 2011-11-28 18:54:11 +00:00
Chris Beams 56608d6bd6 Fix typo in ResourceHolder#isVoid Javadoc
Issue: SPR-8843
2011-11-16 23:32:42 +00:00
Chris Beams d1f6672a58 Refactor ImportSelector support
Separate concerns of @Configuration class selection from the need to
register certain infrastructure beans such as auto proxy creators.

Prior to this change, ImportSelector implementations were responsible
for both of these concerns, leading to awkwardness and duplication.

Also introduced in this change is ImportBeanDefinitionRegistrar and
two implementations, AutoProxyRegistrar and AspectJAutoProxyRegistrar.
See the refactored implementations of CachingConfigurationSelector,
TransactionManagementConfigurationSelector to see the former;
AspectJAutoProxyConfigurationSelector to see the latter.

ImportSelector and ImportBeanDefinitionRegistrar are both handled as
special-case arguments to the @Import annotation within
ConfigurationClassParser.

These refactorings are important because they ensure that Spring users
will be able to understand and extend existing @Enable* annotations
and their backing ImportSelector and @Configuration classes, as well
as create their own with a minimum of effort.
2011-11-16 04:21:28 +00:00
Chris Beams 1533822b0a Update proxyTargetClass-related Javadoc; add tests
There was some question about whether enabling subclass proxies via
proxyTargetClass / proxy-target-class settings would break annotation-
based demarcation of joinpoints due to inability to discover those
annotations in various scenarios. The provided tests prove that in
any conceivable case, these annotations (@Transactional, at least)
are discovered in a consistent fashion, meaning that switching proxy
strategies should be transparent to the application and honor
intended annotation semantics.
2011-11-16 04:20:28 +00:00
Chris Beams 43b3b4c261 Polish @Enable* Javadoc 2011-11-16 04:20:17 +00:00
Juergen Hoeller b21e1ee669 polishing 2011-11-11 09:57:34 +00:00
Juergen Hoeller e58a45bff7 polishing 2011-10-11 01:13:41 +00:00
Juergen Hoeller 1f89243361 use internal Set for TransactionSynchronization objects in order to allow for equals/hashCode based replacement 2011-10-11 01:11:17 +00:00
Chris Beams d122ecb42e Move AdviceMode from .config to .annotation package 2011-10-09 07:55:08 +00:00
Chris Beams 1819bee35f Revert deprecation of AbstractSingletonPFB and co
Removed formal deprecation warnings for AbstractSingletonFactoryBean and
its TransactionProxyFactoryBean and CacheProxyFactoryBean subclasses.

This is principally because TPFB is still used by Grails and could
conceivably be used to good effect by any third-party framework in a
similar fashion. CPFB is new with 3.1, but similar use is predictable.

Deprecations have been replaced by strong recommendations that users
avoid these types in modern Spring applications and favor the use of
namespaces and annotatinos, such as tx: and @Transactional (around
since Spring 2.x) and cache: and @Cacheable.

Issue: SPR-8680, SPR-8686
2011-10-09 07:54:54 +00:00
Chris Beams 15a8f776b9 Clarify stereotype and exception translation Javadoc
Cite original inspiriation by Domain-Driven Design, but make clear the
flexible and general-purpose nature of Spring's stereotype annotations
such as @Repository and @Service.

Also update @Repository Javadoc with more explicit instructions about
switching on exception translation through use of
PersistenceExceptionTranslationPostProcessor, and update PETPP Javadoc
for style as well as concrete examples of 'resource factories' that
implement the PersistenceExceptionTranslator interface

Issue: SPR-8691
2011-09-13 17:53:15 +00:00
Sam Brannen 1de71c6e37 [SPR-8222] Upgraded to JUnit 4.9. 2011-08-30 13:16:12 +00:00
Chris Beams 5946e66586 Update ejb and javax.resource deps in tx pom 2011-08-20 03:01:53 +00:00
Sam Brannen 87dad65ff0 [SPR-8622] Upgraded to JUnit 4.8.2 2011-08-18 16:06:31 +00:00
Juergen Hoeller b9ebdd28fb polishing 2011-08-12 10:02:12 +00:00
Chris Beams 2b371a7c9a Deprecate TransactionProxyFactoryBean 2011-07-26 22:29:04 +00:00
Juergen Hoeller df3761e3f6 introduced AnnotationUtils.getAnnotation(AnnotatedElement, annotationType) 2011-07-22 09:34:42 +00:00
Chris Beams c5463a2e52 Move ImportSelector.Context to a top-level class
Issue: SPR-8411, SPR-8494
2011-07-13 23:28:53 +00:00
Chris Beams 431e935011 Fix APC registration for @EnableTransactionManagement
Prior to this change, @EnableTransactionManagement (via the
ProxyTransactionManagementConfiguration class) did not properly
register its auto-proxy creator through the usual AopConfigUtils
methods.  It was trying to register the APC as a normal @Bean method,
but this causes issues (SPR-8494) with the logic in
AopConfigUtils#registerOrEscalateApcAsRequired, which expects the APC
bean definition to have a beanClassName property.  When the APC is
registered via a @Bean definition, it is actually a
factoryBean/factoryMethod situation with no directly resolvable
beanClass/beanClassName.

To solve this problem, ImportSelector#selectImports has been refactored
to accept an ImportSelector.Context instance. This object contains the
AnnotationMetadata of the importing class as well as the enclosing
BeanDefinitionRegistry to allow for the kind of conditional bean
registration necessary here. In this case, the bean definition that
must be registered conditionally is that of the auto-proxy creator.
It should only be registered if AdviceMode == PROXY, and thus the
ImportSelector is an appropriate place to make this happen.  It must
happen as a BeanDefinition (rather than a @Bean method) for
compatibility with AopConfigUtils, and working with the
BeanDefinitionRegistry API allows for that. This change does mean that
in certain cases like this one, #selectImports has container modifying
side effects. Documentation has been updated to reflect.

Issue: SPR-8411, SPR-8494
2011-07-11 01:17:19 +00:00
Chris Beams d8d9e3fc27 Revert "Fix APC registration for @EnableTransactionManagement"
@PostConstruct added to ProxyTransactionManagementConfiguration cases
ConcurrentModificationException (as detailed previously in SPR-8397.
Backing out for now until a better solution can be devised.

This reverts commit 235b729514.
2011-07-08 09:44:29 +00:00
Chris Beams f1ef3e4dcd Fix APC registration for @EnableTransactionManagement
Prior to this change, @EnableTransactionManagement (via the
ProxyTransactionManagementConfiguration class) did not properly
register its auto-proxy creator through the usual AopConfigUtils
methods.  It was trying to register the APC as a normal @Bean method,
but this causes issues (SPR-8494) with the logic in
AopConfigUtils#registerOrEscalateApcAsRequired, which expects the APC
bean definition to have a beanClassName property.  When the APC is
registered via a @Bean definition, it is actually a
factoryBean/factoryMethod situation with no directly resolvable
beanClass/beanClassName.

Rather than trying to rework how AopConfigUtils works, a @PostConstruct
method has been added to ProxyTransactionManagementConfiguration to call
the usual AopConfigUtils registration methods.

Issue: SPR-8411, SPR-8494
2011-07-07 22:37:28 +00:00
Juergen Hoeller b0a6ebfb61 fixed package declaration 2011-07-04 22:04:31 +00:00
Juergen Hoeller e5b1c4366c added JBoss dependency (SPR-8505); updated WebSphere dependency 2011-07-04 21:37:09 +00:00
Chris Beams ca6e112742 Clarify TransactionCallback Javadoc
Issue: SPR-8390
2011-06-15 13:04:07 +00:00
Juergen Hoeller c60511bf04 shortened build properties "org.junit.version" to "junit.version" and "org.testng.version" to "testng.version"; reverted SLF4J version back to 1.5.3 (for Hibernate 3.3.1 compatibility) 2011-06-09 09:58:15 +00:00
Chris Beams 066daaf5be Polish @EnableTransactionManagement Javadoc and XSD 2011-06-02 14:29:06 +00:00
Chris Beams e0ad6500be Rename TransactionManagementConfigurer callback
Renamed TransactionManagementConfigurer#createTransactionManager()
to #annotationDrivenTransactionManager() to better reflect the fact
that the implemented method is optionally eligible for @Bean annotation.

See Javadoc for details.
2011-06-02 14:28:16 +00:00
Chris Beams 0304a4b74d Revert "Introduce Ordered#NOT_ORDERED"
This reverts commit da914bcfb4 and also
removes the use of Ordered#NOT_ORDERED from EnableTransactionManagement
and ProxyTransactionManagementConfiguration in favor of defaulting to
Ordered#LOWEST_PRIORITY, which is actually the default that results
when no 'order' attribute is specified in XML.
2011-06-02 06:49:15 +00:00
Chris Beams c06752ef72 Rename {Default=>Standard}Environment
Issue: SPR-8348
2011-05-20 03:53:37 +00:00
Chris Beams 01e5120a26 Introduce @EnableTransactionManagement 2011-05-06 19:10:25 +00:00
Chris Beams 2bc3527f76 Consolidate annotation processing constants
Consolidating internal bean name and aspect class name constats within
AnnotationConfigUtils to allow access from both the context.config
and context.annotation packages without creating a relationship between
the two of them (they are unrelated leaf nodes in the packaging
currently).

The .transaction module does not have a similar utils class and already
has a relationship from transaction.config -> transaction.annotation,
so placing the constants in .annotation.TransactionManagementCapability
to be referenced by .config.AnnotationDrivenBeanDefinitionParser
2011-05-06 19:06:37 +00:00
Chris Beams 111fb71fe1 Remove "Feature" support introduced in 3.1 M1
Feature-related support such as @Feature, @FeatureConfiguration,
and FeatureSpecification types will be replaced by framework-provided
@Configuration classes and convenience annotations such as
@ComponentScan (already exists), @EnableAsync, @EnableScheduling,
@EnableTransactionManagement and others.

Issue: SPR-8012,SPR-8034,SPR-8039,SPR-8188,SPR-8206,SPR-8223,
SPR-8225,SPR-8226,SPR-8227
2011-05-06 19:03:52 +00:00
Chris Beams b0b1116f4b Propagate wrapped exception in SessionFactoryUtils
Improve stack traces in certain Hibernate failure cases by properly
chaining the cause exception.

Issue: SPR-7933
2011-03-31 12:07:30 +00:00
Juergen Hoeller df6be9f694 turned to package visibility 2011-02-10 01:58:21 +00:00
Chris Beams 9cc125531b Fix STS compatibility issues; other improvements
Revert changes to ParserContext, ReaderContext, and XmlReaderContext

    These changes cause cross-version incompatibilities at tooling time
    -- for instance, an STS version that ships with Spring 3.0.5
    classloads the ParserContext defined in that version, whereas it
    classloads NamespaceHandlers and BeanDefinitionParsers (by default)
    from the user application classpath, which may be building against
    3.1.0. If so, the changes introduced to these types in 3.1.0 are
    incompatible with expectations in the 3.0.5 world and cause all
    manner of problems.  In this case, it was NoSuchMethodError due to
    the newly-added XmlReaderContext.getProblemReporter() method; also
    IncompatibleClassChangeError due to the introduction of the
    ComponentRegistrar interface on ParserContext.

    Each of these problems have been mitigated, though the solutions
    are not ideal. The method mentioned has been removed, and instead
    the problemReporter field is now accessed reflectively.
    ParserContext now no longer implements ComponentRegistrar, and
    rather a ComponentRegistrarAdapter class has been introduced that
    passes method calls through to a ParserContext delegate.

Introduce AbstractSpecificationBeanDefinitionParser

    AbstractSpecificationBeanDefinitionParser has been introduced in
    order to improve the programming model for BeanDefinitionParsers
    that have been refactored to the new FeatureSpecification model.
    This new base class and it's template method implementation of
    parse/doParse ensure that common concerns like (1) adapting a
    ParserContext into a SpecificationContext, (2) setting source and
    source name on the specification, and (3) actually executing the
    specification are all managed by the base class.  The subclass
    implementation of doParse need only actually parse XML, populate
    and return the FeatureSpecification object.  This change removed
    the many duplicate 'createSpecificationContext' methods that had
    been lingering.

Minor improvement to BeanDefinitionReaderUtils API

    Introduced new BeanDefinitionReaderUtils#registerWithGeneratedName
    variant that accepts BeanDefinition as opposed to
    AbstractBeanDefinition, as BeanDefinition is all that is actually
    necessary to satisfy the needs of the method implementation. The
    latter variant accepting AbstractBeanDefinition has been deprecated
    but remains intact and delegates to the new variant in order to
    maintain binary compatibility.
2011-02-09 16:44:26 +00:00
Chris Beams 2f7c2230f0 Include license.txt and notice.txt in module JARs 2011-02-09 06:56:40 +00:00
Chris Beams 2d76dde611 Rename ExecutorContext => SpecificationContext 2011-02-08 19:08:41 +00:00
Chris Beams a2bc381ade Extract ProblemCollector interface 2011-02-08 19:07:03 +00:00
Chris Beams b4fea47d5c Introduce FeatureSpecification support
Introduce FeatureSpecification interface and implementations

    FeatureSpecification objects decouple the configuration of
    spring container features from the concern of parsing XML
    namespaces, allowing for reuse in code-based configuration
    (see @Feature* annotations below).

    * ComponentScanSpec
    * TxAnnotationDriven
    * MvcAnnotationDriven
    * MvcDefaultServletHandler
    * MvcResources
    * MvcViewControllers

Refactor associated BeanDefinitionParsers to delegate to new impls above

    The following BeanDefinitionParser implementations now deal only
    with the concern of XML parsing.  Validation is handled by their
    corresponding FeatureSpecification object.  Bean definition creation
    and registration is handled by their corresponding
    FeatureSpecificationExecutor type.

    * ComponentScanBeanDefinitionParser
    * AnnotationDrivenBeanDefinitionParser (tx)
    * AnnotationDrivenBeanDefinitionParser (mvc)
    * DefaultServletHandlerBeanDefinitionParser
    * ResourcesBeanDefinitionParser
    * ViewControllerBeanDefinitionParser

Update AopNamespaceUtils to decouple from XML (DOM API)

    Methods necessary for executing TxAnnotationDriven specification
    (and eventually, the AspectJAutoProxy specification) have been
    added that accept boolean arguments for whether to proxy
    target classes and whether to expose the proxy via threadlocal.

    Methods that accepted and introspected DOM Element objects still
    exist but have been deprecated.

Introduce @FeatureConfiguration classes and @Feature methods

    Allow for creation and configuration of FeatureSpecification objects
    at the user level.  A companion for @Configuration classes allowing
    for completely code-driven configuration of the Spring container.

    See changes in ConfigurationClassPostProcessor for implementation
    details.

    See Feature*Tests for usage examples.

    FeatureTestSuite in .integration-tests is a JUnit test suite designed
    to aggregate all BDP and Feature* related tests for a convenient way
    to confirm that Feature-related changes don't break anything.
    Uncomment this test and execute from Eclipse / IDEA. Due to classpath
    issues, this cannot be compiled by Ant/Ivy at the command line.

Introduce @FeatureAnnotation meta-annotation and @ComponentScan impl

    @FeatureAnnotation provides an alternate mechanism for creating
    and executing FeatureSpecification objects.  See @ComponentScan
    and its corresponding ComponentScanAnnotationParser implementation
    for details.  See ComponentScanAnnotationIntegrationTests for usage
    examples

Introduce Default[Formatting]ConversionService implementations

    Allows for convenient instantiation of ConversionService objects
    containing defaults appropriate for most environments.  Replaces
    similar support originally in ConversionServiceFactory (which is now
    deprecated). This change was justified by the need to avoid use
    of FactoryBeans in @Configuration classes (such as
    FormattingConversionServiceFactoryBean). It is strongly preferred
    that users simply instantiate and configure the objects that underlie
    our FactoryBeans. In the case of the ConversionService types, the
    easiest way to do this is to create Default* subtypes. This also
    follows convention with the rest of the framework.

Minor updates to util classes

    All in service of changes above. See diffs for self-explanatory
    details.

    * BeanUtils
    * ObjectUtils
    * ReflectionUtils
2011-02-08 14:42:33 +00:00
Chris Beams 9420bdc246 Document createEnvironment() methods
in AbstractApplicationContext and SpringContextResourceAdapter
2011-01-05 22:25:42 +00:00
Chris Beams 2b99cf6d29 Refactor Environment and PropertySource
* Environment now extends PropertyResolver
* Environment no longer exposes resolver and sources
* PropertySource is String,Object instead of String,String
* PropertySource no longer assumes enumerability of property names
* Introduced EnumerablePropertySource for those that do have enumerable property names
2011-01-05 22:24:14 +00:00
Chris Beams 5e6912302a Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:

    * Easy access to a type hierarchy that can answer the question
      "What *Aware interfaces are available?", without requiring
      text-based searches. Also clearly excludes false positives like
      TargetClassAware and ParamAware, which while similarly named,
      are not semantically similar to traditional *Aware interfaces
      in Spring.

    * Minor potential performance improvements in
      AbstractAutowireCapableBeanFactory and
      ApplicationContextAwareProcessor. Both have blocks of sequential
      instanceof checks in order to invoke any *Aware interface callback
      methods. For a bean that implements none of these interfaces,
      the whole sequence can be avoided by guarding first with
          if (bean instanceof Aware) {
              ...
          }

Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above.
2011-01-03 10:13:57 +00:00