Commit Graph

5247 Commits

Author SHA1 Message Date
Phillip Webb
e3136e65f4 Allow MapToMap conversion even w/out default ctor
MapToMap conversion now works when the target map does not have a
default constructor (as long as a new map copy is not required).

Issue: SPR-9284
Backport-Commit: 38c4393592
2012-10-24 19:31:24 +02:00
Phillip Webb
ced6bb4569 Prevent memory leaks with @Configuration beans
Refactor ConfigurationClassEnhancer to allow cglib caching of
generated classes.  Prior to this commit each enhanced @Configuration
class would consume permgen space when created.

The CallbackFilter and Callback Types are now defined as static final
members so that they can be shared by all enhancers.  Only the
callbackInstances remain specific to a @Configuration class and
these are not used by cglib as part of the cache key.

Issue: SPR-9851
Backport-Commit: c8061393fb
2012-10-24 19:12:03 +02:00
Phillip Webb
4525527794 SpEL support for methods and properties on class …
Update the ReflectiveMethodResolver and ReflectivePropertyAccessor
to allow methods and properties of java.lang.Class to be resolved
when the target object is a class.

Issue: SPR-9017
Backport-Commit: d28592a6c6
2012-10-24 18:04:10 +02:00
Phillip Webb
98075c33c6 Chain exception cause on create failure
Propogate root cause of exceptions thrown from createCollection
and createMap.

Issue: SPR-9285
Backport-Commit: 2e48656906
2012-10-24 15:47:11 +02:00
Chris Beams
4cee691d09 Remove accidentally introduced SpEL test method
SpringEL300Tests's #testArray method was originally introduced with
SPR-9203, which has not yet been backported to 3.1.x. During the process
of backporting SPR-9486 functionality, this method was accidentally
introduced, causing false negative test failures. This commit removes
the offending test method.

Issue: SPR-9203, SPR-9486
2012-10-24 14:32:48 +02:00
Chris Beams
347737290e Update SpEL test to reflect native float support
Issue: SPR-9486
Backport-Commit: 59fb67e38d
2012-10-24 14:31:37 +02:00
Satyapal Reddy
a94677e7b6 Add SpEL support for float literals
This change ensures that SpEL expressions involving floats are
supported natively as opposed to the previous behavior which required
conversion to double, leading to potential downstream conversion
ambiguities.

Issue: SPR-9486
Backport-Commit: be8f23d756
2012-10-24 14:09:33 +02:00
Phillip Webb
ca386c13fc Close 'beans' tag in MVC namespace documentation
Issue: SPR-9898
Backport Issue: SPR-9906
2012-10-22 10:07:51 -07:00
Rossen Stoyanchev
f9eacf9c1f Update changelog 2012-10-22 12:41:27 -04:00
Rossen Stoyanchev
88906d271b Improve regex for parsing query params
Previously UriComponentsBuilder used a regular expression for parsing
query name-value pairs where both name and value were expected to not
contain neither '&', not '='. The idea is that the presence of reserved
characters makes it impossible to guess correctly how to parse the
query string (e.g. a=b&c).

This change relaxes the constraint on query param values, allowing them
to contain '='. In effect '&' is the ultimate separator of name-value
pairs, and any '=' in values is ignored. For example "q=1USD=?EUR" is
interpreted as "q equals '1USD=?EUR'".

Issue: SPR-9832
2012-10-22 11:08:56 -04:00
Rossen Stoyanchev
d8166d6155 Decode target parameters prior to saving a FlashMap
The target parameters for a FlashMap must be decoded to be able to
match them to the parameters of incoming requests given that the
HttpServletRequest returns decoded request parameters.

Issue: SPR-9657
Backport Issue: SPR-9701
2012-10-14 21:37:29 -04:00
Rossen Stoyanchev
4fccd1799a Fix issue with resolving Errors controller argument
The ErrorsMethodArgumentResolver expects the preceding @ModelAttribute
in the controller method signature to be the last one added in the
model -- an assumption that can break if a model attribute is added
earlier (e.g. through a @ModelAttribute method) and more attributes
are added as well. This fix ensures when an @ModelAttribute is resolved
as a controller method argument it has the highest index in the model.

