Commit Graph

5557 Commits

Author SHA1 Message Date
Rossen Stoyanchev 97f97c4e9f Polish async support
Added handler argument to the signature of
AsyncHandlerInterceptor.afterConcurrentHandlingStarted(..).

Renamed AsyncWebUtils to WebAsyncUtils.
2012-09-17 14:58:56 -04:00
Chris Beams ccd7b10237 Merge pull request #147 from poutsma/SPR-9768
# By Arjen Poutsma
* SPR-9768:
  Preserve comments when using JibxMarshaller
2012-09-17 14:11:22 +01:00
Arjen Poutsma f191a55b8f Preserve comments when using JibxMarshaller
Prior to this commit, JibxMarshaller used a SAX ContentHandler to
marshal to StAX XMLEventWriters, which inadvertently resulted in the
deletion of XML comments.

After this commit, JibxMarshaller adapts the XMLEventWriter into an
XMLStreamWriter and comments are preserved.

Issue: SPR-9768
2012-09-17 14:07:02 +01:00
Chris Beams 17c6515c0a Increment version to 3.2.0.BUILD-SNAPSHOT 2012-09-12 04:08:39 +02:00
Spring Buildmaster 323ac6ad01 Release version 3.2.0.M2 2012-09-11 18:41:07 -07:00
Chris Beams c4aa14f343 Ignore SpringRunnerContextCacheTests
Avoid order-dependent test method failures on JDK7

Issue: SPR-9789
2012-09-11 23:54:35 +02:00
Chris Beams 6c8f795122 Add Created-By attribute to jar manifests
This commit ensures that the 'Created-By:' attribute [1] is added to
each jar's META-INF/MANIFEST.MF in order to identify clearly the vendor
and version of Java used during the build process.

[1]: http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html
2012-09-11 22:20:20 +02:00
Chris Beams 0af04910f9 Update STS version used to test Eclipse setup script 2012-09-11 17:32:30 +02:00
Chris Beams 3bebb23f64 Update changelog 2012-09-11 16:56:49 +02:00
Phillip Webb 73832f8c6e Support inferred base package for @ComponentScan
Prior to this change, @ComponentScan required the declaration of
exactly one of the #value, #basePackage or #basePackageClasses
attributes in order to determine which package(s) to scan.

This commit introduces support for base package inference, relaxing the
above requirement and falling back to scanning the package in which the
@ComponentScan-annotated class is declared.

Issue: SPR-9586
2012-09-11 16:50:01 +02:00
Chris Beams 512ffbb273 Update PortletRequestUtilsTests float test timeout
Float parameter handling appears to be marginally more expensive under
JDK7, with the testGetFloatParameterWithDefaultValueHandlingIsFastEnough
test clocking in anywhere from 250 to 315 ms. This violates the current
test threshold of 250 ms, so this commit ups the timeout value to 350 ms
with the assumption that this is indeed a marginal and therefore overall
negligible performance degradation.
2012-09-11 16:00:18 +02:00
Chris Beams ec2df7d229 Merge pull request #143 from olivergierke/SPR-9781
# By Oliver Gierke
* SPR-9781:
  Work around JDK7 String#substring performance regression
2012-09-11 15:06:48 +02:00
Oliver Gierke 3fb3b7d67a Work around JDK7 String#substring performance regression
String#substring has become significantly slower as of JDK 1.7.0_06 [1],
such that there are performance degradations by a factor of 100-1000 in
ResourceDatabasePopulator, especially for large SQL files.

This commit works around this problem by minimizing the substring scope
to the least amount possible to prevent unnecessary internal copying of
strings (which seems to cause the issue).

[1]: http://mail.openjdk.java.net/pipermail/core-libs-dev/2012-May/010257.html

Issue: SPR-9781
2012-09-11 15:06:40 +02:00
Chris Beams dfe05305e2 Upgrade to JUnit 4.11 snapshot in support of JDK7
Class#getDeclaredMembers returns arbitrary results under JDK7. This
results in non-deterministic execution of JUnit test methods, often
revealing unintended dependencies between methods that rely on a
specific order to succeed.

