Commit Graph

4195 Commits

Author SHA1 Message Date
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
Chris Beams 74cd20abeb Polish Environment-related Javadoc
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4336 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-20 03:50:41 +00:00
Chris Beams 3fcb25c1c6 Introduce AbstractEnvironment#customizePropertySources
This new hook in the AbstractEnvironment lifecycle allows for more
explicit and predictable customization of property sources by
subclasses.  See Javadoc and existing implementations for detail.

Issue: SPR-8354

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4335 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-20 03:50:14 +00:00
Chris Beams ebea9ec66c Introduce reserved default profile support
AbstractEnvironment and subclasses now register a reserved default
profile named literally 'default' such that with no action on the part
of the user, beans defined against the 'default' profile will be
registered - if no other profiles are explicitly activated.

For example, given the following three files a.xml, b.xml and c.xml:

    a.xml
    -----
    <beans> <!-- no 'profile' attribute -->
        <bean id="a" class="com.acme.A"/>
    </beans>

    b.xml
    -----
    <beans profile="default">
        <bean id="b" class="com.acme.B"/>
    </beans>

    c.xml
    -----
    <beans profile="custom">
        <bean id="c" class="com.acme.C"/>
    </beans>

bootstrapping all of the files in a Spring ApplicationContext as
follows will result in beans 'a' and 'b', but not 'c' being registered:

    ApplicationContext ctx = new GenericXmlApplicationContext();
    ctx.load("a.xml");
    ctx.load("b.xml");
    ctx.load("c.xml");
    ctx.refresh();
    ctx.containsBean("a"); // true
    ctx.containsBean("b"); // true
    ctx.containsBean("c"); // false

whereas activating the 'custom' profile will result in beans 'a' and
'c', but not 'b' being registered:

    ApplicationContext ctx = new GenericXmlApplicationContext();
    ctx.load("a.xml");
    ctx.load("b.xml");
    ctx.load("c.xml");
    ctx.getEnvironment().setActiveProfiles("custom");
    ctx.refresh();
    ctx.containsBean("a"); // true
    ctx.containsBean("b"); // false
    ctx.containsBean("c"); // true

that is, once the 'custom' profile is activated, beans defined against
the the reserved default profile are no longer registered. Beans not
defined against any profile ('a') are always registered regardless of
which profiles are active, and of course beans registered
against specific active profiles ('c') are registered.

The reserved default profile is, in practice, just another 'default
profile', as might be added through calling env.setDefaultProfiles() or
via the 'spring.profiles.default' property.  The only difference is that
the reserved default is added automatically by AbstractEnvironment
implementations.  As such, any call to setDefaultProfiles() or value set
for the 'spring.profiles.default' will override the reserved default
profile.  If a user wishes to add their own default profile while
keeping the reserved default profile as well, it will need to be
explicitly redeclared, e.g.:

    env.addDefaultProfiles("my-default-profile", "default")

The reserved default profile(s) are determined by the value returned
from AbstractEnvironment#getReservedDefaultProfiles().  This protected
method may be overridden by subclasses in order to customize the
set of reserved default profiles.

