Commit Graph
4377 Commits
Author SHA1 Message Date
Juergen Hoeller 344e8f93b2 extended Servlet API mocks for Servlet 3.0 forward compatibility as far as possible; made MockHttpServletResponse compatible with Servlet 3.0 getHeader(s) method returning Strings (SPR-8529); added getHeaderValue(s) method to MockHttpServletResponse for raw value access
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4705 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-15 14:51:01 +00:00
Juergen Hoeller 52a039b9a6 polishing
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4704 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-15 14:48:51 +00:00
Juergen Hoeller 4ba3f330d7 call setEnvironment before other awareness methods rather than after; fixed AccessControlContext applicability check
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4702 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-15 14:40:38 +00:00
Juergen Hoeller 9711a7121e extended Servlet API mocks for Servlet 3.0 forward compatibility as far as possible; made MockHttpServletResponse compatible with Servlet 3.0 getHeader(s) method returning Strings (SPR-8529); added getHeaderValue(s) method to MockHttpServletResponse for raw value access
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4701 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-15 14:16:31 +00:00
Costin Leau 254d8bd80f move default value wrapper into support package (rather then interceptor)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4700 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-15 14:13:22 +00:00
Chris Beams 6c6594137e Allow ConfigurationCPP to process multiple registries
Prior to this change, an instance of ConfigurationClassPostProcessor
would throw IllegalStateException if its
postProcessBeanDefinitionRegistry method were called more than once.
This check is important to ensure that @Configuration classes are
not proxied by CGLIB multiple times, and works for most normal use
cases.

However, if the same CCPP instance is used to process multiple
registries/factories/contexts, this check creates a false negative
because it does not distinguish between invocations of
postProcessBeanDefinitionRegistry across different registries.

A use case for this, though admittedly uncommon, would be creating
a CCPP instance and registering it via
ConfigurableApplicationContext#addBeanDefinitionPostProcessor against
several ApplicationContexts. In such a case, the same CCPP instance
will post-process multiple different registry instances, and throw the
above mentioned exception.

With this change, CCPP now performs lightweight tracking of the
registries/beanFactories that it has already processed by recording
the identity hashcodes of these objects.  This is only slightly more
complex than the previous boolean-based 'already processed' flags, and
prevents this issue (however rare it may be) from occurring.

Issue: SPR-8527

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4699 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-13 23:30:57 +00:00
Chris Beams 6c48c5e5d4 Move ImportSelector.Context to a top-level class
Issue: SPR-8411, SPR-8494

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4698 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-13 23:28:53 +00:00
Juergen Hoeller 0d2e99c4c1 revised package-level request and response classes
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4697 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-13 23:14:02 +00:00
Costin Leau 0640853200 + fix compilation error
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4693 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-13 13:51:20 +00:00
Costin Leau 7cd1791b20 + removed unneeded generic
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4692 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-13 12:58:09 +00:00
Chris Beams 33476d5fe8 Remove references to 'bold' text in reference docs
<emphasis role="bold"> blocks do not render properly, probably due to
conflicting CSS used for syntax highlighting. For the moment, any
mentions of bold text (e.g. "see bold text in the snippet below") have
been removed to avoid confusion as reported in SPR-8520.  SPR-8526 has
been created to address the underlying issue of getting bold to work
even with syntax highlighting.

Issue: SPR-8520, SPR-8526

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4691 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-11 18:29:37 +00:00
Juergen Hoeller 22651a9092 an EntityManagerFactoryBean is only deserializable through a SerializedEntityManagerFactoryBeanReference
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4689 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-11 13:50:34 +00:00
Juergen Hoeller d4c0048de7 prototype-based TargetSource is only deserializable through a SingletonTargetSource
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4687 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-11 13:37:49 +00:00
Chris Beams f99ab1cdd6 Fix APC registration for @EnableTransactionManagement
Prior to this change, @EnableTransactionManagement (via the
ProxyTransactionManagementConfiguration class) did not properly
register its auto-proxy creator through the usual AopConfigUtils
methods.  It was trying to register the APC as a normal @Bean method,
but this causes issues (SPR-8494) with the logic in
AopConfigUtils#registerOrEscalateApcAsRequired, which expects the APC
bean definition to have a beanClassName property.  When the APC is
registered via a @Bean definition, it is actually a
factoryBean/factoryMethod situation with no directly resolvable
beanClass/beanClassName.

