Commit Graph

4361 Commits

Author SHA1 Message Date
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
Costin Leau 08fc4f9015 SPR-8477
+ add no-op cache implementations suitable for cache declarations w/o a backing store

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4641 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-30 18:17:39 +00:00
Rossen Stoyanchev 783d4077a6 SPR-8431 Extract RedirectView URL creation into separate method available for subclasses to use
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4640 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-30 09:13:51 +00:00
Chris Beams 39d8015752 Prevent NPE in SpringServletContainerInitializer
Issue: SPR-8496

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4639 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-29 17:33:07 +00:00
Rossen Stoyanchev 09197872e9 SPR-8447 Provide sufficient contextwherever possible when exceptions are raised in new @MVC classes.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4638 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-29 15:36:18 +00:00
Rossen Stoyanchev 538364c966 SPR-8483 Add support for @RequestPart annotated method parameters
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4637 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-28 19:22:33 +00:00
Juergen Hoeller b0383f9080 fixed getHeaderNames signature
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4636 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-28 14:08:47 +00:00
Juergen Hoeller 30f9c3c937 added headers support to MultipartFile abstraction
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4635 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-27 23:02:13 +00:00
Rossen Stoyanchev 75d036f82e SPR-8487 Ensure setters for argument resolvers and return value handlers replace the defaults completely.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4634 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-27 22:23:10 +00:00
Keith Donald 0997b2ef16 javadoc update
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4633 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-27 21:37:34 +00:00
Keith Donald f606eb3012 SPR-8465
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4632 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-27 21:36:48 +00:00
Rossen Stoyanchev 7f0f60575d SPR-7608 Add several sections to the reference docs on working with the @ModelAttribute annotation. Specifically the goal was to cover the abitlity for an @ModelAttribute argument to be instantiated from a URI template variable with the help of a Converter or a PropertyEditor.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4631 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-27 21:12:58 +00:00
Sam Brannen e31c95bfa6 [SPR-8387] polishing
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4630 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-26 17:13:09 +00:00
Sam Brannen 91ab10775a [SPR-8387] skeleton for DelegatingSmartContextLoaderTests.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4629 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-26 17:01:32 +00:00
Sam Brannen 3b8cf1a454 [SPR-8387] Introduced supports(MergedContextConfiguration) method in the SmartContextLoader SPI; updated existing loaders accordingly; and fleshed out implementation of and tests for the new DelegatingSmartContextLoader.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4628 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-26 16:46:18 +00:00
Sam Brannen 3c32b612c7 [SPR-8387] refined logging.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4627 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-26 15:47:30 +00:00
Sam Brannen 41461db8a9 [SPR-8387] Initial draft of the new DelegatingSmartContextLoader.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4626 50f2f4bb-b051-0410-bef5-90022cba6387
2011-06-26 15:39:58 +00:00