Commit Graph

1180 Commits

Author SHA1 Message Date
Sam Brannen 5309e43ea0 [SPR-8178] @Ignore-ing testPrintNull() until it is determined why changes to GenericConversionService broke this test. 2011-09-26 17:39:04 +00:00
Sam Brannen 052d3e7ccb [SPR-8718] now using correct JIRA ID in the comments. 2011-09-26 16:28:34 +00:00
Sam Brannen f752b47fcb [SPR-8178] @Ignore-ing testDefaultNumberFormatting() until it is determined why changes to GenericConversionService broke this test. 2011-09-26 16:24:51 +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
Keith Donald 1a2f96000e clarified repository definition from DDD and removed comparison with DAO to reduce confusion 2011-09-13 14:31:41 +00:00
Chris Beams 2e5f3559d3 Fix handling of @EnableLoadTimeWeaving AUTODETECT
Issue: SPR-8643
2011-09-03 22:37:16 +00:00
Costin Leau d9de19d7b3 SPR-8653
+ refactor a bit the internals of CacheAspect to allow invocations that do not throw any exceptions (AspectJ)
2011-09-02 15:37:42 +00:00
Sam Brannen 1de71c6e37 [SPR-8222] Upgraded to JUnit 4.9. 2011-08-30 13:16:12 +00:00
Chris Beams 6db594c79d Register JndiPropertySource by default in servlet environments
Prior to this change, StandardServletEnvironment evaluated a
"jndiPropertySourceEnabled" flag to determine whether or not to add a
JndiPropertySource.  Following the changes introduced in SPR-8490, there
is now no reason not to enable a JNDI property source by default. This
change eliminates the support for "jndiPropertySourceEnabled" and adds
a JndiPropertySource automatically.

Issue: SPR-8545, SPR-8490
2011-08-20 03:02:31 +00:00
Chris Beams 36c1813828 Update ejb, inject-tck, jsr166 deps in context pom 2011-08-20 03:01:49 +00:00
Juergen Hoeller 90997e65cf fixed Hibernate Validator import range 2011-08-18 23:13:56 +00:00
Juergen Hoeller 9e375a860a polishing 2011-08-18 23:13:30 +00:00
Sam Brannen 87dad65ff0 [SPR-8622] Upgraded to JUnit 4.8.2 2011-08-18 16:06:31 +00:00
Sam Brannen 7f715ee803 Fixed minor typo in Javadoc. 2011-08-18 14:18:29 +00:00
Juergen Hoeller 28e6d9a692 added test for month sequence (SPR-7807) 2011-08-17 21:01:34 +00:00
Costin Leau 63a217a40a + add XML support for cache abstraction (cache-advice) - DRAFT 2011-08-16 17:35:01 +00:00
Juergen Hoeller 4acb0fa284 introduced ForkJoinPoolFactoryBean for Java 7 (alternative: add new jsr166.jar to Java 6) 2011-08-15 16:41:55 +00:00
Sam Brannen 2d6340af74 Deleting unnecessary TODOs and suppressing warnings. 2011-08-13 13:38:54 +00:00
Juergen Hoeller b9ebdd28fb polishing 2011-08-12 10:02:12 +00:00
Chris Beams 6404440cbf Fix typo in SmartLifecycle Javadoc
Issue: SPR-8570
2011-08-04 14:07:36 +00:00
Chris Beams 272f145132 Clarify Lifecycle#stop documentation
Issue: SPR-8570
2011-08-03 06:01:20 +00:00
Chris Beams 35d2ab3bf9 Document Lifecycle#stop concurrency semantics
Issue: SPR-8570
2011-07-29 21:39:42 +00:00
Juergen Hoeller 39616d4a25 polishing 2011-07-28 20:26:34 +00:00
Chris Beams b85440f2b6 Deprecate AbstractSingletonProxyFactoryBean 2011-07-26 22:29:14 +00:00
Chris Beams 3c2e48738a Remove CacheProxyFactoryBean 2011-07-26 22:29:09 +00:00
Chris Beams 2b371a7c9a Deprecate TransactionProxyFactoryBean 2011-07-26 22:29:04 +00:00
Juergen Hoeller abdae3d26b general revision of cache package; added ConcurrentMapCacheManager 2011-07-22 09:32:56 +00:00
Juergen Hoeller 48de81deec refined JBoss 6.0 note 2011-07-21 09:51:23 +00:00
Juergen Hoeller 7d8aa05c40 added "acceptProxyClasses" flag to RemoteInvocationSerializingExporter 2011-07-21 09:04:42 +00:00
Juergen Hoeller 2c199cf190 updated javadoc for server-specific LoadTimeWeavers 2011-07-21 08:36:40 +00:00
Chris Beams 718f025d64 Force lazy-init to false when parsing scheduled:task
A <scheduled:task> element declared within a
<beans default-lazy-init="true"> element represents a contradiction in
terms: such a task will never be executed.

