Commit Graph

1174 Commits

Author SHA1 Message Date
Juergen Hoeller 86bef9030f correctly handle ParseException from Formatter for String->String case (SPR-8944) 2011-12-22 15:54:17 +01:00
Costin Leau 0053319c62 Add test to corner potential bug with @CacheEvict
Cannot yet actually reproduce the issue, but this remains a useful
test case.

Issue: SPR-8934
2011-12-22 15:07:59 +01:00
Costin Leau c39a14a130 Parse cache:annotation-driven key-generator attribute
Prior to this change, the spring-cache XSD allowed a 'key-generator'
attribute, but it was not actually parsed by AnnotationDrivenCacheBDP.

This commit adds the parsing logic as originally intended and the test
to prove it.

Issue: SPR-8939
2011-12-22 14:50:45 +01:00
Costin Leau e9ab1a7abb Update cache ref docs re 'args' vs 'params' naming
Prior to this change, the caching reference docs referred to
'root.params', whereas the actual naming should be 'root.args'. This
naming was also reflected in the "#p" syntax for specifying method args.

This change updates the documentation to refer to 'root.args' properly
and also adds "#a" syntax for specifying method arguments more
intuitively. Note that "#p" syntax remains in place as an alias for
backward compatibility.

Issue: SPR-8938
2011-12-22 14:31:21 +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
Juergen Hoeller e0252ad0b1 "file-encoding" attribute value is being applied correctly (SPR-8024) 2011-12-22 13:31:08 +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
Chris Beams 2065b788c4 Re-introduce system-properties-mode to spring-context 3.1 XSD
See JIRA issue for complete details.

Issue: SPR-8901
2011-12-12 19:20:53 +00:00
Juergen Hoeller 0042243a11 SmartLifecycle beans in Lifecycle dependency graphs are only being started when isAutoStartup=true (SPR-8912) 2011-12-12 18:33:29 +00:00
Chris Beams d4123d0637 Support use of @Scheduled against JDK proxies
Prior to this change, ScheduledAnnotationBeanPostProcessor found any
@Scheduled methods against the ultimate targetClass for a given bean
and then attempted to invoke that method against the bean instance. In
cases where the bean instance was in fact a JDK proxy, this attempt
would fail because the proxy is not an instance of the target class.

Now SABPP still attempts to find @Scheduled methods against the target
class, but subsequently checks to see if the bean is a JDK proxy, and if
so attempts to find the corresponding method on the proxy itself. If it
cannot be found (e.g. the @Scheduled method was declared only at the
concrete class level), an appropriate exception is thrown, explaining to
the users their options: (a) use proxyTargetClass=true and go with
subclass proxies which won't have this problem, or (b) pull the
@Scheduled method up into an interface.

Issue: SPR-8651
2011-12-11 13:00:30 +00:00
Chris Beams 48836e2ebb Allow parameters in FactoryBean-returning @Bean methods
Prior to this change, an assumption was made in
AbstractAutowireCapableBeanFactory that any factory-method would have
zero parameters.  This may not be the case in @Bean methods.

We now look for the factory-method by name in a more flexible fashion
that accomodates the possibility of method parameters.

There remains at least one edge cases here where things could still fail,
for example a @Configuration class could have two FactoryBean-returning
methods of the same name, but each with different generic FactoryBean
types and different parameter lists. In this case, the implementation
may infer and return the wrong object type, as it currently returns
the first match for the given factory-method name.  The complexity cost
of ensuring that this never happens is not likely worth the trouble
given the very low likelihood of such an arrangement.

Issue: SPR-8762
2011-12-10 19:32:02 +00:00
Chris Beams 866999764d Polish whitespace in ConfigurationClassEnhancer 2011-12-10 19:31:18 +00:00
Chris Beams 0449f6cb84 Polish @Scope Javadoc 2011-12-10 19:30:32 +00:00
Chris Beams 34798a47ab Fix warnings, polish Javadoc for @Validated et al. 2011-12-10 15:45:17 +00:00
Juergen Hoeller e648245eb3 added MethodValidationInterceptor/PostProcessor for Hibernate Validator 4.2 based method validation; renamed Spring's variant of @Valid to @Validated 2011-12-09 18:09:14 +00:00
Juergen Hoeller 2dba480d9d used specific SLF4J versions for running the test suites of individual modules (fixing the Hibernate Validator 4.2 upgrade) 2011-12-09 17:53:29 +00:00
Chris Beams 615bb29f92 Revert .context to Hibernate Validator 4.1.0.GA
In order to determine why Ehcache classloading errors occur after
upgrading to 4.2.0.Final.

