Commit Graph

4839 Commits

Author SHA1 Message Date
Juergen Hoeller d6d169ac56 resolved package dependency tangles 2011-11-29 01:16:09 +00:00
Juergen Hoeller 686ae8f7b3 final preparations for 3.1 RC2 release 2011-11-28 22:57:33 +00:00
Juergen Hoeller 9f3e333084 fixed NotificationListenerBean assertion in constructor (SPR-8091) 2011-11-28 22:47:48 +00:00
Juergen Hoeller c2eafdb2fb AbstractCachingViewResolver caches unresolved view names by default ("cacheUnresolved"=true; SPR-8173) 2011-11-28 22:46:53 +00:00
Juergen Hoeller 1bb6d29be2 AbstractCachingViewResolver caches unresolved view names by default ("cacheUnresolved"=true; SPR-8173) 2011-11-28 22:34:29 +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 450c75337f fixed getAsText javadoc (SPR-7890) 2011-11-28 21:14:40 +00:00
Juergen Hoeller fa9a7b18c6 refined Resource "exists()" check for HTTP URLs to always return false for 404 status (SPR-7881) 2011-11-28 21:11:57 +00:00
Juergen Hoeller 2cb287a01b JPA EntityManagerFactoryUtils silently ignores IllegalArgumentExceptions from setHint calls (SPR-7947) 2011-11-28 20:54:37 +00:00
Juergen Hoeller e6272312a8 allow "packagesToScan" to be optional on LocalSessionFactoryBean (SPR-8812) 2011-11-28 20:48:21 +00:00
Juergen Hoeller b391629de1 LinkedCaseInsensitiveMap overrides putAll method as well (for IBM JDK 1.6 compatibility; SPR-7969) 2011-11-28 20:48:02 +00:00
Juergen Hoeller e7d1b5e0ee JDO PersistenceManager synchronization performs close attempt after completion (if necessary; SPR-8846) 2011-11-28 19:38:28 +00:00
Juergen Hoeller c9b36fb4e6 TransactionSynchronizationManager eagerly cleans up void ResourceHolders on any access (SPR-8844, SPR-8845) 2011-11-28 18:54:11 +00:00
Rossen Stoyanchev a9a068e678 SPR-8867 Fix issue with Content-Length header and UTF-8 charset.
The AbstractHttpMessageConverter was using the requested Content-Type
rather than the actual response Content-Type to determine the length
of the content. This can lead to a problem when a controller returns
a ResponseEntity with a Content-Type header that ignores (overrides)
the requested Content-Type. The fix ensures that actual response 
Content-Type is the one used both to write to the response and to 
determine the length of the content.
2011-11-28 18:42:57 +00:00
Juergen Hoeller aa7fcb5431 polishing 2011-11-28 18:38:26 +00:00
Juergen Hoeller 81e9f6cc2c fixed setRootObject check in StandardEvaluationContext (SPR-8241) 2011-11-28 17:34:47 +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 b55040cf02 Servlet/PortletContextResource's getFile prefers "file:" URL resolution over calling getRealPath (SPR-8461) 2011-11-28 16:51:42 +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 61a5ab9d34 fixed "formMultiSelect"/"formCheckboxes" FreeMarker macros to compare against actual field value (SPR-7721) 2011-11-28 14:42:03 +00:00
Juergen Hoeller 3f7dccddd2 added getObjectMapper() accessor to MappingJacksonHttpMessageConverter (SPR-8605) 2011-11-28 14:34:59 +00:00
Costin Leau ac52433004 + update cache docs 2011-11-28 14:00:26 +00:00
Juergen Hoeller 263dd559b7 SimpleJdbcTestUtils executeSqlScript properly closes its LineNumberReader after use (SPR-8872) 2011-11-28 13:27:21 +00:00
Costin Leau d10f2258e8 + update aspectj cache aspects
+ update integration tests
2011-11-28 13:05:59 +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
Costin Leau b2bc7534c2 + minor doc fix 2011-11-28 10:28:14 +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 4318ccd9d5 Refactor BeanConfigurerTests
In preparation for the introduction of @EnableSpringConfigured

