Commit Graph

4856 Commits

Author SHA1 Message Date
Chris Beams 17ce06acec Update changelog re destroy method inference
Issue: SPR-8751
2011-10-12 03:56:17 +00:00
Chris Beams 38e90105a0 Support destroy method inference
Anywhere the value of a destroy method may be expressed, specifying
the value "(inferred)" now indicates that the container should attempt
to automatically discover a destroy method. This functionality is
currently limited to detecting public, no-arg methods named 'close';
this is particularly useful for commonly used types such as Hibernate
SessionFactory most JDBC DataSource implementations, JMS connection
factories, and so forth.

This special value is captured as the constant
AbstractBeanDefinition#INFER_METHOD, which in turn serves as the default
value of the @Bean#destroyMethod attribute.

For example in the following case

    @Bean
    public BasicDataSource dataSource() { ... }

the container will automatically detect BasicDataSource#close and invoke
it when the enclosing ApplicationContext is closed. This is exactly
equivalent to

    @Bean(destroyMethod="(inferred)")
    public BasicDataSource dataSource() { ... }

A user may override this inference-by-default convention simply by
specifying a different method

    @Bean(destroyMethod="myClose")
    public MyBasicDataSource dataSource() { ... }

or, in the case of a bean that has an otherwise inferrable 'close'
method, but the user wishes to disable handling it entirely, an empty
string may be specified

    @Bean(destroyMethod="")
    public MyBasicDataSource dataSource() { ... }

The special destroy method name "(inferred)" may also be specified in
an XML context, e.g.

    <bean destroy-method="(inferred)">
        or
    <beans default-destroy-method="(inferred)">

Note that "(inferred)" is the default value for @Bean#destroyMethod,
but NOT for the destroy-method and default-destroy-method attributes
in the spring-beans XML schema.

The principal reason for introducing this feature is to avoid forcing
@Configuration class users to type destroyMethod="close" every time a
closeable bean is configured. This kind of boilerplate is easily
forgotten, and this simple convention means the right thing is done
by default, while allowing the user full control over customization or
disablement in special cases.

Issue: SPR-8751
2011-10-12 02:09:04 +00:00
Chris Beams 8cafb7ee13 Fix warnings in DisposableBeanAdapter 2011-10-12 02:08:52 +00:00
Sam Brannen f0ded6a91f [SPR-8401] Added missing TransferServiceConfig code listing. 2011-10-11 23:32:10 +00:00
Sam Brannen dc95e49c27 [SPR-8240][SPR-8401] formatting and polishing. 2011-10-11 23:20:50 +00:00
Sam Brannen 027c25d823 [SPR-8401] Documented TestContext support for @ActiveProfiles in the reference manual. 2011-10-11 23:05:28 +00:00
Juergen Hoeller e1721976bb final preparations for 3.1 RC1 release 2011-10-11 22:08:01 +00:00
Juergen Hoeller 12c1f47733 extended LocalSessionFactoryBean options for Hibernate 4; factored out LocalSessionFactoryBuilder 2011-10-11 22:05:19 +00:00
Chris Beams d09faabcb6 Update changelog re @EnableAspectJAutoProxy
Issue: SPR-8138
2011-10-11 19:15:10 +00:00
Chris Beams 739775ca19 Introduce @EnableAspectJAutoProxy
Issue: SPR-8138
2011-10-11 18:51:41 +00:00
Chris Beams b08a6d32a4 Polish "What's new in Spring 3.1" re @Enable* 2011-10-11 18:51:32 +00:00
Chris Beams 5876307997 Update "What's new in Spring 3.1" re Hibernate 4.x 2011-10-11 18:51:30 +00:00
Chris Beams f60a40be44 Polish Environment subsystem Javadoc 2011-10-11 18:51:26 +00:00
Chris Beams 3920c5a158 Polish @ComponentScan/@Configuration/@Lazy Javadoc 2011-10-11 18:51:15 +00:00
Juergen Hoeller 1cea52b66b renamed mapKey/ValueTypeDescriptor methods back to getMapKey/ValueTypeDescriptor (for Spring 3.0.x compatibility) 2011-10-11 16:55:07 +00:00
Juergen Hoeller ba2c8fc592 deprecated JdoTemplate and co in favor of native PersistenceManager usage 2011-10-11 16:48:08 +00:00
Juergen Hoeller feed594ba4 deprecated JpaTemplate and co in favor of native EntityManager usage 2011-10-11 16:24:32 +00:00
Juergen Hoeller 0d02ef5fe5 removed conversation prototype from 3.1 codebase 2011-10-11 16:22:15 +00:00
Sam Brannen 60fb3efc2b [SPR-8240] Added new "Mixing XML resources and @Configuration classes" section to the testing chapter. 2011-10-11 12:39:57 +00:00
Rossen Stoyanchev 1aa1278e99 SPR-8725 Change modifier in WebMvcConfigurationSupport methods from package private to public.
Use of package private @Bean methods can cause issues if the class
is extended and the sub-class is in a different package. This is 
covered in detail in SPR-8756.
2011-10-11 10:43:08 +00:00
Chris Beams 9be6ddc946 Include Hibernate 4.x in Eclipse classpath 2011-10-11 05:31:31 +00:00
Chris Beams 2760542182 Add repro test case for package-private @Bean issue
Reproduces the issue described in SPR-8756 in addition to demonstrating
the suggested workaround.

