Commit Graph

4030 Commits

Author SHA1 Message Date
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 dea1fc933f revise cache API
+ update failing AJ test
2011-05-17 17:35:01 +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
Rossen Stoyanchev af1dfd3577 Use request attribute to check producible media types when writing to the response body 2011-05-17 13:02:48 +00:00
Arjen Poutsma 1bbdb0d2ff minor fix. 2011-05-17 12:22:21 +00:00
Arjen Poutsma b0a4be7cd1 Only respect RequestMappingInfos that have a pattern match in handleNoMatch 2011-05-17 10:07:36 +00:00
Arjen Poutsma ad2e0d4587 SPR-7353 - @ResponseBody and returned HttpEntity now respect @RequestMapping.produces() 2011-05-17 09:45:57 +00:00
Rossen Stoyanchev 57c757afc5 SPR-2692 Update mvc chapter with URI template support in redirect: view names 2011-05-16 13:24:42 +00:00
Oliver Gierke d14d82612d SPR-8336 - Fixed broken test case.
Converted the test to JUnit 4.
2011-05-14 06:44:51 +00:00
Oliver Gierke f8bf8742e1 SPR-8336 - Added constructor to AnnotationTypeFilter to allow matching interfaces as well.
Reviewed by Chris.
2011-05-14 06:22:44 +00:00
Rossen Stoyanchev 1784df8d3e SPR-6996 Add mvc:interceptor bean references 2011-05-13 18:06:55 +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
Rossen Stoyanchev 5c0e22e7a8 SPR-8289 Ensure BeanNameUrlHandlerMapping and default HandlerAdapters are never 'turned off' through the MVC namespaces 2011-05-13 15:46:37 +00:00
Costin Leau 4dd5ae16b2 SPR-8256
+ fix small doc typo
2011-05-13 15:40:12 +00:00
Costin Leau a986d758e7 SPR-
+ remove duplicate class
2011-05-13 15:37:10 +00:00
Arjen Poutsma bb2cc8457f SPR-7353 - Added equivalent of JAX-RS @Produces to Spring MVC 2011-05-13 09:43:45 +00:00
Chris Beams a557878a6f Document @Autowired and @Value limitations
@Autowired, @Value and other annotations cannot be applied within
Spring Bean(Factory)PostProcessor types, because they themselves
are processed using BeanPostProcessors.  Javadoc and reference docs
have been updated to reflect.

Issue: SPR-4935, SPR-8213
2011-05-13 03:41:29 +00:00
Chris Beams df5bab3454 Remove "@BeanAge" from reference documentation
Issue: SPR-8327
2011-05-13 03:40:26 +00:00
Andy Clement f8a2dd3f65 SPR-8211: property accessor ordering correction and removal of unnecessary duplicates 2011-05-12 16:40:44 +00:00
Rossen Stoyanchev b46598965e Add method to allow further validation of request mapping infos at startup + other minor javadoc updates. 2011-05-12 15:03:36 +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
Arjen Poutsma 8190b4f70a Javadoc 2011-05-12 09:00:39 +00:00
Andy Clement 580f35f6ee SFW-8228 2011-05-11 23:41:30 +00:00
Andy Clement 2f733bedc5 SFW-8224: distance can be used when computing method matches in ReflectiveMethodResolver 2011-05-11 21:44:24 +00:00
Sam Brannen 5d8de5c449 polishing 2011-05-11 20:09:08 +00:00
Rossen Stoyanchev 726e920857 Rename EnableMvcConfiguration->EnableWebMvc, refine method names in WebMvcConfigurer, fix issue with MappedInterceptors 2011-05-11 18:02:07 +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 314a054a9b Introduce ResourcePropertySource
Allows convenient creation of a Properties-based PropertySource from a
Spring Resource object or resource location string such as
"classpath:com/myco/app.properties" or "file:/path/to/file.properties"

Issue: SPR-8328
2011-05-11 13:28:05 +00:00
Arjen Poutsma 9b0c66dc6c Make HTTP methods a RequestCondition 2011-05-11 10:38:30 +00:00
Chris Beams 80f0eabbd9 Add MockEnvironment to .integration-tests 2011-05-11 07:51:32 +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 3622c6f340 Pull up default getProperty variants to base class
Issue: SPR-8322
2011-05-11 07:35:16 +00:00
Chris Beams dc2d5c107f Add default-value getProperty convenience variants
Issue: SPR-8322
2011-05-11 06:09:06 +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
Arjen Poutsma 71aae405d5 SPR-7354 - Added equivalent of JAX-RS @Consumes to Spring MVC 2011-05-10 09:23:00 +00:00
Costin Leau 7f247a6b27 SPR-8256
+ doc updates
2011-05-09 17:40:23 +00:00
Arjen Poutsma b058d1e07a Made comparators public, as they are needed elsewhere. 2011-05-09 11:20:49 +00:00
Rossen Stoyanchev 8d0ab1d2e5 Refine HandlerMethod registration to allow detection by handler instance as well as by bean name 2011-05-08 19:31:29 +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