JUnit 4.11 contains support for predictable test ordering [1], but at
the time of this commit, JUnit 4.11 has not yet been released.
Therefore we are testing against a snapshot version [2], which has been
uploaded to repo.springsource.org [3] for easy access. Note that this
artifact may be removed when JUnit 4.11 goes GA.

 - Care has been taken to ensure that spring-test's compile-time
   dependency on JUnit remains at 4.10. This means that the spring-test
   pom.xml will continue to have an optional <dependency> on JUnit
   4.10, instead of the 4.11 snapshot.

 - For reasons not fully understood, the upgrade to the 4.11 snapshot
   of junit-dep caused NoSuchMethodErrors around certain Hamcrest
   types, particularly CoreMatchers and Matchers. import statements
   have been updated accordingly throughout affected test cases.

 - Runtime errors also occurred around uses of JUnit @Rule and
   ExpectedException. These have been reverted to use simpler
   mechanisms like @Test(expected) in the meantime.

 - Some test methods with order-based dependencies on one another have
   been renamed in order to fall in line with JUnit 4.11's new method
   ordering (as opposed to actually fixing the inter-test
   dependencies). In other areas, the fix was as simple as adding a
   tearDown method and cleaning up state.

 - For no apparent reason, the timeout in AspectJAutoProxyCreatorTests'
   testAspectsAndAdvisorNotAppliedToPrototypeIsFastEnough method begins
   to be exceeded. Prior to this commit the timeout value was 3000 ms;
   on the CI server under Linux/JDK6 and JDK7, the test begins taking
   anywhere from 3500-5500 ms with this commit. It is presumed that
   this is an incidental artifact of the upgrade to JUnit 4.11. In any
   case, there are no changes to src/main in this commit, so this
   should not actually represent a performance risk for Spring
   Framework users. The timeout has been increased to 6000 ms to
   accommodate this situation.

[1]: https://github.com/KentBeck/junit/pull/293
[2]: https://github.com/downloads/KentBeck/junit/junit-dep-4.11-SNAPSHOT-20120805-1225.jar
[3]: https://repo.springsource.org/simple/ext-release-local/junit/junit-dep/4.11.20120805.1225

Issue: SPR-9783
2012-09-11 15:04:56 +02:00
Phillip Webb a9a90cabad Protect against non-deterministic method order in JDK7
- Allow reset of GlobalAdvisorAdapterRegistry

   Provide a reset() method allowing the GlobalAdvisorAdapterRegistry
   instance to be replaced with a fresh instance. This method has
   primarily been added to allow unit tests to leave the registry
   in a known state.

 - Protect against the fact that calls to configuration class methods
   my occur in a random order.

Issue: SPR-9779
2012-09-11 15:04:55 +02:00
Phillip Webb 8e7622bb8a Fix Windows-related build issues
- Increase max heap size in gradle wrapper.
- Use MockProperties implementation to protect against security
  exceptions.
- Replace windows CRLF with LF in various tests.
- Increase Thread.sleep times to account for lack of precision on
  Windows.

Issue: SPR-9717
2012-09-11 15:04:55 +02:00
Chris Beams 94bb036269 Polish PortletRequestUtilsTests
Update PortletRequestUtilsTests to use Assert#assertThat and Hamcrest's
Matchers#lessThan in order to output more useful messages when tests
fail.
2012-09-11 15:04:55 +02:00
Rossen Stoyanchev 2ff3d53962 Ignore parse errors in HttpPutFormContentFilter
Errors when parsing the request content-type, in order to find out if
the request has form content, are translated to false.

Issue: SPR-9769
2012-09-10 20:06:10 -04:00
Rossen Stoyanchev 48b963aaa5 Add error request attribute for 500 reponses
DefaultHandlerExceptionResolver and ResponseEntityExceptionHandler now
both set the "javax.servlet.error.exception" request attribute to the
raised exception, allowing custom error pages configured via web.xml.

Issue: SPR-9653
2012-09-10 18:26:43 -04:00
Juergen Hoeller 787d8f5916 SpringFactoriesLoader as the simplest possible mechanism for BeanInfoFactory loading 2012-09-10 23:16:21 +02:00
Juergen Hoeller 0a42c80c11 @Import'ed configuration classes get properly registered in case of same class name (second try)
Issue: SPR-9243
2012-09-10 23:16:20 +02:00
Rossen Stoyanchev 34c3e821dd Cache AntPathStringMatcher instances
AntPathMatcher now caches AntPathStringMatcher instances by pattern
thus avoiding java.util.regex.Pattern recompilation.

Issue: SPR-9749
2012-09-10 16:57:10 -04:00
Rossen Stoyanchev 0a877afa06 Optimize use of HandlerMethod and sub-classes
While HandlerMethod instances are cached for lookup purposes, a new
ServletInvocableHandlerMethod instance has to be created prior to each
invocation since handlers may have non-singleton scope semantics.

This change reduces the overhead of creating per request instances
by using a logger with a fixed name rather than relying on getClass()
and also by copying introspected method parameters from the cached
HandlerMethod instance.