Issue: SPR-7888
2011-11-28 06:57:09 +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
Sam Brannen e90c7eadc2 [SPR-7996] Improved documentation of the context caching mechanism in the TestContext framework:
- now discussing cache key generation and uniqueness
- now discussing cache scope, test suites, and forking
2011-11-28 00:45:24 +00:00
Juergen Hoeller 93db3df35b added "namingStrategy" property to Hibernate 4 LocalSessionFactoryBean variant (SPR-8864) 2011-11-28 00:04:55 +00:00
Juergen Hoeller f50f3d2405 HibernateJpaDialect does NOT expose underlying Session for underlying SessionFactory anymore (SPR-8771) 2011-11-27 23:50:37 +00:00
Juergen Hoeller 16933a511d introduced JobDetail/CronTrigger/SimpleTriggerFactoryBean variants for Quartz 2.0/2.1 support (SPR-8275?) 2011-11-27 23:32:03 +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 c6a0f1ef25 Polish logging for core.env package 2011-11-26 05:20:32 +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 143db0d8de Introduce SystemEnvironmentPropertySource
Properties such as 'spring.profiles.active' cannot be specified at the
command line under Bash and other shells due to variable naming
constraints. This change allows for exchanging underscores for periods
as well as capitalizing property names for more idiomatic naming when
dealing with environment variables.

For example, Spring will respect equally either of the following:

    spring.profiles.active=p1 java -classpath ... MyApp

    SPRING_PROFILES_ACTIVE=p1 java -classpath ... MyApp

The former is not possible under Bash, while the latter is. No code or
configuration changes are required; SystemEnvironmentPropertySource
adapts for these varations automatically.

SystemEnvironmentPropertySource is added by default as
"systemEnvironment" to StandardEnvironment and all subtypes, taking the
place of the plain MapPropertySource that was in use before this change.

Issue: SPR-8869
2011-11-26 05:20:25 +00:00
Chris Beams 2c26a23c46 Rename EnvironmentTests => StandardEnvironmentTests 2011-11-26 05:20:20 +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
Costin Leau 3416a26136 + add docs
+ rename cache:definitions to cache:caching (to be consistent with annotations)
2011-11-25 19:40:05 +00:00
Chris Beams 549c663fba Fix generics warnings in AbstractBeanFactory 2011-11-24 21:40:02 +00:00
Chris Beams 0113ea91a3 Support by-type lookup/injection of primitive types
Allowing beans of primitive type to be looked up via getBean(Class), or
to be injected using @Autowired or @Injected or @Resource. Prior to
these changes, an attempt to lookup or inject a bean of, for example,
type boolean would fail because all spring beans are Objects, regardless
of initial type due to the way that ObjectFactory works.

Now these attempts to lookup or inject primitive types work, thanks to
simple changes in AbstractBeanFactory using ClassUtils#isAssignable
methods instead of the built-in Class#isAssignableFrom. The former takes
into account primitives and their object wrapper types, whereas the
latter does not.

The need to declare, look up or inject primitive-typed beans is probably
low -- how often does one need a bean of type boolean or int after all?.
Prior to the introduction of @Bean methods in Spring 3.0, it was not
possible in practice to register primitive beans, so this issue never
came up. Now that one can declare primitive-typed beans, it does make
sense that we properly support by-type lookup and injection without
forcing the user to work with object wrappers.

Issue: SPR-8874
2011-11-24 21:39:58 +00:00
Rossen Stoyanchev ca3d774f5c Add detectHandlerMethodsInAncestorContexts property to AbstractHandlerMethodMapping. 2011-11-23 18:59:08 +00:00
Rossen Stoyanchev b5bcfa0ae3 SPR-8858 Fix in AntPathMatcher.combine(..)
Currently the combine method consolidates "/*" and "/hotel" 
into "/hotel". However if the first pattern contains URI template 
variables, the consolidation seems wrong. The fix is to prevent
the consolidation if the first pattern contains "{".
2011-11-23 17:53:18 +00:00