Issue: SPR-8756, SPR-8725
2011-10-11 04:02:03 +00:00
Juergen Hoeller cfb380d653 fixed unbind failure through appropriate guard 2011-10-11 02:08:26 +00:00
Juergen Hoeller d54922642c made compilation work with Hibernate 4.0 next to Hibernate 3.x 2011-10-11 01:53:43 +00:00
Juergen Hoeller 3032b214c6 avoid hard JPA 2.0 dependency 2011-10-11 01:31:22 +00:00
Juergen Hoeller 6aaf7fefde removed Hibernate EntityManager 4.0 dependency since it is not needed for compilation and not for standard runs of the test suite either 2011-10-11 01:22:20 +00:00
Juergen Hoeller 0256f3d43e consistently use Unix line separator 2011-10-11 01:14:20 +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
Juergen Hoeller 4c49cc73b2 avoid NPE in case of no "hibernateProperties" specified 2011-10-11 01:10:07 +00:00
Juergen Hoeller e1a6bb2d2e committed initial Hibernate 4.0 support 2011-10-11 01:08:41 +00:00
Juergen Hoeller d02ac641cc further additions to manual changelog for 3.1 RC1 2011-10-11 01:02:55 +00:00
Juergen Hoeller 339c57e41a polishing 2011-10-11 01:00:31 +00:00
Juergen Hoeller 37c601c8dd HibernateJpaDialect exposes underlying Session for underlying SessionFactory 2011-10-11 00:58:47 +00:00
Juergen Hoeller 0ff83606df committed initial Hibernate 4.0 support 2011-10-11 00:53:01 +00:00
Sam Brannen 55f91e54c4 Corrected Javadoc: handleListenerException() and invokeErrorHandler() log at WARN level, not at ERROR level. 2011-10-10 22:13:45 +00:00
Juergen Hoeller 8bd1fc817a introduced extended WritableResource interface 2011-10-10 19:46:00 +00:00
Chris Beams f35dfd4107 Update stale external javadoc links
Certain external javadoc links were broken or out of date, namely
Hibernate, Java SE and EE 6, Quartz, and Apache Pluto. All resolve
properly now.

Issue: SPR-8720
2011-10-10 06:12:29 +00:00
Chris Beams 980c15d578 Distinguish between different bridge method types
Add BridgeMethodResolver#isJava6VisibilityBridgeMethodPair to
distinguish between (a) bridge methods introduced in Java 6 to
compensate for inheriting public methods from non-public superclasses
and (b) bridge methods that have existed since Java 5 to accommodate
return type covariance and generic parameters.

In the former case, annotations should be looked up from the original
bridged method (SPR-7900).  In the latter, the annotation should be
looked up against the bridge method itself (SPR-8660).

As noted in the Javadoc for the new method, see
http://stas-blogspot.blogspot.com/2010/03/java-bridge-methods-explained.html
for a useful description of the various types of bridge methods, as
well as http://bugs.sun.com/view_bug.do?bug_id=6342411, the bug fixed in
Java 6 resulting in the introduction of 'visibility bridge methods'.

Issue: SPR-8660, SPR-7900
2011-10-10 05:40:21 +00:00
Sam Brannen 6248135a4f [SPR-8240] Updating the "new in 3.1" chapter regarding new testing support; polishing the TestContext Framework section of the reference manual. 2011-10-09 23:32:01 +00:00
Sam Brannen 71396ac07b Polishing JavaDoc 2011-10-09 23:29:59 +00:00
Chris Beams 6837111bda Refactor AnnotationUtils#findAllAnnotationAttributes
Remove all convenience variants of #findAllAnnotationAttributes and
refactor the remaining method to accept a MetadataReaderFactory
instead of creating its own SimpleMetadataReaderFactory internally.
This allows clients to use non-default class loaders as well as
customize the particular MetadataReaderFactory to be used (e.g.
'simple' vs 'caching', etc).

Issue: SPR-8752
2011-10-09 20:32:21 +00:00
Chris Beams 3bb01ee68b Revert "Introduce (Annotation)SessionFactoryBuilder types"
This commit and the several before it back out the
SessionFactoryBuilder and AnnotationSessionFactoryBuilder types
recently introduced in 3.1 M2. This is in light of the impending
release of Hibernate 4.0 GA and our own support for it the new
org.springframework.orm.hibernate4 package (not yet committed).

This new package will have a similar, but far simpler, arrangement of
a single LocalSessionFactoryBuilder and LocalSessionFactoryBean pair.
Hibernate 3.x support will remain largely as-is, however the
HibernateTransactionManager introduced with SPR-8076 will remain.

This reverts commit 9e8259198f.

Issue: SPR-8066, SPR-7936, SPR-8076, SPR-8098, SPR-8096, SPR-7387
2011-10-09 07:55:52 +00:00
Chris Beams 25796448f6 Revert "removed double javadoc"
This reverts commit 2d26c4992e.
2011-10-09 07:55:38 +00:00
Chris Beams 0d43023571 Revert "All SFBuilder setters return 'this' & use varargs"
This reverts commit 0e2ce565c9.
2011-10-09 07:55:33 +00:00
Chris Beams 1a8531b401 Revert "Automatically close SessionFactory objects"
This reverts commit bb4f48dcb3.

Issue: SPR-8114
2011-10-09 07:55:28 +00:00
Chris Beams b82d5ae8da Revert "Implement SessionFactoryImplementor in SF proxies"
This reverts commit 08ccd19c76.

Issue: SPR-8469
2011-10-09 07:55:21 +00:00
Chris Beams 363e08df22 Revert "Auto-unwrap SessionFactoryBuilder-created proxies"
This reverts commit 7903d6489f.

Issue: SPR-8492
2011-10-09 07:55:14 +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