To demonstrate this error, uncomment the 4.2.0.Final dependency in
ivy.xml and run `ant test` within the .context module.
2011-12-09 13:09:25 +00:00
Chris Beams 1c58dd9d89 Upgrade to Hibernate Validator 4.2.0.Final
4.1/4.2 use is optional; users may compile and run against validator
versions back to 4.0.
2011-12-09 13:09:11 +00:00
Chris Beams a962bd0677 Revert accidental changes in Eclipse/pom metadata 2011-12-09 13:08:37 +00:00
David Syer 1adf82503b SPR-7404: Fixed metadata 2011-12-09 11:36:54 +00:00
David Syer 4242b32624 Update spring-context dependencies in pom 2011-12-09 11:36:35 +00:00
Chris Beams 690d33e14f Update @PropertySource Javadoc re: ${...} placeholders
Issue: SPR-8539
2011-12-08 13:46:27 +00:00
Juergen Hoeller 569426dfdf restored DataBinder's ability to bind to an auto-growing List with unknown element type (SPR-8828) 2011-12-07 21:27:26 +00:00
Costin Leau cb3524ff30 + fix failing cache tests
+ renamed afterInvocation to beforeInvocation (and changed the docs and tests accordingly)
2011-12-06 14:05:33 +00:00
Costin Leau 735ba9dcde SPR-8082
+ support generic discovery of multiple annotations of the same type (such as stereotypes)
2011-12-06 13:32:25 +00:00
Chris Beams 28ff473091 Allow multiple @Filter 'value' args for concision
Prior to this change, to specify two or more annotation include/exclude
filters, one would declare @ComponentScan as follows:

    @ComponentScan(basePackages="example.scannable",
       useDefaultFilters=false,
       includeFilters={
           @Filter(MyStereotype.class),
           @Filter(MyComponent.class)
       })

This was because @Filter's 'value' attribute accepted exactly one
argument.

Now, any given @Filter may accept one or more value arguments, allowing
for more concise @ComponentScan declarations:

    @ComponentScan(basePackages="example.scannable",
       useDefaultFilters=false,
       includeFilters=@Filter({MyStereotype.class, MyComponent.class}))

Supplying multiple arguments in this way assumes that they are the same
type of filter, e.g. ANNOTATION, ASSIGNABLE_TYPE, or CUSTOM. To declare
multiple *different* types of filters, multiple @Filter annotations are
still required, e.g.:

    @ComponentScan(
        includeFilters={
            @Filter(type=ANNOTATION, value=MyStereotype.class),
            @Filter(type=ASSIGNABLE_TYPE, value={Foo.class, Bar.class})
        })

Note that specifying zero arguments, e.g. @Filter({}) is nonsensical; it
will have no effect on component scanning, but does not raise an error.

Issue: SPR-8881
2011-12-06 12:18:10 +00:00
Chris Beams df7bda5637 Constrain targets for @Filter declaration
For clarity, add @Target({}) to definition of @Filter, constraining it
to complex annotation composition only; i.e. it cannot be placed on
any element, only within annotations, e.g.

    @ComponentScan(includeFilters=@Filter(...))

is legal, while

    @Filter
    public class MyType { }

is not.

