Commit Graph

3972 Commits

Author SHA1 Message Date
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
17892a8ab2 Introduce Ordered#NOT_ORDERED
To provide a reasonable default value for annotations that expose
int-returning #order attributes.
2011-05-06 19:07:41 +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
6d84f06d8c Remove unused MethodMetadata#getMethodReturnType
Introduced to support checking return types on @Bean methods but never
actually used.  May be reintroduced as necessary in the future.
2011-05-06 18:59:26 +00:00
Chris Beams
4b5208faad Introduce PropertyResolver#getPropertyAsClass 2011-05-06 18:59:05 +00:00
Chris Beams
275d43dfde Rename Property{SourcesProperty}ResolverTests 2011-05-06 18:58:41 +00:00
Chris Beams
c51c340881 Update MockEnvironment / MockPropertySource types
Reflecting signature changes in getProperty() methods
2011-05-06 18:57:41 +00:00
Sam Brannen
3e2cc7dd19 polishing 2011-05-06 15:35:40 +00:00
Sam Brannen
ddc9bbb555 [SPR-6184] Simplifying ContextLoader implmementation:
- Removed AbstractGenericContextLoader's createGenericApplicationContext() method.
- AnnotationConfigContextLoader now uses an AnnotatedBeanDefinitionReader instead of working with an AnnotationConfigApplicationContext.
- AnnotationConfigContextLoader now uses the supplied GenericApplicationContext to load configuration classes.
2011-05-06 12:05:56 +00:00
Rossen Stoyanchev
c91ab1ad6e Resolve custom args after annotated args, set PATH_WITHIN_HANDLER_MAPPING attribute, and rename resolver for @ExceptionHandler methods 2011-05-03 15:39:13 +00:00
Rossen Stoyanchev
50117dce40 SPR-6909 Include URI template vars in data binding 2011-04-26 11:54:54 +00:00
Chris Beams
5c27a04210 Automatically close SessionFactory objects
SessionFactory objects created by
SessionFactoryBuilderSupport#buildSessionFactory are now DisposableBean
proxies that call SessionFactory#close and release any threadlocal
DataSource object.

This is the same behavior that has always occurred during LSFBean and
ASFBean destruction lifecycles (and still does). This destruction logic
has now been factored out into
SessionFactoryBuilderSupport#closeHibernateSessionFactory such that all
SFB types can reuse it easily.

Note that LSFBean and ASFBean are subclasses, respectively, of SFBuilder
and ASFBuilder and they each must disable the DisposableBean proxying in
order to avoid duplicate attempts at closing the SessionFactory. See
the implementations of wrapSessionFactoryIfNeccesary() for details.

Issue: SPR-8114
2011-04-26 10:15:30 +00:00
Chris Beams
88e2277bff Fix typo in aop reference documentation
Issue: SPR-8268
2011-04-26 07:44:40 +00:00
Rossen Stoyanchev
ed9d9a402b SPR-7543 Add @PathVariables to the model 2011-04-21 15:18:45 +00:00
Arjen Poutsma
a4716c2a94 Buffering RequestFactory that allows for multiple response body reads. 2011-04-21 15:09:44 +00:00
Rossen Stoyanchev
945cf43e2d Remove consumes from @RequestMapping 2011-04-21 14:54:55 +00:00
Rossen Stoyanchev
acb9433e5c SPR-8247 review changes 2011-04-21 11:40:24 +00:00
Arjen Poutsma
ab654a7a06 added toString to HttpEntity 2011-04-21 11:39:20 +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
Rossen Stoyanchev
d14c7f2d09 SPR-8247 2011-04-20 21:41:17 +00:00
Rossen Stoyanchev
57d327d1ff SPR-8255 2011-04-20 08:43:57 +00:00
Rossen Stoyanchev
9c65973b33 SPR-8214 review unit tests 2011-04-15 18:42:58 +00:00
Rossen Stoyanchev
83ce399c47 SPR-8248 2011-04-15 06:42:18 +00:00
Thomas Risberg
f5f738f2b4 SPR-6922 deprecated SimpleJdbcTemplate/SimpleJdbcOperations/SimpleJdbcDaoSupport in favor of JdbcTemplate/NamedParameterJdbcTemplate and related interfaces support classes 2011-04-14 18:44:40 +00:00
Rossen Stoyanchev
aa065e8310 SPR-8214 Javadoc and polish 2011-04-13 23:15:19 +00:00
Sam Brannen
62d40dc7aa Added Apache Commons HTTP JARs to the Eclipse classpath. 2011-04-12 21:58:38 +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
Rossen Stoyanchev
6e03b4dd64 SWF-8214 javadoc updates 2011-04-12 13:23:14 +00:00
Micha Kiener
f812cd748e SPR-6416, initial commit for the conversation management 2011-04-12 13:21:18 +00:00
Rossen Stoyanchev
0c736776da SPR-8094 2011-04-12 10:46:57 +00:00
Arjen Poutsma
3690002dce SPR-6180 - Upgrade Apache HttpClient to version 4.0 2011-04-12 07:55:38 +00:00
Rossen Stoyanchev
5486649394 Add UriTemplateServletHandlerMethodTests 2011-04-11 17:18:07 +00:00
Rossen Stoyanchev
767513de4e Add UriTemplateServletHandlerMethodTests 2011-04-11 17:17:51 +00:00