Issue: SPR-8203

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4334 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-20 03:49:15 +00:00
Chris Beams cd38a828d2 Remove AbstractEnvironment#getPropertyResolver
Method is obsolete now that Environment (thus AbstractEnvironment as
well) implements the ConfigurablePropertyResolver interface.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4333 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-20 03:48:19 +00:00
Chris Beams 71d713b604 Consolidate Environment tests
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4332 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-20 03:47:48 +00:00
Rossen Stoyanchev f30ae5abc8 SPR-8352 Init and apply MappedInterceptors from AbstractHandlerMapping
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4331 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-19 16:45:25 +00:00
Arjen Poutsma bd4a08df62 SPR-8296 - Extension for CastorMarshaller - additional unmarshaller properties
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4330 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-19 14:01:35 +00:00
Arjen Poutsma 84f00122b6 SPR-8295 - Extension for CastorMarshaller - additional marshaller properties
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4329 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-19 13:34:36 +00:00
Rossen Stoyanchev 408be8082a SPR-8350 ContentNegotiatingViewResolver initialization for nested ViewResolvers
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4328 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-19 13:07:15 +00:00
Rossen Stoyanchev 6e86bc5bc2 SPR-7353 Doc update for consumes/produces + changelog update
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4327 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-19 13:05:53 +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
Arjen Poutsma 66e1c8c743 @RequestMapping.consumes() and produces() now default to an empty array, instead of */*
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4324 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-18 11:34:47 +00:00
Arjen Poutsma 99e7650b53 Exposing HttpServletRequest/Response in ServletServerHttpRequest/Response
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4323 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-18 11:24:57 +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 86a499b786 revise cache API
+ update failing AJ test

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4318 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-17 17:35:01 +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
Rossen Stoyanchev 76abf77077 Use request attribute to check producible media types when writing to the response body
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4314 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-17 13:02:48 +00:00
Arjen Poutsma 22f2c2bde0 minor fix.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4313 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-17 12:22:21 +00:00
Arjen Poutsma 4cebd2ef0b Only respect RequestMappingInfos that have a pattern match in handleNoMatch
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4312 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-17 10:07:36 +00:00
Arjen Poutsma 7b6c98ac9b SPR-7353 - @ResponseBody and returned HttpEntity now respect @RequestMapping.produces()
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4311 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-17 09:45:57 +00:00
Rossen Stoyanchev 89b5be3754 SPR-2692 Update mvc chapter with URI template support in redirect: view names
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4310 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-16 13:24:42 +00:00
Oliver Gierke 11383f27fb SPR-8336 - Fixed broken test case.
Converted the test to JUnit 4.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4309 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-14 06:44:51 +00:00
Oliver Gierke 6f41d8c68d SPR-8336 - Added constructor to AnnotationTypeFilter to allow matching interfaces as well.
Reviewed by Chris.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4308 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-14 06:22:44 +00:00
Rossen Stoyanchev f4bfd5766a SPR-6996 Add mvc:interceptor bean references
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4307 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-13 18:06:55 +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
Rossen Stoyanchev 461c3dd1a6 SPR-8289 Ensure BeanNameUrlHandlerMapping and default HandlerAdapters are never 'turned off' through the MVC namespaces
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4304 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-13 15:46:37 +00:00
Costin Leau 90a0504c5c SPR-8256
+ fix small doc typo

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4303 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-13 15:40:12 +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
Arjen Poutsma 3f9a857d4c SPR-7353 - Added equivalent of JAX-RS @Produces to Spring MVC
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4301 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-13 09:43:45 +00:00
Chris Beams 31bc941b28 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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4300 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-13 03:41:29 +00:00
Chris Beams 4e1de28861 Remove "@BeanAge" from reference documentation
Issue: SPR-8327

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4299 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-13 03:40:26 +00:00
Andy Clement 2a04e8c444 SPR-8211: property accessor ordering correction and removal of unnecessary duplicates
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4298 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-12 16:40:44 +00:00
Rossen Stoyanchev 416c282609 Add method to allow further validation of request mapping infos at startup + other minor javadoc updates.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4297 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-12 15:03:36 +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
Arjen Poutsma 6d06f137cf Javadoc
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4294 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-12 09:00:39 +00:00
Andy Clement 96160448ac SFW-8228
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4293 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-11 23:41:30 +00:00
Andy Clement c399e1e033 SFW-8224: distance can be used when computing method matches in ReflectiveMethodResolver
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4292 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-11 21:44:24 +00:00
Sam Brannen 9ce25bc5e4 polishing
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4291 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-11 20:09:08 +00:00
Rossen Stoyanchev 4e0594afaf Rename EnableMvcConfiguration->EnableWebMvc, refine method names in WebMvcConfigurer, fix issue with MappedInterceptors
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4290 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-11 18:02:07 +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 f9783127e9 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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4288 50f2f4bb-b051-0410-bef5-90022cba6387
2011-05-11 13:28:05 +00:00