Issue: SPR-9747, SPR-9748
2012-09-10 14:01:01 -04:00
Juergen Hoeller 228a77552d @Import'ed configuration classes get properly registered in case of same class name
Issue: SPR-9243
2012-09-10 15:44:12 +02:00
Juergen Hoeller 430db261e7 BeanFactoryAnnotationUtils throws NoSuchBeanDefinitionExceptions instead of IllegalStateExceptions
Issue: SPR-9652
2012-09-10 15:26:43 +02:00
Juergen Hoeller 7d8843d069 Expression detection properly handles cached String literals
Issue: SPR-9670
2012-09-10 15:14:14 +02:00
Juergen Hoeller f29b791c85 MutablePropertySources log statements guarded by isDebugEnabled
Issue: SPR-9670
2012-09-10 15:14:13 +02:00
Juergen Hoeller a90f25668b Spring-backed DataSources consistently implement JDBC 4.0's Wrapper interface
Issue: SPR-9770
2012-09-10 15:14:12 +02:00
Juergen Hoeller f32e4077fa same-named unit from persistence.xml overrides in case of conflict with default unit
Issue: SPR-9741
2012-09-10 15:14:11 +02:00
Juergen Hoeller 10a4e88e0a polishing 2012-09-10 15:14:10 +02:00
Juergen Hoeller 282d961b2e @Import'ed configuration classes get properly registered in case of same class name
Issue: SPR-9243
2012-09-10 15:14:10 +02:00
Juergen Hoeller 8f12d98a99 LinkedCaseInsensitiveMap checks for uniqueness of case-insensitive keys now
Issue: SPR-9754
2012-09-10 15:14:09 +02:00
Arjen Poutsma 82739dd4ac Refactor BeanInfoFactory
This commit refactors the BeanInfoFactory so that:

 - supports() and getBeanInfo() are folded into one, so that getBeanInfo()
    returns null if a given class is not supported.
 - CachedIntrospectionResults now uses SpringFactoriesLoader
2012-09-10 14:28:53 +02:00
Arjen Poutsma aeff91c1da Moved SpringFactoriesLoader to io.support in order to resolve tangle. 2012-09-10 11:28:45 +02:00
Sam Brannen fc859ffd6e Update Javadoc in ExtendedBeanInfo
- updated the link to the "indexed properties" section of the JavaBeans
   tutorial
2012-09-09 21:57:51 +02:00
Sam Brannen 3925f6a428 Polish Javadoc for ExtendedBeanInfoFactory 2012-09-09 21:47:02 +02:00
Chris Beams 5bcf68e25a Use ExtendedBeanInfo on an as-needed basis only
Prior to this change, CachedIntrospectionResults delegated to
ExtendedBeanInfo by default in order to inspect JavaBean
PropertyDescriptor information for bean classes.

Originally introduced with SPR-8079, ExtendedBeanInfo was designed to
go beyond the capabilities of the default JavaBeans Introspector in
order to support non-void returning setter methods, principally to
support use of builder-style APIs within Spring XML. This is a complex
affair, and the non-trivial logic in ExtendedBeanInfo has led to various
bugs including regressions for bean classes that do not declare
non-void returning setters.

This commit takes advantage of the new BeanInfoFactory mechanism
introduced in SPR-9677 to take ExtendedBeanInfo out of the default code
path for CachedIntrospectionResults. Now, the new
ExtendedBeanInfoFactory class will be detected and instantiated (per its
entry in the META-INF/spring.beanInfoFactories properties file shipped
with the spring-beans jar). ExtendedBeanInfoFactory#supports is invoked
for all bean classes in order to determine whether they are candidates
for ExtendedBeanInfo introspection, i.e. whether they declare non-void
returning setter methods.

If a class does not declare any such non-standard setter methods (the
99% case), then CachedIntrospectionResults will fall back to the
default JavaBeans Introspector. While efforts have been made to fix any
bugs with ExtendedBeanInfo, this change means that EBI will not pose
any future risk for bean classes that do not declare non-standard
setter methods, and also means greater efficiency in general.

Issue: SPR-9723, SPR-9677, SPR-8079
2012-09-09 16:45:28 +02:00
Chris Beams b50bb5071a 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-9702, SPR-9414, SPR-9453
2012-09-09 16:44:54 +02:00
Sam Brannen c795c1b362 Polishing 2012-09-08 18:16:33 +02:00
Rossen Stoyanchev 70b0b97b54 Fix cyclical package dependency 2012-09-07 22:14:49 -04:00
Rossen Stoyanchev 6e85dd8917 Polish async request processing
This change fixes a cyclical package dependency.

The change also improves the implementation of
WebAsyncManager.hasConcurrentResult() following the resolution of
Apache issue id=53632 and the release of Apache Tomcat 7.0.30 that
contains the fix.
2012-09-07 21:30:11 -04:00
Arjen Poutsma 988f376752 Added SpringFactoriesLoader 2012-09-07 17:00:22 +02:00
Phillip Webb 77c9321967 Sort candidate @AspectJ methods deterministically
Update the ReflectiveAspectJAdvisorFactory class to sort candidate
AOP methods based on their annotation first and method name second.