Issue: SPR-9378
Backport Issue: SPR-9687
2012-10-14 21:28:45 -04:00
Chris Beams
9187eeff27 Make required spring-web's dependence on spring-aop
Prior to this commit spring-web's dependence on spring-aop was marked
optional, however spring-web's required dependence on spring-context
transitively forces a required dependence on spring-aop anyway.

This change marks spring-aop as a required dependency of spring-web,
which a) reflects the poms created by the 3.2 Gradle build and b) helps
solve dependency issues when using higher-level Spring projects such as
Spring Security.

Issue: SPR-9573
2012-10-12 14:24:59 -07:00
Juergen Hoeller
2ab55414e5 Polishing 2012-10-12 23:07:10 +02:00
Juergen Hoeller
c90e2c6f10 Made AutoProxyCreatorTests less dependent on container's own interrogation of FactoryBeans
Issue: SPR-9857
2012-10-12 23:06:15 +02:00
Juergen Hoeller
506e9f50d0 LoadTimeWeaverAware beans are consistently being created early for JPA weaving to work reliably
Reverted change for @Bean methods that declare FactoryBean as their return type: The effects of trying to create the FactoryBean to find out about its implementation type are too far-reaching. It's better to recommend declaring a specific return type in the method signature if you want the container to specifically react to your implementation type.

Issue: SPR-9857
2012-10-12 22:56:08 +02:00
Juergen Hoeller
2564db2bfd LoadTimeWeaverAware beans are consistently being created early for JPA weaving to work reliably
Includes a change for factory methods that declare their return type as FactoryBean: When asked for a specific type match (e.g. LoadTimeWeaverAware), we do check early singleton instances as well (reusing the instances that we create for getObjectType checks). This is necessary in order to make @Bean method introspection as capable as XML bean definition introspection, even in case of the @Bean method using a generic FactoryBean declaration for its return type (instead of the FactoryBean impl class).

Issue: SPR-9857
2012-10-12 17:13:07 +02:00
Juergen Hoeller
13edc93f78 Only cache by-type lookups if configuration has been marked as frozen
Issue: SPR-9448
2012-10-12 16:44:04 +02:00
Juergen Hoeller
1d26c37b87 Mention matching bean names in exception message in case of non-unique EntityManagerFactory lookup 2012-10-12 16:26:23 +02:00
Juergen Hoeller
ee8e178434 Only cache by-type lookups if configuration has been marked as frozen
Issue: SPR-9448
2012-10-12 16:24:52 +02:00
Juergen Hoeller
679e122326 LoadTimeWeaverAware beans are consistently being created early for JPA weaving to work reliably
Includes a change for factory methods that declare their return type as FactoryBean: When asked for a specific type match (e.g. LoadTimeWeaverAware), we do check early singleton instances as well (reusing the instances that we create for getObjectType checks). This is necessary in order to make @Bean method introspection as capable as XML bean definition introspection, even in case of the @Bean method using a generic FactoryBean declaration for its return type (instead of the FactoryBean impl class).

Issue: SPR-9857
2012-10-12 16:22:11 +02:00
Rossen Stoyanchev
7c1a2f37f2 Fix issue in message conversion
This change ensures that when the Accept and the Producible media types
are equally specific, we use the one from the Accept header, which may
for example carry a different charset.
2012-10-12 09:20:55 -04:00
Chris Beams
5e318e73f8 Update spring-web pom dependency on hessian
Previously, the spring-web pom still depended on the EBR-style
com.springsource artifactId for hessian.

It now depends on Maven Central-style com.caucho:hessian:3.2.1 naming.