Also, widen @Retention from SOURCE to RUNTIME, even though it is not
technically necessary, as all parsing of @Filter annotations happens via
ASM, i.e. at the source level.  This change is made primarily for
consistency (@ComponentScan's Retention is RUNTIME) and in avoidance of
potential confusion or surprise on the part of those casually browsing
the code.
2011-12-06 12:17:54 +00:00
Juergen Hoeller aedccec67e restored SpringValidatorAdapter's ability to handle bean constraints with property paths (SPR-8895) 2011-12-05 22:37:55 +00:00
Juergen Hoeller 207b2315ed added validation hints support to ValidationUtils as well (SPR-7847) 2011-12-03 15:54:52 +00:00
Juergen Hoeller 49a2aaf023 added SmartValidator interface with general support for validation hints; added custom @Valid annotation with support for JSR-303 validation groups; JSR-303 SpringValidatorAdapter and MVC data binding provide support for validation groups (SPR-6373) 2011-12-03 15:44:33 +00:00
Costin Leau 0a611aa776 SPR-8082
+ fix internal cache causing the multiple annotations key/conditions to overlap
2011-11-30 15:21:09 +00:00
Juergen Hoeller d6d169ac56 resolved package dependency tangles 2011-11-29 01:16:09 +00:00
Juergen Hoeller 9f3e333084 fixed NotificationListenerBean assertion in constructor (SPR-8091) 2011-11-28 22:47:48 +00:00
Chris Beams 6991cd9cdf Allow @Configuration classes to self-@ComponentScan
Prior to this change, a @Configuration classes that @ComponentScan
themselves would result in a ConflictingBeanDefinitionException.

For example:

    package com.foo.config;

    @Configuration
    @ComponentScan("com.foo");
    public class AppConfig {
        // ...
    }

This resulted in a ConflictingBeanDefinitionException that users have
typically worked around in the following fashion:

    package com.foo.config;

    @Configuration
    @ComponentScan(basePackages="com.foo",
        excludeFilters=@Filter(value=ANNOTATION_TYPE, type=Configuration.class);
    public class AppConfig {
        // ...
    }

This is obviously more verbose and cumbersome than would be desirable,
and furthermore potentially too constraining as it prohibits the ability
to include other legitimate @Configuration classes via scanning.

The exception was being thrown because of a logic problem in
ClassPathBeanDefinitionScanner.  The bean definition for AppConfig gets
registered once by the user (e.g. when constructing an
AnnotationConfigApplicationContext), then again when performing the
component scan for 'com.foo'. Prior to this change,
ClassPathBeanDefinitionScanner's #isCompatible returned false if the new
bean definition was anything other than an AnnotatedBeanDefinition.  The
intention of this check is really to see whether the new bean definition
is a *scanned* bean definition, i.e. the result of a component-scanning
operation.  If so, then it becomes safe to assume that the original bean
definition is the one that should be kept, as it is the one explicitly
registered by the user.

Therefore, the fix is as simple as narrowing the instanceof check from
AnnotatedBeanDefinition to its ScannedGenericBeanDefinition subtype.

Note that this commit partially reverts changes introduced in SPR-8307
that explicitly caught ConflictingBeanDefinitionExceptions when
processing recursive @ComponentScan definitions, and rethrew as a
"CircularComponentScanException.  With the changes in this commit,
such CBDEs will no longer occur, obviating the need for this check and
for this custom exception type altogether.

Issue: SPR-8808, SPR-8307
2011-11-28 21:35:38 +00:00
Juergen Hoeller 1843bdde35 added "forwarder" property to ConnectorServerFactoryBean, accepting an MBeanServerForwarder (SPR-8820) 2011-11-28 17:17:47 +00:00
Juergen Hoeller bba70a7f12 renamed ValueWrapperImpl to SimpleValueWrapper (for use in Cache implementations) 2011-11-28 15:52:42 +00:00
Juergen Hoeller 372d461bef upgraded compile-time dependency to EHCache 2.0.0 2011-11-28 15:10:03 +00:00
Juergen Hoeller a09a0316b7 exposed EHCache 1.7's "statisticsEnabled"/"sampledStatisticsEnabled" on EhCacheFactoryBean () 2011-11-28 15:05:53 +00:00
Juergen Hoeller 1e2f49104d SpringValidatorAdapter accepts non-indexed set paths (for Hibernate Validator compatibility; SPR-8634) 2011-11-28 12:54:03 +00:00
Costin Leau f91f778fb5 + align @CacheEvict behaviour with @Cacheable and @CachePut
+ add flag for post method execution
+ add integration tests
2011-11-28 12:06:34 +00:00
Chris Beams d35620511e Introduce @EnableSpringConfigured
Equivalent to <context:spring-configured/>.

Also update @EnableLoadTimeWeaving Javadoc and spring-configured XSD
documentation to reflect.

Issue: SPR-7888
2011-11-28 06:57:17 +00:00
Chris Beams 22e37aac44 Polish .aop copy of SpringConfiguredBDP
Add 'infrastructure' bean role to follow suit with original .context SCPDP

Encountered while working on SPR-7888 (@EnableSpringConfigured)
2011-11-28 06:57:04 +00:00
Chris Beams 68f61f3b3c Fix nested @Component annotation instantiation bug
3.1 M2 introduced a regression that causes false positives during
@Configuration class candidate checks. Now performing a call to
AnnotationMetadata#isInterface in addition to checks for @Component and
@Bean annotations when determining whether a candidate is a 'lite'
configuration class. Annotations are in the end interfaces, so both
are filtered out at once.

Issue: SPR-8761
2011-11-26 08:04:39 +00:00
Chris Beams faba5941f7 Provide ConfigurationClass#toString implementation
For ease during debugging; prompted while fixing SPR-8761.
2011-11-26 08:04:35 +00:00
Chris Beams 91f05c8b9d Avoid creation of unnecessary Environment objects
Prior to this change, any instantiation of an
AnnotationConfigApplicationContext would trigger the creation of three
StandardEnvironment objects: one for the ApplicationContext, one for the
AnnotatedBeanDefinitionReader, and one for the
ClassPathBeanDefinitionScanner.

The latter two are immediately swapped out when the ApplicationContext
delegates its environment to these subordinate objects anyway. Not only
is it inefficient to create these two extra Environments, it creates
confusion when debug-level logging is turned on. From the user's
perspective and in practice, there is only one Environment; logging
should reflect that.

This change ensures that only one Environment object is ever created for
a given ApplicationContext. If an AnnotatedBeanDefinitionReader or
ClassPathBeanDefinitionScanner are used in isolation, e.g. against a
plain BeanFactory/BeanDefinitionRegistry, then they will still create
their own local StandardEnvironment object.

All public API compatibility is preserved; new constructors have been
added where necessary to accommodate passing an Environment directly
to ABDR ar CPBDS.
2011-11-26 05:20:29 +00:00
Chris Beams a53d592f62 Use 'name' vs 'key' consistently in PropertySource 2011-11-26 05:20:17 +00:00
Chris Beams 03f6d23536 Reference @EnableCaching from spring-cache XSD 2011-11-26 05:20:08 +00:00
Chris Beams 333f9f31a7 Polish imports 2011-11-26 05:20:04 +00:00