Commit Graph

1005 Commits

Author SHA1 Message Date
Chris Beams c84c97d572 Preserve DefaultContextLoadTimeWeaver no-arg ctor
Issue: SPR-8317

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4475 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-06 13:15:10 +00:00
Chris Beams a50e4a24a9 Introduce @EnableLoadTimeWeaving
Issue: SPR-8317

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4472 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-06 08:31:18 +00:00
Mark Fisher ac176da515 SPR-8205 added support for a 'trigger' attribute (bean ref) on scheduled-task elements
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4441 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-03 18:54:21 +00:00
Sam Brannen c5cdb5602e Increased timeout in calls to assertStopWatchTimeLimit() to increase stability of the build.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4439 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-03 15:44:08 +00:00
Oliver Gierke 67ffadd1f4 SPR-7477 - Added lazy-init attribute to jee namespace
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4431 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-03 08:51:56 +00:00
Sam Brannen 6fee394ac0 [SPR-8393] AnnotatedBeanDefinitionReader's constructor now inherits the Environment of supplied BeanDefinitionRegistry.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4419 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-02 17:33:12 +00:00
Chris Beams 292916c66c Mention code alternatives in context and mvc XSDs
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4415 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-02 14:45:00 +00:00
Chris Beams de347353c6 Polish @Primary Javadoc
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4414 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-02 14:44:26 +00:00
Chris Beams c5d7dcf418 Polish @EnableScheduling Javadoc and related XSD
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4413 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-02 14:43:59 +00:00
Chris Beams c3822bd26d Polish @EnableAsync Javadoc and related XSD
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4412 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-02 14:42:26 +00:00
Costin Leau 11b4525f5a 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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4407 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-02 10:01:14 +00:00
Sam Brannen f4801fa988 [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".
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4398 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-01 14:12:03 +00:00
Chris Beams fe50d070f9 Polish AdviceMode Javadoc
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4389 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-31 06:41:35 +00:00
Chris Beams c7a7618400 Improve ApplicationContextInitializer sorting
ContextLoader and FrameworkServlet now use
AnnotationAwareOrderComparator to support @Order usage; previously
supported only implementation of the Ordered interface.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4381 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-30 12:55:33 +00:00
Juergen Hoeller 2e4df1d98e RemoteExporter uses an opaque proxy for 'serviceInterface' exposure (no AOP interfaces exposed)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4370 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-29 20:52:37 +00:00
Chris Beams 5049cd0db3 Allow multiple locations via @PropertySource#value
Issue: SPR-8314

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4364 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-25 10:52:25 +00:00
Chris Beams 2a896753d4 Polish PropertySource and Environment Javadoc
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4363 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-25 10:52:03 +00:00
Keith Donald 115348b6be added null binding check for primitives for all conversion results; polishing
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4358 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-24 17:53:18 +00:00
Chris Beams c0b7d175e9 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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4353 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-23 10:04:00 +00:00
Chris Beams f82aabb6c3 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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4352 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-23 10:03:23 +00:00
Chris Beams 1b34c00884 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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4350 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-23 10:02:18 +00:00
Chris Beams 027e431bbd 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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4343 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-21 01:20:33 +00:00
Chris Beams 73eb53f002 Polish @Configuration-related Javadoc
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4341 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-21 01:19:25 +00:00
Chris Beams 2b6bcf470c Rename {DefaultWeb=>StandardServlet}Environment
Issue: SPR-8348

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4338 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-20 03:55:56 +00:00
Chris Beams cf19ecc5a7 Rename {Default=>Standard}Environment
Issue: SPR-8348

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4337 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-20 03:53:37 +00:00
Costin Leau 7a91725ba6 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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4326 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-18 18:34:41 +00:00
Costin Leau 903928e504 revised cache abstraction
- removed AbstractDelegatingCache (a cache is not a map, no need to offer a template)
+ renamed ConcurrentCache to ConcurrentCacheMap

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4325 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-18 17:43:13 +00:00
Chris Beams 692245b0bc 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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4322 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-18 08:53:46 +00:00
Chris Beams 2c75acba5a Remove ConfigurationClassParser from public API
Issue: SPR-8200

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4321 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-17 19:15:17 +00:00
Costin Leau 669c99e823 revise cache API
+ update failing test

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4320 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-17 18:16:07 +00:00
Costin Leau 8992fd80c0 revise cache API
+ update failing test

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4319 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-17 18:01:35 +00:00
Costin Leau e4ed1f1530 revise cache API
+ update failing test

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4317 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-17 17:09:49 +00:00
Costin Leau 328fdc5c04 revise cache API
+ add missing files (remember to check "show unversioned files")

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4316 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-17 16:58:15 +00:00
Costin Leau b22e4dc15a revise cache API
- eliminate unneeded methods
+ introduced value wrapper (name still to be decided) to avoid cache race conditions
+ improved name consistency

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4315 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-17 16:50:00 +00:00
Costin Leau 8fb6790f7d SPR-8334
+ commit missing configs

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4306 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-13 16:09:33 +00:00
Costin Leau b6b8e8ecdc SPR-8334
+ commit missing configs

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4305 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-13 15:59:22 +00:00
Costin Leau f1eaefb4fd SPR-
+ remove duplicate class

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4302 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-13 15:37:10 +00:00
Chris Beams 26a0e223a4 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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4296 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-12 12:28:13 +00:00
Chris Beams 2b0b4a58cb 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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4295 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-12 12:27:14 +00:00
Chris Beams b05cef9574 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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4289 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-11 13:28:33 +00:00
Chris Beams 3f7d5120c9 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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4285 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-11 07:36:04 +00:00
Chris Beams 653773574e Polish @Configuration Javadoc
Add note that nested @Configuration classes must be static.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4282 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-11 06:08:40 +00:00
Chris Beams 4c746017c5 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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4281 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-10 11:55:41 +00:00
Chris Beams ae0dc34f29 Test interaction of @ComponentScan and @Import
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4280 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-10 11:54:37 +00:00
Chris Beams 11c31085fe 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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4275 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-08 13:49:35 +00:00
Chris Beams b5d18feb55 Polish @EnableScheduling Javadoc
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4274 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-08 13:48:02 +00:00
Chris Beams 4f38c21f76 Rename AsyncConfigurer#get{+Async}Executor
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4273 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-07 09:32:03 +00:00
Chris Beams f0b8bbc04b Polish @EnableScheduling Javadoc
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4272 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-07 09:31:13 +00:00
Chris Beams fb059b3491 Introduce @EnableScheduling
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4266 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-06 19:09:24 +00:00
Chris Beams f8d97b009d 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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4265 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-06 19:08:53 +00:00