Note that Hessian 3.2.1 acutally does not exist in Maven Central, but is
present in the SpringSource repository at http://repo.springsource.org.
In any case, the dependency is optional, so should not cause issues at
build time for applications dependent on spring-web.

Issue: SPR-9854
2012-10-11 15:30:58 -07:00
Juergen Hoeller
682b0f2c63 Jaxb2Marshaller has non-synchronized access to the JAXBContext once initialized
Also backporting "checkForXmlRootElement" property from 3.2 M2

Issue: SPR-9867
Issue: SPR-9757
2012-10-11 22:31:48 +02:00
Juergen Hoeller
ad81ec922b OpDivide does not return a TypedValue for its operate result (consistent with OpMultiply)
Issue: SPR-9869
2012-10-11 21:39:12 +02:00
Juergen Hoeller
9862fbfc01 BeanWrapper does not fall back to String constructor if ConversionService attempt failed before
Issue: SPR-9865
2012-10-11 19:42:58 +02:00
Juergen Hoeller
d7825586dc Provider injection into prototype beans works for method parameters as well
Issue: SPR-9630
2012-10-11 19:39:37 +02:00
Juergen Hoeller
9338080916 ResourceDatabasePopulator etc 2012-10-11 00:31:06 +02:00
Juergen Hoeller
fd10e149f6 Backport "Remove default profile during environment merge"
Issue: SPR-9761
Issue: SPR-9762
2012-10-11 00:30:00 +02:00
Juergen Hoeller
1dd01a7a82 Fixed test failure on CI server (classpath search failing for some reason)
Issue: SPR-9797
2012-10-11 00:23:07 +02:00
Juergen Hoeller
3788635f51 JPA persistence.xml files may use jar-file entries relative to the unit root (as per the JPA spec)
Issue: SPR-9797
2012-10-10 23:33:52 +02:00
Juergen Hoeller
86ef22db49 Backported "Work around JDK7 String#substring performance regression"
Issue: SPR-9781
Issue: SPR-9784
2012-10-10 23:33:51 +02:00
Juergen Hoeller
b2fce2f254 Backported "Register environment in all bean factories in a hierarchy"
Issue: SPR-9756
Issue: SPR-9764
2012-10-10 23:33:50 +02:00
Juergen Hoeller
be2c2e9a86 Backported "Support opaque URIs in UriComponentsBuilder"
Issue: SPR-9798
Issue: SPR-9804
2012-10-10 23:33:50 +02:00
Rossen Stoyanchev
0047200b98 Fix NPE in AbstractMessageConverterMethodProcessor
Issue: SPR-9868
2012-10-10 09:02:50 -04:00
Juergen Hoeller
1641e082eb Further changes for 3.1.3 2012-10-10 14:28:19 +02:00
Juergen Hoeller
baeac9ea6b Polishing 2012-10-10 14:28:18 +02:00
Juergen Hoeller
bac05f568a Hibernate 4 LocalSessionFactoryBuilder sets thread context ClassLoader (for JBoss 7 compatibility)
Issue: SPR-9846
2012-10-10 14:28:17 +02:00
Juergen Hoeller
cb7d689f92 Consistent "this." reference to local variable 2012-10-10 14:28:16 +02:00
Juergen Hoeller
da8e2d6736 AbstractRoutingDataSource consistently implements JDBC 4.0's Wrapper interface as well
Issue: SPR-9856
2012-10-10 14:28:15 +02:00
Juergen Hoeller
6ed589d94b HttpComponentsHttpInvokerRequestExecutor explicitly releases connection on HttpComponents 4.2
Issue: SPR-9833
2012-10-10 14:28:14 +02:00
Chris Beams
e70119733a Avoid further 'type mismatch' errors in ExtendedBeanInfo
This change fixes further cases under JDK 6 in which setting a bridged
(e.g. String-returning) read method can conflict with an existing
corresponding bridge write method that accepts an Object parameter.

This appears to be a implementation difference between JDKs 6 and 7,
where the JDK 6 Introspector adds bridge methods and JDK 7 does not.