For this reason, we now override any inherited lazy-init settings
when parsing <scheduled:task> elements, forcing lazy-init to false
for the underlying ScheduledTaskRegistrar bean.

Thanks to Mike Youngstrom for contributing an initial patch.

Issue: SPR-8498
2011-07-19 23:00:12 +00:00
Costin Leau 1d690ab99f SPR-8533
+ add LTW support for JBoss 7
(renamed existing classes to MC (JBoss 5&6) and introduced Modules (JBoss 7))
2011-07-19 07:24:47 +00:00
Juergen Hoeller d97a5bf889 minor javadoc revision 2011-07-18 21:50:15 +00:00
Juergen Hoeller 94ac883eb1 polishing 2011-07-18 21:37:24 +00:00
Chris Beams 236b0305e8 Refactor execution of config class enhancement
This change returns the invocation order of
ConfigurationClassPostProcessor#enhanceConfigurationClasses to its
pre-3.1 M2 state. An earlier (and now unnecessary) refactoring in
service of @Feature method processing caused the change that this now
reverts.
2011-07-18 21:23:55 +00:00
Juergen Hoeller c0e429a9a5 polishing 2011-07-15 14:48:51 +00:00
Juergen Hoeller 5937779bb1 call setEnvironment before other awareness methods rather than after; fixed AccessControlContext applicability check 2011-07-15 14:40:38 +00:00
Costin Leau 4e1cb2b823 move default value wrapper into support package (rather then interceptor) 2011-07-15 14:13:22 +00:00
Chris Beams fd42a65c6c Allow ConfigurationCPP to process multiple registries
Prior to this change, an instance of ConfigurationClassPostProcessor
would throw IllegalStateException if its
postProcessBeanDefinitionRegistry method were called more than once.
This check is important to ensure that @Configuration classes are
not proxied by CGLIB multiple times, and works for most normal use
cases.

However, if the same CCPP instance is used to process multiple
registries/factories/contexts, this check creates a false negative
because it does not distinguish between invocations of
postProcessBeanDefinitionRegistry across different registries.

A use case for this, though admittedly uncommon, would be creating
a CCPP instance and registering it via
ConfigurableApplicationContext#addBeanDefinitionPostProcessor against
several ApplicationContexts. In such a case, the same CCPP instance
will post-process multiple different registry instances, and throw the
above mentioned exception.

With this change, CCPP now performs lightweight tracking of the
registries/beanFactories that it has already processed by recording
the identity hashcodes of these objects.  This is only slightly more
complex than the previous boolean-based 'already processed' flags, and
prevents this issue (however rare it may be) from occurring.

Issue: SPR-8527
2011-07-13 23:30:57 +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
Costin Leau f5fdedea60 + fix compilation error 2011-07-13 13:51:20 +00:00
Costin Leau b82ab4950d + removed unneeded generic 2011-07-13 12:58:09 +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 807d612978 Determine FactoryBean object type via generics
For the particular use case detailed in SPR-8514, with this change we
now attempt to determine the object type of a FactoryBean through its
generic type parameter if possible.

For (a contrived) example:

@Configuration
public MyConfig {
    @Bean
    public FactoryBean<String> fb() {
        return new StringFactoryBean("foo");
    }
}

The implementation will now look at the <String> generic parameter
instead of attempting to instantiate the FactoryBean in order to call
its #getObjectType() method.

This is important in order to avoid the autowiring lifecycle issues
detailed in SPR-8514.  For example, prior to this change, the following
code would fail:

@Configuration
public MyConfig {
    @Autowired Foo foo;

    @Bean
    public FactoryBean<String> fb() {
        Assert.notNull(foo);
        return new StringFactoryBean("foo");
    }
}

The reason for this failure is that in order to perform autowiring,
the container must first determine the object type of all configured
FactoryBeans.  Clearly a chicken-and-egg issue, now fixed by this
change.

And lest this be thought of as an obscure bug, keep in mind the use case
of our own JPA support: in order to configure and return a
LocalContainerEntityManagerFactoryBean from a @Bean method, one will
need access to a DataSource, etc -- resources that are likely to
be @Autowired across @Configuration classes for modularity purposes.

Note that while the examples above feature methods with return
types dealing directly with the FactoryBean interface, of course
the implementation deals with subclasses/subinterfaces of FactoryBean
equally as well.  See ConfigurationWithFactoryBeanAndAutowiringTests
for complete examples.