Prior to this the order of aspects created from annotated methods
could differ depending on the underling JVM, as first noticed under
JDK7 in SPR-9729.

 - ConvertingComparator and InstanceComparator have been introduced in
   support of this change, per SPR-9730.

 - A shared static INSTANCE field has been added to ComparableComparator
   to avoid unnecessary instantiation costs within ConvertingComparator
   as well as to prevent generics warnings during certain caller
   scenarios.

Issue: SPR-9729, SPR-9730
2012-09-06 16:06:16 +02:00
Phillip Webb 719a9e120d Refactor ComparatorTests into separate classes 2012-09-06 16:06:16 +02:00
Phillip Webb 9821868707 Refactor and polish various Comparator impls
- Refactor CompoundComparator constructor to use varargs
 - Refactor MediaType to consume new varargs constructor
 - Add notNull assertions where appropriate
 - Add generic typing where appropriate
 - Suppress generics warnings elsewhere
 - Fix whitespace errors
2012-09-06 16:06:16 +02:00
Arjen Poutsma bd018fc9d7 Optional @XmlRootElement check in Jaxb2Marshaller
Before this commit, the Jaxb2Marshaller required all supported classes
to be annotated with @XmlRootElement. This commit adds a property
'checkForXmlRootElement' (default is true) which allows for un-annotated
classes.

This is especially useful for JAXB2 implementations that can use
external binding files, such as EclipseLink MOXy.

Issue: SPR-9757
2012-09-06 13:12:03 +02:00
Chris Beams 6517517ca9 Refactor to lazy Environment creation where possible
This commit avoids eager creation of Environment instances, favoring
delegation of already existing Environment objects where possible. For
example, FrameworkServlet creates an ApplicationContext; both require
a StandardServletEnvironment instance, and prior to this change, two
instances were created where one would suffice - indeed these two
instances may reasonably be expected to be the same. Now, the
FrameworkServlet defers creation of its Environment, allowing users to
supply a custom instance via its #setEnvironment method (e.g. within a
WebApplicationInitializer); the FrameworkServlet then takes care to
delegate that instance to the ApplicationContext created
in #createWebApplicationContext.

This behavior produces more consistent behavior with regard to
delegation of the environment, saves unnecessary cycles by avoiding
needless instantiation and calls to methods like
StandardServletEnvironment#initPropertySources and leads to better
logging output, as the user sees only one Environment created and
initialized when working with the FrameworkServlet/DispatcherServlet.

This commit also mirrors these changes across the corresponding
Portlet* classes.

Issue: SPR-9763
2012-09-05 22:33:55 +02:00
Chris Beams 9f8d219146 Remove default profile during environment merge
This change fixes a minor bug with the implementation of
ConfigurableEnvironment#merge, introduced in SPR-9444. During a merge
of two environments A and B, where A has default profiles [prod] and B
has default profiles [default] (the so-called 'reserved default
profile'), B would complete the merge process having a collection of
profiles reading [default, prod], which is incorrect.

This commit explicitly ensure's that B's reserved default profile is
removed if A has a set of default profiles greater than zero. If A
consists only of [default], B will inherit it during the merge
correctly; if A consists of [p1, p2], B will result in [p1, p2] as
well; if B consists of [p1] and A of [p2, p3], B will result in
[p1, p2, p3] post-merge.

Issue: SPR-9761, SPR-9444
2012-09-05 22:33:14 +02:00
Chris Beams f963d0f190 Register environment in all bean factories in a hierarchy
Prior to this change, AbstractApplicationContext#prepareBeanFactory
registered a bean named 'environment' once and only once within a given
ApplicationContext hierarchy. This worked fine with the expectation
that the Environment object is always delegated downward to children of
that hierarchy. However, with SPR-9444 and the introduction of
ConfigurableEnvironment#merge, this expectation was violated; each
member of an application context hierarchy now maintains its own
distinct Environment instance, which means that by extension that each
application context's underlying BeanFactory should have its own
'environment' bean pointing to that context's environment instance.

This problem could manifest in getting the wrong environment instance
when calling #getBean(Environment) or when @Autowiring an Environment
instance, for example into a @Configuration class. As reported in
SPR-9756, this could result in false negative property lookups or
incorrect results when checking whether a profile is active.

This commit ensures that every bean factory in an application
hierarchy has an 'environment' bean referring to the object returned
from the enclosing ApplicationContext#getEnvironment method.

Issue: SPR-9756, SPR-9444
2012-09-05 22:22:05 +02:00
Rob Winch c92a06f003 Support Filters/Servlet invocation in MockFilterChain
This commit adds the ability to allow the MockFilterChain to invoke
a List of Filter's and/or a Servlet.

Issue: SPR-9745
2012-09-05 01:30:46 -04:00