The solution here is to consistently null-out any existing write method
before setting the read method. We were doing this elsewhere in
ExtendedBeanInfo already, but these two changes make the approach
consistent throuhout.

Issue: SPR-8806
Backport-Commit: 0c0a563a24
2012-10-09 20:16:30 -07:00
Sam Brannen
0824746255 Update Javadoc in ExtendedBeanInfo
- updated the link to the "indexed properties" section of the JavaBeans
   tutorial
2012-10-09 20:16:30 -07:00
Chris Beams
30d0bd309c Address various ExtendedBeanInfo bugs
- Ensure that ExtendedBeanInfoTests succeeds when building under JDK 7

 - Improve handling of read and write method registration where
   generic interfaces are involved, per SPR-9453

 - Add repro test for SPR-9702, in which EBI fails to register
   an indexed read method under certain circumstances

Issue: SPR-9778
Backport-Issue: SPR-9702, SPR-9414, SPR-9453
Backport-Commit: b50bb5071a
2012-10-09 20:15:54 -07:00
Rossen Stoyanchev
ec2603de63 Fix issue in AnnotationMethodHandlerExceptionResolver
Caching of resovled exceptions introduced in SPR-7703 also introduced a
side effect whereby if exactly one exception was previously cached, any
other exception would appear as a match to the previously matched
@ExceptionHandler method.

This change ensures use of a fresh map when determining matching
@ExceptionHandler methods while also updating the cache.

Issue: SPR-9209
2012-10-06 22:03:31 -04:00
Rossen Stoyanchev
470c85ade0 Update MediaType's includes method
An additional update (after the last commit) of the "includes" and
"isCompatibleWith" methods of MediaType to accomodate wildcards
in media types with a suffix.

Issue: SPR-9841
2012-10-06 11:07:47 -04:00
Rossen Stoyanchev
01d8d64200 Recognize wildcards in media types with a suffix
The "includes" and "isCompatibleWith" methods of MediaType take into
account media types with suffices (e.g. application/soap+xml) including
wildcards with suffices (e.g. application/*+xml). However before this
change, the isWildcardSubtype() method returned true only for subtype
"*". Now a media type such as application/*+xml is also recognized as
having a wildcard subtype.

Issue: SPR-9841
2012-10-06 10:20:14 -04:00
Juergen Hoeller
2c8b7fe093 ClassUtils.getMostSpecificMethod uses Class.getMethod code path in case of a public method
This should be significantly faster than our standard algorithm, for a very common case. Motivated by SPR-9802, even if the fix there uses a different approach, with transaction name determination not calling getMostSpecificMethod at all anymore.

Issue: SPR-9802
2012-09-26 20:04:43 +02:00
Juergen Hoeller
bbfc807b0c TransactionInterceptor avoids reflective method search for method identification
As of Spring 3.0.4, we were trying to expose the target method signature as transaction name. Unfortunately, the algorithm called the ClassUtils.getMostSpecificMethod helper method which performs a quite expensive reflective search. As of this commit, we're simply concatenating the target class name with the method name, accepting the use of the concrete target class (which is arguably more meaningful for monitoring anyway) even when the method implementation actually sits on a base class.

Issue: SPR-9802
2012-09-26 19:31:05 +02:00
Juergen Hoeller
c81543e1a4 ResourceBundleMessageSource supports "defaultEncoding", "fallbackToSystemLocale", "cacheSeconds"
These features require Java 6 or higher due to their dependency on the ResourceBundle.Control class. To some degree, ResourceBundleMessageSource catches up with ReloadableResourceBundleMessageSource now. However, as noted in the javadoc, there are still severe limitations in the standard ResourceBundle class that justify an ongoing investment in our own ReloadableResourceBundleMessageSource (based on the Spring resource abstraction, with manual parsing of properties files).

Issue: SPR-7392
2012-09-26 16:46:25 +02:00