To solve this problem, ImportSelector#selectImports has been refactored
to accept an ImportSelector.Context instance. This object contains the
AnnotationMetadata of the importing class as well as the enclosing
BeanDefinitionRegistry to allow for the kind of conditional bean
registration necessary here. In this case, the bean definition that
must be registered conditionally is that of the auto-proxy creator.
It should only be registered if AdviceMode == PROXY, and thus the
ImportSelector is an appropriate place to make this happen.  It must
happen as a BeanDefinition (rather than a @Bean method) for
compatibility with AopConfigUtils, and working with the
BeanDefinitionRegistry API allows for that. This change does mean that
in certain cases like this one, #selectImports has container modifying
side effects. Documentation has been updated to reflect.

Issue: SPR-8411, SPR-8494

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4686 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-11 01:17:19 +00:00
Chris Beams 638e5420a6 Revert "Fix APC registration for @EnableTransactionManagement"
@PostConstruct added to ProxyTransactionManagementConfiguration cases
ConcurrentModificationException (as detailed previously in SPR-8397.
Backing out for now until a better solution can be devised.

This reverts commit 235b729514.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4685 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-08 09:44:29 +00:00
Chris Beams 235b729514 Fix APC registration for @EnableTransactionManagement
Prior to this change, @EnableTransactionManagement (via the
ProxyTransactionManagementConfiguration class) did not properly
register its auto-proxy creator through the usual AopConfigUtils
methods.  It was trying to register the APC as a normal @Bean method,
but this causes issues (SPR-8494) with the logic in
AopConfigUtils#registerOrEscalateApcAsRequired, which expects the APC
bean definition to have a beanClassName property.  When the APC is
registered via a @Bean definition, it is actually a
factoryBean/factoryMethod situation with no directly resolvable
beanClass/beanClassName.

Rather than trying to rework how AopConfigUtils works, a @PostConstruct
method has been added to ProxyTransactionManagementConfiguration to call
the usual AopConfigUtils registration methods.

Issue: SPR-8411, SPR-8494

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4684 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-07 22:37:28 +00:00
Chris Beams 08ccd19c76 Implement SessionFactoryImplementor in SF proxies
SessionFactoryBuilderSupport implementations create DisposableBean
proxies for SessionFactory objects created using #buildSessionFactory.

Prior to this change, these proxies create problems when working agaist
SessionFactoryUtils.getDataSource(SessionFactory), because this method
expects the given SessionFactory to implement Hibernate's
SessionFactoryImplementor interface (which the stock SessionFactoryImpl
does).

With this change, the DisposableBean proxies created by SFBuilders
now also implement SessionFactoryImplementor to satisfy this and
probably other such cases.

Issue: SPR-8469

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4683 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-07 19:42:07 +00:00
Sam Brannen c3affadc55 [SPR-7858] polishing formatting, grammar, etc.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4682 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-07 11:55:00 +00:00
Chris Beams 7d9d255daf Determine FactoryBean object type via generics
For the particular use case detailed in SPR-8514, with this change we
now attempt to determine the object type of a FactoryBean through its
generic type parameter if possible.

For (a contrived) example:

@Configuration
public MyConfig {
    @Bean
    public FactoryBean<String> fb() {
        return new StringFactoryBean("foo");
    }
}

The implementation will now look at the <String> generic parameter
instead of attempting to instantiate the FactoryBean in order to call
its #getObjectType() method.

This is important in order to avoid the autowiring lifecycle issues
detailed in SPR-8514.  For example, prior to this change, the following
code would fail:

@Configuration
public MyConfig {
    @Autowired Foo foo;

    @Bean
    public FactoryBean<String> fb() {
        Assert.notNull(foo);
        return new StringFactoryBean("foo");
    }
}

The reason for this failure is that in order to perform autowiring,
the container must first determine the object type of all configured
FactoryBeans.  Clearly a chicken-and-egg issue, now fixed by this
change.

And lest this be thought of as an obscure bug, keep in mind the use case
of our own JPA support: in order to configure and return a
LocalContainerEntityManagerFactoryBean from a @Bean method, one will
need access to a DataSource, etc -- resources that are likely to
be @Autowired across @Configuration classes for modularity purposes.

Note that while the examples above feature methods with return
types dealing directly with the FactoryBean interface, of course
the implementation deals with subclasses/subinterfaces of FactoryBean
equally as well.  See ConfigurationWithFactoryBeanAndAutowiringTests
for complete examples.

There is at least a slight risk here, in that the signature of a
FactoryBean-returing @Bean method may advertise a generic type for the
FactoryBean less specific than the actual object returned (or than
advertised by #getObjectType for that matter). This could mean that an
autowiring target may be missed, that we end up with a kind of
autowiring 'false negative' where FactoryBeans are concerned. This is
probably a less common scenario than the need to work with an autowired
field within a FactoryBean-returning @Bean method, and also has a clear
workaround of making the generic return type more specific.

Issue: SPR-8514

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4681 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-06 09:15:37 +00:00
Chris Beams de5781acea Introduce GenericTypeResolver#resolveReturnTypeArgument
Issue: SPR-8514

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4680 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-06 09:15:32 +00:00
Chris Beams 075dfc3cb4 Deprecate/move CGLIB methods AopUtils=>ClassUtils
isCglibProxy* methods in AopUtils are useful in lower-level modules,
i.e. those that cannot depend on .aop.  Therefore copied these methods
to ClassUtils; deprecated the existing ones in AopUtils and now
delegating to the new location; switched all usage of
AopUtils#isCglibProxy* within the framework to use
ClassUtils#isCglibProxy* instead.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4679 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-06 09:15:27 +00:00
Chris Beams 0130b15189 Rename JMX tests to avoid jmxremote_optional error
Even after applying @Ignore to these tests at the class level, they
still run (and fail) under ant when the jmxremote_optional jar is not
present. See the issues mentioned below for information on how these
tests will be re-enabled.

Issue: SPR-8089, SPR-8093, SPR-8458

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4678 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-06 09:13:17 +00:00
Michael Isvy f16c72c3e1 SPR-7858
removed references to JSR 330  since there is now a dedicated JSR 330 section inside beans-standard-annotations.xml

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4677 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-06 06:15:27 +00:00
Michael Isvy b4b3df07c7 SPR-7858
removed reference to JSR 330's @Named since there is now a dedicated JSR 330 section inside beans-standard-annotations.xml

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4676 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-06 06:14:48 +00:00
Michael Isvy 28b6b1e496 SPR-7858
minor wording change

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4675 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-06 06:13:21 +00:00
Michael Isvy 0f14bd5263 SPR-7858
removed reference to @Provider

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4674 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-06 06:12:46 +00:00
Juergen Hoeller f39e560739 fixed TypeDescriptor rendering (SPR-8508)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4673 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-05 22:06:14 +00:00
Juergen Hoeller 4c7603a407 JavaMailSenderImpl detects and respects "mail.transport.protocol" property in existing Session (SPR-8501)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4672 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-04 22:31:03 +00:00
Juergen Hoeller 327c75754b added "disabled" property to EhCacheFactoryBean
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4671 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-04 22:14:05 +00:00
Juergen Hoeller d43c36cada fixed package declaration
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4669 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-04 22:04:31 +00:00
Juergen Hoeller 9505e91a4a added JBoss dependency (SPR-8505); updated WebSphere dependency
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4667 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-04 21:37:09 +00:00
Juergen Hoeller 1ccdc8b717 switched from readResolve to readObject
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4665 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-04 21:21:33 +00:00
Juergen Hoeller 655754e421 optimized debug logging in case of non-convertible collection (SPR-8499)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4663 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-04 09:43:08 +00:00
Juergen Hoeller 4b84284d23 DataBinder etc
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4662 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-03 22:39:08 +00:00
Juergen Hoeller df7a5c8d6f ContextLoader and FrameworkServlet support "contextId" parameter for custom serialization id
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4659 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-03 22:36:42 +00:00
Juergen Hoeller 6e1eb42832 added "autoGrowNestedPaths" property to ConfigurableWebBindingInitializer
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4657 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-03 21:24:06 +00:00
Juergen Hoeller 17a56fcfdd properly wrap IndexOutOfBoundsException even for List
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4655 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-03 20:24:12 +00:00
Juergen Hoeller 9be513d225 regular IndexOutOfBoundsException if index beyond auto-grow limit
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4654 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-03 20:12:18 +00:00
Juergen Hoeller 3cd0e47d45 restored original array behavior (no default growth of arrays)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4653 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-03 20:05:07 +00:00
Juergen Hoeller a4e5318aff DataBinder uses a default limit of 256 for array/collection auto-growing (SPR-7842)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4652 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-03 19:26:49 +00:00
Juergen Hoeller ffec3a88b6 added joptsimple dependency
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4651 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-03 16:24:55 +00:00
Chris Beams f5be4b22bb Refactor BeanFactoryLocator to use getBean(Class)
Prior to this change, (Context)SingletonBeanFactoryLocator used
BeanFactoryUtils#beanOfType(ListableBeanFactory, Class) to locate the
bean of type BeanFactory.

The more modern approach is to use BeanFactory#getBean(Class), which
removes a dependency on ListableBeanFactory interface while at the same
time opening the implementation up to respecting autowiring exclusions,
primary metadata, etc.

Issue: SPR-8489

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4650 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-02 22:22:33 +00:00
Chris Beams e4c1be808f Rename {DEFAULT_=>}COMMAND_LINE_PROPERTY_SOURCE_NAME
For consistency with all other constants representing default
property source names, such as
StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME and
StandardEnvironment#SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME

Issue: SPR-8482

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4649 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-02 21:39:52 +00:00
Chris Beams 006da7ed81 Refactor JndiPropertySource
Prior to this change, JndiPropertySource worked directly against a JNDI
Context instance as its 'source' object.  This works well enough, but is
not nearly as fully-featured as Spring's existing JndiLocatorDelegate.

This change refactors JndiPropertySource from relying on an underlying
Context to relying on an underlying JndiLocatorDelegate.  By default,
the delegate's "resourceRef" property is set to true, meaning that the
implementation will always try to prepand a given name with
"java:comp/env/" before looking up the name, and upon failure will drop
back to the given name sans prefix.

See JndiPropertySource Javadoc for complete details.

Issue: SPR-8490

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4648 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-02 21:26:44 +00:00
Chris Beams 3be44b3f97 Move JNDI_PROPERTY_SOURCE_ENABLED_FLAG constant
Move JNDI_PROPERTY_SOURCE_ENABLED_FLAG from JndiPropertySource to
StandardServletEnvironment, as this is the only context in which the
constant makes sense.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4647 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-02 21:26:38 +00:00
Chris Beams 6427a1bd9e Return null from JndiPropertySource on lookup failure
Issue: SPR-8490

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4646 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-02 21:26:30 +00:00
Sam Brannen a912a86667 fixed typo and formatting in Javadoc
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4645 50f2f4bb-b051-0410-bef5-90022cba6387
2011-07-01 17:33:13 +00:00
Chris Beams 11ce13a5b4 Fix unnecessary casts in Servlet*PropertySource
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4644 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-30 22:34:08 +00:00
Chris Beams 843106388e Introduce CommandLinePropertySource and impls
Users may now work with command line arguments as a source of
properties for use with the PropertySource and Environment APIs.
An implementation based on the jopt library and a "simple"
implementation requiring no external libraries are are provided
out-of-the box.

See Javadoc for CommandLinePropertySource, JOptCommandLinePropertySource
and SimpleCommandLinePropertySource for details.

Issue: SPR-8482

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4643 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-30 22:33:56 +00:00
Rossen Stoyanchev 326503eac2 8483 Add support for MultipartFile arg type in RequestPartMethodArgumentResolver
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4642 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-30 21:04:23 +00:00