There is at least a slight risk here, in that the signature of a
FactoryBean-returing @Bean method may advertise a generic type for the
FactoryBean less specific than the actual object returned (or than
advertised by #getObjectType for that matter). This could mean that an
autowiring target may be missed, that we end up with a kind of
autowiring 'false negative' where FactoryBeans are concerned. This is
probably a less common scenario than the need to work with an autowired
field within a FactoryBean-returning @Bean method, and also has a clear
workaround of making the generic return type more specific.

Issue: SPR-8514
2011-07-06 09:15:37 +00:00
Chris Beams 7c25c84ee2 Deprecate/move CGLIB methods AopUtils=>ClassUtils
isCglibProxy* methods in AopUtils are useful in lower-level modules,
i.e. those that cannot depend on .aop.  Therefore copied these methods
to ClassUtils; deprecated the existing ones in AopUtils and now
delegating to the new location; switched all usage of
AopUtils#isCglibProxy* within the framework to use
ClassUtils#isCglibProxy* instead.
2011-07-06 09:15:27 +00:00
Chris Beams 78b60947ad Rename JMX tests to avoid jmxremote_optional error
Even after applying @Ignore to these tests at the class level, they
still run (and fail) under ant when the jmxremote_optional jar is not
present. See the issues mentioned below for information on how these
tests will be re-enabled.

Issue: SPR-8089, SPR-8093, SPR-8458
2011-07-06 09:13:17 +00:00
Juergen Hoeller c07eb6bb9a added "disabled" property to EhCacheFactoryBean 2011-07-04 22:14:05 +00:00
Juergen Hoeller 22939b6d05 properly wrap IndexOutOfBoundsException even for List 2011-07-03 20:24:12 +00:00
Juergen Hoeller 4c75054f90 DataBinder uses a default limit of 256 for array/collection auto-growing (SPR-7842) 2011-07-03 19:26:49 +00:00
Chris Beams d9ee958d88 Refactor JndiPropertySource
Prior to this change, JndiPropertySource worked directly against a JNDI
Context instance as its 'source' object.  This works well enough, but is
not nearly as fully-featured as Spring's existing JndiLocatorDelegate.

This change refactors JndiPropertySource from relying on an underlying
Context to relying on an underlying JndiLocatorDelegate.  By default,
the delegate's "resourceRef" property is set to true, meaning that the
implementation will always try to prepand a given name with
"java:comp/env/" before looking up the name, and upon failure will drop
back to the given name sans prefix.

See JndiPropertySource Javadoc for complete details.

Issue: SPR-8490
2011-07-02 21:26:44 +00:00
Chris Beams ce0a0ff3d4 Move JNDI_PROPERTY_SOURCE_ENABLED_FLAG constant
Move JNDI_PROPERTY_SOURCE_ENABLED_FLAG from JndiPropertySource to
StandardServletEnvironment, as this is the only context in which the
constant makes sense.
2011-07-02 21:26:38 +00:00
Chris Beams ea6d363c1e Return null from JndiPropertySource on lookup failure
Issue: SPR-8490
2011-07-02 21:26:30 +00:00
Costin Leau 26dbfba6c0 SPR-8477
+ add no-op cache implementations suitable for cache declarations w/o a backing store
2011-06-30 18:17:39 +00:00
David Syer bd0f68d095 SPR-5749: Add defensive matching using target class loader
* Changes to ASpectJExpressionPointcut plus some tests in Spring AOP
* plus some tests in groovy support
2011-06-24 17:23:43 +00:00
Juergen Hoeller 4664366aca getBean(name, type) attempts type conversion if necessary (SPR-8480) 2011-06-22 20:54:02 +00:00
Juergen Hoeller e0d558b084 getBean(name, type) attempts type conversion if necessary (SPR-8480) 2011-06-22 20:52:28 +00:00
Chris Beams 41e5d55d52 Fix bridge method detection for class hierarchies
Prior to this change, @Autowired injection against an instance of a
subclass having different visibility than its superclass would fail
if the @Autowired method is declared only in the superclass. This is due
to an apparent change in the rules around bridge method generation
between Java 5 and Java 6, and possibly even varying across compiler
vendors.

Now, BridgeMethodResolver is used consistently when detecting
@Autowired, @Inject and @Resource metadata to bypass these bridge
methods if they exist.

Issue: SPR-7900
2011-06-21 14:59:37 +00:00
Chris Beams 4fb811572e Compensate for Windows paths in XmlBeanFactoryTests
Issue: SPR-8439
2011-06-20 08:44:24 +00:00
David Syer 8e35734856 SPR-6268: check AnnotationUtils works with Groovy concrete classes (plus remove compiler warnings) 2011-06-17 13:35:57 +00:00
David Syer 64fd0b081d SPR-6268: Add proxy-target-class to <lang:groovy/> 2011-06-17 12:14:01 +00:00
Chris Beams 4fc386a4f5 Provide default ParameterNameDiscoverer for AACBF
Prior to this change, AbstractAutowireCapableBeanFactory did not support
a default ParameterNameDiscoverer.  This meant that attempting to use
<constructor-arg name=".."> syntax would fail (with a fairly obscure
exception) as that feature depends on a ParameterNameDiscoverer to
introspect the constructor arguments.

This lack of a default was originally intended to avoid a dependency on
ASM, but now that (a) .asm is a built-in module and (b) .beans has a
non-optional compile-time dependency on .asm, there is no reason not to
provide this default.

The net effect is that in a number of locations throughout the
framework, namely in GenericApplicationContext and
AbstractRefreshableApplicationContext, it is no longer necessary to
explicitly call AACBF#setParameterNameDiscoverer. This also means that
using a naked BeanFactory (likely for testing scenarios) is that much
easier.

Issue: SPR-8184
2011-06-17 09:47:19 +00:00
Chris Beams 8cb5c36512 Consolidate tests related to @Config inheritance
Issue: SPR-8183
2011-06-17 09:46:19 +00:00
Chris Beams cc814519c8 Revert "Re-enable ignored JMX tests"
As of SPR-8093, jmxremote_optional.jar is present on the build
server in jre/lib/ext, but it is not by default present on local
developer / user machines, meaning that the build ends up broken
by default.

Issue: SPR-8089, SPR-8093, SPR-8458
2011-06-16 06:34:23 +00:00
Juergen Hoeller f288060ad8 restored support for String-to-ContextResource conversion (SPR-8383) 2011-06-15 15:40:12 +00:00
Juergen Hoeller 5c1e86b47f refined WebLogic RMI descriptor to only mark 'getTargetInterfaceName' method as idempotent (SPR-8369) 2011-06-14 15:07:23 +00:00
Juergen Hoeller 878ff89014 added further conversion tests (triggered by 3.0.6 backports) 2011-06-13 23:57:53 +00:00
Juergen Hoeller 6c3cc786d0 added further conversion tests (triggered by 3.0.6 backports) 2011-06-13 23:43:46 +00:00
Chris Beams 234bca6462 Resolve ${...} placeholders in @PropertySource
Issue: SPR-8442
2011-06-13 04:23:08 +00:00
Chris Beams 799785abad Polish @EnableScheduling Javadoc 2011-06-12 06:56:37 +00:00
Chris Beams 2d68b726b5 Add syntax highlighting to Javadoc where necessary
Issue: SPR-8426
2011-06-12 06:56:17 +00:00
Sam Brannen c0131fe108 Polishing Eclipse classpath settings 2011-06-11 19:56:48 +00:00
Juergen Hoeller e1d81e04bc prepared Spring's DataSource and RowSet adapters for forward compatibility with JDBC 4.1 2011-06-09 23:09:55 +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 ae61aa3555 Revert introduction of AnnotationConfigCapableAC
Per review with Juergen in light of SPR-8413, which will revisit the
overall structure of ACAC and ACWAC.

Issue: SPR-8365, SPR-8413
2011-06-09 02:54:34 +00:00
Juergen Hoeller cac42ef233 fixed pattern list test 2011-06-07 23:24:30 +00:00
Chris Beams 4a3c1292bc Preserve DefaultContextLoadTimeWeaver no-arg ctor
Issue: SPR-8317
2011-06-06 13:15:10 +00:00
Chris Beams 620018d16b Introduce @EnableLoadTimeWeaving
Issue: SPR-8317
2011-06-06 08:31:18 +00:00
Mark Fisher 72420c79cb SPR-8205 added support for a 'trigger' attribute (bean ref) on scheduled-task elements 2011-06-03 18:54:21 +00:00
Sam Brannen f3f29412d4 Increased timeout in calls to assertStopWatchTimeLimit() to increase stability of the build. 2011-06-03 15:44:08 +00:00
Oliver Gierke c7a350cde7 SPR-7477 - Added lazy-init attribute to jee namespace 2011-06-03 08:51:56 +00:00
Sam Brannen 74b169e886 [SPR-8393] AnnotatedBeanDefinitionReader's constructor now inherits the Environment of supplied BeanDefinitionRegistry. 2011-06-02 17:33:12 +00:00
Chris Beams cee9da36eb Mention code alternatives in context and mvc XSDs 2011-06-02 14:45:00 +00:00
Chris Beams 9ca9287e35 Polish @Primary Javadoc 2011-06-02 14:44:26 +00:00
Chris Beams aa0c64d2f2 Polish @EnableScheduling Javadoc and related XSD 2011-06-02 14:43:59 +00:00
Chris Beams 3e5c6306be Polish @EnableAsync Javadoc and related XSD 2011-06-02 14:42:26 +00:00
Costin Leau 7be1b5c3f5 revised cache abstraction
+ remove generic signature on key generator (as the type is not used anywhere)
+ add a small improvement to CacheAspect to nicely handle the cases where the aspect is pulled in but not configured
2011-06-02 10:01:14 +00:00
Sam Brannen 0c775416a6 [SPR-8089][SPR-8093] Re-enabled ignored JMX tests based on the feedback that jmxremote_optional.jar is now present "jre/lib/ext/ in both 1.5 and 1.6 JDKs on the build server". 2011-06-01 14:12:03 +00:00
Chris Beams 4feacf31e7 Polish AdviceMode Javadoc 2011-05-31 06:41:35 +00:00
Chris Beams 2b4328023e Improve ApplicationContextInitializer sorting
ContextLoader and FrameworkServlet now use
AnnotationAwareOrderComparator to support @Order usage; previously
supported only implementation of the Ordered interface.
2011-05-30 12:55:33 +00:00
Juergen Hoeller 98c6a2784f RemoteExporter uses an opaque proxy for 'serviceInterface' exposure (no AOP interfaces exposed) 2011-05-29 20:52:37 +00:00
Chris Beams 2ceeff370a Allow multiple locations via @PropertySource#value
Issue: SPR-8314
2011-05-25 10:52:25 +00:00
Chris Beams 0756a6abfe Polish PropertySource and Environment Javadoc 2011-05-25 10:52:03 +00:00
Keith Donald 01cbfd4f6f added null binding check for primitives for all conversion results; polishing 2011-05-24 17:53:18 +00:00
Chris Beams c4363673dc Delegate parent environment to child app contexts
Calls to AbstractApplicationContext#setParent delegate the parent
context environment to the child.

This ensures that any property sources added to the parent are available
to the child as well as ensuring that any profiles activated are
activated everywhere.

Child contexts may still choose to replace their environment (through an
ApplicationContextInitializer, for example).  In any case, however, in
the root/child web application context relationship established by
ContextLoader + DispatcherServlet, the child is guaranteed to have
already been given the parent environment by the time it is delegated
to any ACIs.

See AbstractApplicationContext#setParent for implementation

See FrameworkServlet#createWebApplicationContext for order in which
setParent then initializeWebApplicationContext are called.

Issue: SPR-8185
2011-05-23 10:04:00 +00:00
Chris Beams c696e195fa Introduce AnnotationConfigCapableApplicationContext
AnnotationConfigApplicationContext and
AnnotationConfigWebApplicationContext both expose #register and #scan
methods as of the completion of SPR-8320. This change introduces a new
interface that declares each of these methods and refactors ACAC and
ACWAC to implement it.

Beyond information value, this is useful for implementors of the
ApplicationContextInitializer interface, in that users may create an ACI
that works consistently across ACAC and ACWAC for standalone (e.g.
testing, batch) or web (e.g. production) use.

Issue: SPR-8365,SPR-8320
2011-05-23 10:03:23 +00:00
Chris Beams 56720fc42c Support "contextInitializerClasses" init-param
FrameworkServlet now has support equivalent to ContextLoader and its
"contextInitializerClasses" context-param introduced in 3.1 M1.

This allows users to specify ApplicationContextInitializers at the root
(ContextLoader) level and/or at the DispatcherServlet level.

Issue: SPR-8366
2011-05-23 10:02:18 +00:00
Chris Beams 95b1dbadb0 Register nested @Configuration classes automatically
The following is now possible:

@Configuration
public class AppConfig {
    @Inject DataSource dataSource;

    @Bean
    public MyBean myBean() {
        return new MyBean(dataSource);
    }

    @Configuration
    static class DatabaseConfig {
        @Bean
        DataSource dataSource() {
            return new EmbeddedDatabaseBuilder().build();
        }
    }
}

public static void main(String... args) {
    AnnotationConfigApplicationContext ctx =
        new AnnotationConfigApplicationContext(AppConfig.class);
    ctx.getBean(MyBean.class);     // works
    ctx.getBean(DataSource.class); // works
}

Notice that the @Import annotation was not used and that only AppConfig
was registered against the context. By virtue of the fact that
DatabaseConfig is a member class of AppConfig, it is automatically
registered when AppConfig is registered. This avoids an awkward and
redundant @Import annotation when the relationship is already implicitly
clear.

See @Configuration Javadoc for details.

Issue: SPR-8186
2011-05-21 01:20:33 +00:00
Chris Beams 76e3d2855a Polish @Configuration-related Javadoc 2011-05-21 01:19:25 +00:00
Chris Beams f893b62a9b Rename {DefaultWeb=>StandardServlet}Environment
Issue: SPR-8348
2011-05-20 03:55:56 +00:00
Chris Beams c06752ef72 Rename {Default=>Standard}Environment
Issue: SPR-8348
2011-05-20 03:53:37 +00:00
Costin Leau b39673aa79 revised cache abstraction
- removed generics from Cache/CacheManager (they add no value since it's an SPI not API)
+ update docs and tests
+ renamed ConcurrentCacheFactoryBean to ConcurrentMapCacheFactoryBean
2011-05-18 18:34:41 +00:00
Costin Leau dadd0f57ee revised cache abstraction
- removed AbstractDelegatingCache (a cache is not a map, no need to offer a template)
+ renamed ConcurrentCache to ConcurrentCacheMap
2011-05-18 17:43:13 +00:00
Chris Beams 4520ea8690 Revert #processConfigBeanDefinitions to 3.0.x API
Revert signature of
ConfigurationClassPostProcessor#processConfigBeanDefinitions to its form
found in the 3.0.x line.  Refactorings made during 3.1 development
caused otherwise package-private types such as
ConfigurationClassBeanDefinitionReader to escape through this public
method, causing issues for STS as well as being a general design issue.

Upon review, the refactorings could easily be backed out in favor of a
simpler approach, and this has been done.

This also means that ConfigurationClassBeanDefinitionReader can return
to package-private visibility, and this change has been made as well.

Issue: SPR-8200
2011-05-18 08:53:46 +00:00
Chris Beams 6fcea8b99d Remove ConfigurationClassParser from public API
Issue: SPR-8200
2011-05-17 19:15:17 +00:00
Costin Leau 8dfcae535e revise cache API
+ update failing test
2011-05-17 18:16:07 +00:00
Costin Leau 0eb40e1e5e revise cache API
+ update failing test
2011-05-17 18:01:35 +00:00
Costin Leau 861e481755 revise cache API
+ update failing test
2011-05-17 17:09:49 +00:00
Costin Leau 3699a037a5 revise cache API
+ add missing files (remember to check "show unversioned files")
2011-05-17 16:58:15 +00:00
Costin Leau 0b917e3f9c revise cache API
- eliminate unneeded methods
+ introduced value wrapper (name still to be decided) to avoid cache race conditions
+ improved name consistency
2011-05-17 16:50:00 +00:00
Costin Leau 700a02b094 SPR-8334
+ commit missing configs
2011-05-13 16:09:33 +00:00
Costin Leau cc519e7c6d SPR-8334
+ commit missing configs
2011-05-13 15:59:22 +00:00
Costin Leau a986d758e7 SPR-
+ remove duplicate class
2011-05-13 15:37:10 +00:00
Chris Beams 2afeb08e3c Fix @Autowired+@PostConstruct+@Configuration issue
A subtle issue existed with the way we relied on isCurrentlyInCreation
to determine whether a @Bean method is being called by the container
or by user code.  This worked in most cases, but in the particular
scenario laid out by SPR-8080, this approach was no longer sufficient.

This change introduces a ThreadLocal that contains the factory method
currently being invoked by the container, such that enhanced @Bean
methods can check against it to see if they are being called by the
container or not.  If so, that is the cue that the user-defined @Bean
method implementation should be invoked in order to actually create
the bean for the first time.  If not, then the cached instance of
the already-created bean should be looked up and returned.

See ConfigurationClassPostConstructAndAutowiringTests for
reproduction cases and more detail.

Issue: SPR-8080
2011-05-12 12:28:13 +00:00
Chris Beams 57206db152 Refine ignored @PropertySource log warning
If the enclosing environment does not implement ConfigurableEnvironment,
then @PropertySource annotations are ignored because there is no way to
add them to the Environment. Now checking first to see if there are any
@PropertySource annotations present before issuing the warning.

Issue: SPR-8314
2011-05-12 12:27:14 +00:00
Chris Beams c8bc54e0cc Introduce @PropertySource
Allows a convenient mechanism for contributing a PropertySource to the
enclosing Spring Environment. See @PropertySource Javadoc for
complete details and PropertySourceAnnotationTests for examples.

Issue: SPR-8314
2011-05-11 13:28:33 +00:00
Chris Beams 404f798048 Support 'required properties' precondition
Users may now call #setRequiredProperties(String...) against the
Environment (via its ConfigurablePropertyResolver interface) in order
to indicate which properties must be present.

Environment#validateRequiredProperties() is invoked by
AbstractApplicationContext during the refresh() lifecycle to perform
the actual check and a MissingRequiredPropertiesException is thrown
if the precondition is not satisfied.

Issue: SPR-8323
2011-05-11 07:36:04 +00:00
Chris Beams 693204aef8 Polish @Configuration Javadoc
Add note that nested @Configuration classes must be static.
2011-05-11 06:08:40 +00:00
Chris Beams 52bef0b7b0 Allow static modifier on @Bean methods
Declaring @Bean methods as 'static' is now permitted, whereas previously
it raised an exception at @Configuration class validation time.

A static @Bean method can be called by the container without requiring
the instantiation of its declaring @Configuration class. This is
particularly useful when dealing with BeanFactoryPostProcessor beans,
as they can interfere with the standard post-processing lifecycle
necessary to handle @Autowired, @Inject, @Value, @PostConstruct and
other annotations.

static @Bean methods cannot recieve CGLIB enhancement for scoping and
AOP concerns. This is acceptable in BFPP cases as they rarely if ever
need it, and should not in typical cases ever be called by another
@Bean method.  Once invoked by the container, the resulting bean will
be cached as usual, but multiple invocations of the static @Bean method
will result in creation of multiple instances of the bean.

static @Bean methods may not, for obvious reasons, refer to normal
instance @Bean methods, but again this is not likely a concern for BFPP
types. In the rare case that they do need a bean reference, parameter
injection into the static @Bean method is technically an option, but
should be avoided as it will potentially cause premature instantiation
of more beans that the user may have intended.

Note particularly that a WARN-level log message is now issued for any
non-static @Bean method with a return type assignable to BFPP.  This
serves as a strong recommendation to users that they always mark BFPP
@Bean methods as static.

See @Bean Javadoc for complete details.

Issue: SPR-8257, SPR-8269
2011-05-10 11:55:41 +00:00
Chris Beams 859185d086 Test interaction of @ComponentScan and @Import 2011-05-10 11:54:37 +00:00
Chris Beams d0c31ad84c Allow recursive use of @ComponentScan
Prior to this change, @ComponentScan annotations were only processed at
the first level of depth.  Now, the set of bean definitions resulting
from each declaration of @ComponentScan is checked for configuration
classes that declare @ComponentScan, and recursion is performed as
necessary.

Cycles between @ComponentScan declarations are detected as well. See
CircularComponentScanException.

Issue: SPR-8307
2011-05-08 13:49:35 +00:00
Chris Beams c2b030a50d Polish @EnableScheduling Javadoc 2011-05-08 13:48:02 +00:00
Chris Beams 7e398f101c Rename AsyncConfigurer#get{+Async}Executor 2011-05-07 09:32:03 +00:00
Chris Beams 358cbf4301 Polish @EnableScheduling Javadoc 2011-05-07 09:31:13 +00:00
Chris Beams d9a89529f0 Introduce @EnableScheduling 2011-05-06 19:09:24 +00:00
Chris Beams de50789cb6 Introduce @EnableAsync
Introduce @EnableAsync#order

AsyncAnnotationBeanPostProcessor's 'order' property is now mutable;
@EnableAsync's 'order()' attribute allows for setting it, but must
have a default value, thus uses the new Ordered#NOT_ORDERED
constant - a reserved negative number very unlikely to be otherwise
used that may be interpreted as 'not ordered', useful in annotation
defaulting scenarios where null is not an option.

Introduce first working cut of AsyncConfiguration

Remove AsyncCapability
2011-05-06 19:08:53 +00:00
Chris Beams cf0fc278bb Introduce @Role
As a mechanism for setting the 'role' hint on BeanDefinitions created
via component-scanning or @Bean methods.
2011-05-06 19:08:10 +00:00
Chris Beams 7b999c676f Introduce ReflectionUtils#getUniqueDeclaredMethods
This change is in support of certain polymorphism cases in
@Configuration class inheritance hierarchies.  Consider the following
scenario:

@Configuration
public abstract class AbstractConfig {
    public abstract Object bean();
}

@Configuration
public class ConcreteConfig {
    @Override
    @Bean
    public BeanPostProcessor bean() { ... }
}

ConcreteConfig overrides AbstractConfig's #bean() method with a
covariant return type, in this case returning an object of type
BeanPostProcessor.  It is critically important that the container
is able to detect the return type of ConcreteConfig#bean() in order
to instantiate the BPP at the right point in the lifecycle.

Prior to this change, the container could not do this.
AbstractAutowireCapableBeanFactory#getTypeForFactoryMethod called
ReflectionUtils#getAllDeclaredMethods, which returned Method objects
for both the Object and BeanPostProcessor signatures of the #bean()
method.  This confused the implementation sufficiently as not to
choose a type for the factory method at all.  This means that the
BPP never gets detected as a BPP.

The new method being introduced here, #getUniqueDeclaredMethods, takes
covariant return types into account, and filters out duplicates,
favoring the most specific / narrow return type.

Additionally, it filters out any CGLIB 'rewritten' methods, which
is important in the case of @Configuration classes, which are
enhanced by CGLIB.  See the implementation for further details.
2011-05-06 19:07: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 9a271ce6c9 Introduce ImportSelector interface
Allows @Enable* a layer of indirection for deciding which @Configuration
class(es) to @Import.

The @Import annotation may now accept @Configuration class literals
and/or ImportSelector class literals.
2011-05-06 19:06:02 +00:00
Chris Beams cdb01cbd37 Introduce ImportAware interface
@Configuration classes may implement ImportAware in order to be injected
with the AnnotationMetadata of their @Import'ing class.

Includes the introduction of a new PriorityOrdered
ImportAwareBeanPostProcessor that handles injection of the
importing class metadata.
2011-05-06 19:05:42 +00:00
Chris Beams 89005a5b70 Process all meta and local @Import declarations
Includes the introduction of AnnotationUtils#findAllAnnotationAttributes
to support iterating through all annotations declared on a given type
and interrogating each for the presence of a meta-annotation. See tests
for details.
2011-05-06 19:05:15 +00:00
Chris Beams 856da7edb9 Provide dedicated @ComponentScan processing
@ComponentScan is now checked for explicitly and handled immediately
when parsing @Configuration classes.
2011-05-06 19:04:35 +00:00
Chris Beams cd4fb665d9 Delegate ComponentScanBDP environment to scanner
Enables @Profile filtering within ComponentScanBeanDefinitionParser
2011-05-06 19:04:11 +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 0a790c143f Rename ConfigurationClassMethod => BeanMethod 2011-05-06 19:01:56 +00:00
Chris Beams f683f781c5 Revert deprecation of BDRU#registerWithGeneratedName
The overloading necessary to preserve the new signature as well as
the old causes ambiguities leading to deprecation warnings in some
caller scenarios.
2011-05-06 19:01:35 +00:00
Chris Beams 84a63b6d4b Prevent empty calls to ACAC #register and #scan 2011-05-06 19:01:11 +00:00
Chris Beams d2faef44fa Add comment on DisposableBean use in @Configuration
Issue: SPR-7901
2011-05-06 19:00:55 +00:00
Chris Beams d3678caa37 Polish Javadoc 2011-05-06 19:00:38 +00:00
Chris Beams f30b7e3125 Fix generics and serialization warnings 2011-05-06 19:00:14 +00:00
Chris Beams c51c340881 Update MockEnvironment / MockPropertySource types
Reflecting signature changes in getProperty() methods
2011-05-06 18:57:41 +00:00
Costin Leau 5206f5bc9a SPR-8238
+ add NPE test
2011-04-21 08:07:12 +00:00
Costin Leau e1d19d6c24 SPR-8238
+ add handling for null arguments to prevent NPE in default key generation
2011-04-21 08:00:42 +00:00
Micha Kiener 8adb9a88d0 SPR-6416, adding basic conversation object tests, improving the access time of the conversation object 2011-04-12 19:51:50 +00:00
Micha Kiener 3244e0a644 SPR-6416, adding repository timeout setting tests 2011-04-12 18:11:18 +00:00
Micha Kiener 8098ced387 SPR-6416, adding conversation manager test 2011-04-12 16:02:46 +00:00
Micha Kiener 58b779355b SPR-6416, reshaping removal of hierarchical conversations and adding repository test 2011-04-12 14:53:09 +00:00
Micha Kiener f812cd748e SPR-6416, initial commit for the conversation management 2011-04-12 13:21:18 +00:00
Sam Brannen 070b7b6afe polishing 2011-04-04 22:05:49 +00:00
Chris Beams 74f1e0e9d0 Touch up ApplicationContextInitializer Javadoc 2011-04-04 14:57:51 +00:00