Commit Graph

2251 Commits

Author SHA1 Message Date
Phillip Webb 0f2e94f0fc Fix reference docs section on inner beans
Inner beans are not prototype beans as, in contrast to what is
documented in the section for prototype beans, the inner bean does
get destruction callbacks applied.

Issue: SPR-10311
2013-02-27 13:44:33 -08:00
Chris Beams 3a192a0701 Update Eclipse import organization rules
The following changes have been made to the JDT UI prefs to conform to
existing conventions throughout the codebase:

 - always favor .* syntax for static imports
 - always list static imports last

Re-run `gradle eclipse` and refresh projects within Eclipse to make
this change take effect.
2013-02-26 14:21:01 +01:00
Phillip Webb da034eb020 Replace references to SimpleJdbcTemplate in docs
Rework JDBC section of the manual to remove references to the now
deprecated SimpleJdbcTemplate class.

Issue: SPR-10317
2013-02-25 16:33:15 -08:00
Phillip Webb 7e2022b9a7 Fix @RequestMapping regex reference doc example
Issue: SPR-10244
2013-02-19 11:48:55 -08:00
Juergen Hoeller 7d20c7a62f Module POMs, etc 2013-02-15 18:31:49 +01:00
Juergen Hoeller f0787bdb86 Fixed @Configurable documentation with respect to logging when the aspect hasn't been configured
Issue: SPR-10295
2013-02-15 13:32:46 +01:00
Juergen Hoeller 81a929aed3 Removed outdated EJB reference from auto-proxying documentation.
Issue: SPR-10299
2013-02-15 13:32:45 +01:00
Juergen Hoeller 8987ceea93 Fixed @Configurable documentation with respect to the use of a prototype-scoped bean definition.
Issue: SPR-10298
2013-02-15 13:32:45 +01:00
Arjan van Bentem 24ed325c0c Add HttpPutFormContentFilter note to documentation
Update reference guide to include a note about the use of
HttpPutFormContentFilter in combination with @RequestBody
MultiValueMap and HttpEntity.

Issue: SPR-8415
2013-02-13 11:50:34 -08:00
Phillip Webb 39c6341cea Fix type in "what's new in 3.2" section
Issue: SPR-10283
2013-02-12 22:43:40 -08:00
Phillip Webb 9320bf1316 Fix @RequestMapping regex reference doc example
Issue: SPR-10244
2013-02-11 20:56:59 -08:00
Juergen Hoeller 08e1cbc02b Jaxb2Marshaller etc 2013-02-11 21:52:05 +01:00
Juergen Hoeller d442c40e0c Added section on GemFire as a cache provider choice (SPR-9468) 2013-02-10 23:53:19 +01:00
Juergen Hoeller c4194ee175 Added paragraph on BeanPostProcessor side effects when autowiring dependencies into it (SPR-9577) 2013-02-10 23:53:18 +01:00
Juergen Hoeller 00a3420c6f CastorMarshaller etc 2013-02-10 21:11:13 +01:00
Juergen Hoeller 01c44c8bf6 Further enhancements for 3.2.2 2013-02-10 00:02:45 +01:00
Juergen Hoeller 9881517f61 Further enhancements for 3.2.2 2013-02-08 22:26:03 +01:00
Phillip Webb 584e79c677 Promote use of @PostConstruct and @PreDestroy
Update reference documentation to promote the use of the JSR-250
@PostConstruct and @PreDestroy annotations.

Issue: SPR-8493
2013-02-07 17:25:16 -08:00
Juergen Hoeller f9bac48d84 Further preparations for 3.2.2 2013-02-08 00:59:45 +01:00
Juergen Hoeller 1ed26d6389 Preparations for 3.2.2 2013-02-06 21:48:28 +01:00
Phillip Webb 1c724069c3 Improve presentation of code blocks in Javadoc
Include custom javadoc css that formats <pre class="code"> blocks.

Issue: SPR-10155
2013-02-04 15:05:08 -08:00
Phillip Webb a6b70722fa Update Quartz documentation to use FactoryBeans
Update examples for Quartz scheduling to use SimpleTriggerFactoryBean
and CronTriggerFactoryBean instead of SimpleTriggerBean and
CronTriggerBean.

Issue: SPR-10209
2013-02-04 13:57:48 -08:00
Phillip Webb 8c2ace33cb Support 'unless' expression for cache veto
Allow @Cachable, @CachePut and equivalent XML configuration to provide
a SpEL expression that can be used to veto putting an item into the
cache. Unlike 'condition' the 'unless' parameter is evaluated after
the method has been called and can therefore reference the #result.

For example:

    @Cacheable(value="book",
        condition="#name.length < 32",
        unless="#result.hardback")

This commit also allows #result to be referenced from @CacheEvict
expressions as long as 'beforeInvocation' is false.

Issue: SPR-8871
2013-02-04 11:59:15 -08:00
Sam Brannen ae0c34baaf Improve 3.2 migration guide re: JUnit & Hamcrest
This commit improves the "Spring Test Dependencies" section of the 3.2
migration guide by correctly explaining that Hamcrest Core is now a
required transitive dependency of JUnit.

Issue: SPR-10251
2013-02-01 15:40:01 +01:00
Phillip Webb aac6b913d6 Merge branch 'cleanup-3.2.x' into 3.2.x
* cleanup-3.2.x:
  Fix unnecessary @SupressWarnings annotations
  Fix Javadoc warnings
  Fix unused local variable warnings
  Fix unused type compiler warnings
  Fix 'is already an instance of type' warnings
2013-01-31 12:52:51 -08:00
Juergen Hoeller bd72fcd469 Initial preparations for 3.2.2 2013-01-31 16:53:58 +01:00
Ken Dombeck b8e7314c43 Fix typo in new-in-3.2.xml document
This commit fixes a typo in the "New Features and Enhancements in Spring
Framework 3.2" chapter of the reference manual. Specifically,
ContentNegotiationStrategy is now spelled correctly.
2013-01-26 15:12:12 +01:00
Phillip Webb 2b0d860923 Fix Javadoc warnings 2013-01-25 17:31:33 -08:00
Phillip Webb 065b1c0e46 Fix unused local variable warnings 2013-01-25 14:35:19 -08:00
Phillip Webb 1065d82f08 Remove eclipse project specific Javadoc settings
Remove Javadoc settings from generated eclipse meta-data. Unfortunately
eclipse provides too many false warnings due to the fact that @Link and
@See tags in Spring often refer modules to which they cannot directly
depend.
2013-01-25 10:58:24 -08:00
Phillip Webb a99a4ed9b5 Tweak gradle generated eclipse meta-data
- Change output folders to /bin/main and /bin/test. This prevents
   'gradle clean' from breaking eclipse.

 - Update copyright header for new files to '2002-2013'
2013-01-24 09:44:25 -08:00
Juergen Hoeller 8625504711 Completed changelog entries for 3.2.1 2013-01-24 16:45:06 +01:00
Juergen Hoeller 919aeb5df9 Final preparations for 3.2.1 2013-01-23 23:34:21 +01:00
Sam Brannen e4f1f682e2 Update distribution README regarding paths
- Corrected path to 'docs/spring-framework-reference'
- Minor formatting changes
2013-01-23 17:09:45 +01:00
Juergen Hoeller 5fb75304eb Final preparations for 3.2.1 2013-01-23 01:32:29 +01:00
Juergen Hoeller 0a09da7534 Final preparations for 3.2.1 2013-01-22 21:12:08 +01:00
Rossen Stoyanchev 692ced8046 Fix typo in reference docs
Issue: SPR-10204
2013-01-22 14:15:22 -05:00
Chris Beams d3f4528905 Remove additional xsd versions from reference docs
A few versioned xsd references still existed in xsd-configuration.xml;
this commit removes them, completing the work for SPR-10010

Issue: SPR-10010
2013-01-22 16:02:31 +01:00
Chris Beams d40c8cfc58 Fix broken Castor URLs in ref docs and mapping XML
Issue: SPR-10189
2013-01-21 11:21:44 +01:00
Chris Beams 24cc33306d Fix typo in reference documentation
Issue: SPR-10171
2013-01-21 11:07:04 +01:00
Juergen Hoeller 87968e5a71 Further preparations for 3.2.1 2013-01-18 18:01:33 +01:00
Juergen Hoeller 13cf1fceaa Fixed reference to "fallbackToNoOpCache" flag
Issue: SPR-9064
2013-01-18 13:49:57 +01:00
Juergen Hoeller cd2183f9e1 Fixed ConnectionSpecConnectionFactoryAdapter explanation
Issue: SPR-9466
2013-01-18 13:47:11 +01:00
Juergen Hoeller 8a12b9e23f Removed reference to AttributesJmxAttributeSource
Issue: SPR-8916
2013-01-18 13:42:21 +01:00
Juergen Hoeller e44b4b831e Further fixes for 3.2.1 2013-01-15 22:10:14 +01:00
Rossen Stoyanchev a16bad04f0 Update Validation chapter
The Validation chapter now includes information on combining JSR-303
Bean Validation with additional Spring Validator's that don't require
the use of annotations.

Issue: SPR-9437
2013-01-14 22:00:54 -05:00
Phillip Webb d40bd8bd19 Tweak eclipse warning settings
Hide raw-type, generic and resource leak warnings.
2013-01-14 11:43:58 -08:00
Phillip Webb 2db7a12288 Generate eclipse project settings from gradle
Update gradle to generate the following project specific eclipse
settings:

- Java formatting
- Cleanup options
- Warning settings
- Code template with copyright header
- WTP module meta-data

In addition this commit changes the eclipse project .classpath file
to output test and main classes to different folders. This is required
to prevent eclipse WTP from packaging test classes into /WEB-INF/lib
jar files.

Issue: SPR-9518
2013-01-11 12:43:16 -08:00
Juergen Hoeller ea823fd398 AnnotationAwareOrderComparator etc 2013-01-10 17:01:18 +01:00
Rossen Stoyanchev 24ffa5a706 Update info on RestTemplate related to 401 status code
Issue: SPR-9367
2013-01-08 10:48:22 -05:00
Rossen Stoyanchev 2ac4a8c541 Update mvc chapter on annotations and proxies
Issue: SPR-10132
2013-01-08 10:01:51 -05:00
Chris Beams b8f223c404 Add 3.1 migration section to reference docs
Address error raised when using component-scan against the unqualified
"org" base package.

Issue: SPR-9843
2013-01-08 11:30:22 +01:00
Rossen Stoyanchev 7bc9667913 Add support for placeholders in @RequestMapping
@RequestMapping annotations now support ${...} placeholders.

Issue: SPR-9935
2013-01-07 18:06:47 -05:00
Chris Beams 676231644d Update Apache license headers for moved files
Issue: SPR-9431
2013-01-04 12:20:13 +01:00
Chris Beams 42729014b6 Move namespace tests to root integration module
Prior to this change, spring-beans contained its own META-INF containing
spring.handlers and spring.schemas files in src/main/resources; it also
had files of the same name within src/test/resources/META-INF, causing
'duplicate resource' warnings and confusion in general.

This commit moves the com.foo test package, it's associated namespace
parsing tests and test versions of META-INF files to the root project
and it's src/test integration testing folder.

Issue: SPR-9431
2013-01-04 12:16:20 +01:00
Phillip Webb 42b5d6dd7e Remove duplicate test classes
Prior to this commit many test utility classes and sample beans were
duplicated across projects. This was previously necessary due to the
fact that dependent test sources were not shared during a gradle
build. Since the introduction of the 'test-source-set-dependencies'
gradle plugin this is no longer the case.

This commit attempts to remove as much duplicate code as possible,
co-locating test utilities and beans in the most suitable project.
For example, test beans are now located in the 'spring-beans'
project.

Some of the duplicated code had started to drift apart when
modifications made in one project where not ported to others. All
changes have now been consolidated and when necessary existing tests
have been refactored to account for the differences.

Conflicts:
	spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java
	spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java
	spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java
2013-01-04 10:02:29 +01:00
Phillip Webb 65fb26f847 Move spring-build-junit into spring-core
Move code from spring-build-junit into spring-core/src/test along with
several other test utility classes. This commit removes the temporary
spring-build-junit project introduced in commit
b083bbdec7.
2013-01-01 19:49:45 -08:00
Tom Mack 005ee7385f Remove extra URL prefix in the MVC chapter
A link in the MVC chapter of the reference manual contained an extra
"http://" URL prefix.

This commit removes the extra "http://" URL prefix.
2012-12-28 23:18:18 +01:00
Chris Beams 8472a2b2ab Update Apache license headers for affected sources 2012-12-28 23:09:31 +01:00
Phillip Webb 60032e0012 Ignore performance-sensitive tests by default
Make use of the new JUnit functionality introduced in the previous
commit to 'Assume' that perfomance- and timing-sensitive tests should
run only when TestGroup.PERFORMANCE is selected, i.e. when
-PtestGroups="performance" has been provided at the Gradle command line.

The net effect is that these tests are now ignored by default, which
will result in far fewer false-negative CI build failures due to
resource contention and other external factors that cause slowdowns.

We will set up a dedicated performance CI build to run these tests on
an isolated machine, etc.

Issue: SPR-9984
2012-12-28 23:08:37 +01:00
Chris Beams 4c8cd7b0bd Add @Override annotations to test sources
Issue: SPR-10129
2012-12-28 23:05:44 +01:00
Phillip Webb b0986049a3 Fix [serial] compiler warnings
Fix serialization warnings by applying @SuppressWarnings("serial")
when appropriate.

In certain cases and for unknown reasons, a correctly-placed
@SuppressWarnings("serial") annotation will fix the warning at the
javac level (i.e. the Gradle command-line), but will produce an
"unnecessary @SuppressWarnings" warning within Eclipse. In these
cases, a private static final serialVersionUID field has been added
with the default value of 1L.
2012-12-28 22:41:06 +01:00
Phillip Webb 1762157ad1 Remove trailing whitespace in source files
find . -type f -name "*.java" -or -name "*.aj" | \
    xargs perl -p -i -e "s/[ \t]*$//g" {} \;

Issue: SPR-10127
2012-12-28 20:49:45 +01:00
Juergen Hoeller a30ee0164a Initial preparations for 3.2.1 2012-12-20 17:35:31 +01:00
Sam Brannen 155aecf557 Fix typo in 3.2 migration guide
- @WebApplicationContext --> @WebAppConfiguration

Backport-Commit: 62e9d6b105
2012-12-17 18:40:54 +01:00
Chris Beams b472fe361d Restore 3.2.0.RELEASE url paths in migration guide 2012-12-13 17:35:15 +01:00
Chris Beams f1550b67fa Update "what's new" in 3.1 and 3.2 sections
- Remove unnecessary "overview of new features" section in 3.1
 - Mention new Gradle build and GitHub-based source control in 3.2
2012-12-13 15:43:02 +01:00
Juergen Hoeller 22e9e0bf03 Minor rewording 2012-12-13 12:20:25 +01:00
Juergen Hoeller 0019d68c75 Final preparations for 3.2 GA 2012-12-13 11:33:35 +01:00
Juergen Hoeller bda07059d0 What's new and migration doc updates 2012-12-13 01:38:13 +01:00
Sam Brannen 59a8da3eff Polish the migration guide
- Added missing <para> tags to the JDiff reports section.

 - Converted tabs to spaces.
2012-12-13 01:14:08 +01:00
Sam Brannen 2775862c50 Update migration guide regarding spring-test
This commit adds information to the 3.2 migration guide regarding
deprecations and Maven dependencies in the spring-test module.
2012-12-13 01:05:15 +01:00
Phillip Webb b3b1fe1566 Update API links in reference documentation
Replace all API links with the correct springsource.org URL
2012-12-12 15:49:00 -08:00
Juergen Hoeller 8aed322284 Final preparations for 3.2 GA 2012-12-13 00:39:55 +01:00
Chris Beams 3458d4d945 Add 'Migrating to Spring Framework 3.2' appendix 2012-12-12 22:45:30 +01:00
Chris Beams a4f882fbf0 Fully qualify Spring=>Spring Framework in ref docs
This is not a comprehensive update, only covering the "What's new"
sections for now.
2012-12-12 22:45:30 +01:00
Rossen Stoyanchev 26b1f44ce7 Update reference doc for async web request config
Issue: SPR-9400
2012-12-12 12:58:47 -05:00
Rossen Stoyanchev c209b6700a Update reference docs on content negotiation config 2012-12-12 12:33:47 -05:00
Chris Beams 4badf2503b Upgrade to AspectJ 1.7.1
This change upgrades the spring-framework build to AspectJ 1.7.1 to
ensure compatibility. We remain backward-compatible to at least AJ
1.6.12 (the previous version), and likely back to 1.6.7.

AJ 1.7 allows for weaving Java 7 bytecode, particularly with regard
to invokedynamic instructions, and furthermore makes improvements to
the aspectj language itself to allow users to take advantage of Java 7-
style language features within aspects. See [1] for details.

[1]: http://eclipse.org/aspectj/doc/released/README-170.html

Issue: SPR-10079
2012-12-12 13:33:21 +01:00
Phillip Webb 6a6b441ffd Document annotation-config / component-scan tip
Document that the <context:annotation-config> element is usually
not required when using <context:component-scan>.

Issue: SPR-9808
2012-12-11 21:38:54 -08:00
Phillip Webb a263fd343d Use consistent XML docbook namespace format
Reorder XML namespace imports for consistency with other docbook
files.
2012-12-11 21:10:05 -08:00
Rossen Stoyanchev e09bdb31cc Add reference documentation for async web requests
Issue: SPR-9400
2012-12-11 23:12:00 -05:00
Juergen Hoeller 5b2cd763cf Final preparations for 3.2 GA 2012-12-12 03:31:39 +01:00
Sam Brannen d4c55838ad Document testing in "New in Spring 3.2" sect.
This commit adds documentation to the "New Features and Enhancements in
Spring 3.2" section of the reference manual regarding new testing
features.

Issue: SPR-9941
2012-12-12 01:38:23 +01:00
Sam Brannen a1053d4364 Document WebApplicationContext support in the TCF
This commit adds documentation for the following new features in the
Spring TestContext Framework within the Testing chapter of the reference
manual.

 - @WebAppConfiguration and context caching
 - WebDelegatingSmartContextLoader
 - AnnotationConfigWebContextLoader
 - GenericXmlWebContextLoader
 - Loading a WebApplicationContext in integration tests
 - ServletTestExecutionListener
 - Testing request and session scoped beans

Issue: SPR-9864
2012-12-12 00:56:26 +01:00
Sam Brannen 7f1b990ee9 Reformat the Testing chapter
Reformatted the Testing chapter in preparation for upcoming changes.
2012-12-11 22:47:44 +01:00
Rossen Stoyanchev acf32726d7 Add documentation for Spring MVC Test
Issue: SPR-9860, SPR-9886
2012-12-11 16:11:47 -05:00
Sam Brannen 4be2d15950 Reformat the Testing chapter
Reformatted the Testing chapter in preparation for upcoming changes.
2012-12-11 22:03:18 +01:00
Rossen Stoyanchev 85a552daed Fix package cycle among http message converters
This change introduces a new AllEncompassingFormHttpMessageConverter
class that adds JSON and XML converters for individual mime parts of
a multi-part request. The new converter is used in place of the
previously used XmlAwareFormHttpMessageConverter.

Issue: SPR-10055
2012-12-07 18:12:11 -05:00
Juergen Hoeller d6b9c6a475 Removed coverage of deprecated java.util.Timer support
Issue: SPR-10050
2012-12-05 19:19:24 +01:00
Sam Brannen 8a422f48c6 Update changelog re: comments in SQL statements
Issue: SPR-9982, SPR-10075
2012-12-05 17:49:47 +01:00
Sam Brannen 2b4ecfad12 Upgrade to JUnit 4.11
This commit upgrades the compile dependency on JUnit in the spring-test
module as well as the global test dependency on JUnit for the entire
test suite to 4.11 GA.

In addition, the spring-test module now depends on junit:junit instead
of junit:junit-dep since, as of JUnit 4.11, the "junit" Maven artifact
no longer inlines hamcrest-core.

Issue: SPR-10044
2012-12-05 11:29:50 +01:00
Phillip Webb 1352222ea6 Upgrade reference plugin and remove custom xsl
Upgrade to docbook-reference-plugin v0.2.2 and remove custom xsl
styles in favor of plugin defaults. Modify some docbook source
files to work with newer style.
2012-12-04 14:08:21 -08:00
Rossen Stoyanchev 7ff964afa8 Add JSON converters to FormHttpMessageConverter
The FormHttpMessageConverter now adds Jackson JSON converters
(version 1.x or 2.x) if available on the classpath.

Issue: SPR-10055
2012-12-03 15:11:13 -05:00
Juergen Hoeller 1b6f3d0352 Preparations for 3.2 GA 2012-11-29 23:28:57 +01:00
Chris Beams 7cc492de4f Update changelog 2012-11-27 10:02:51 +01:00
Juergen Hoeller cf681a809e Final preparations for 3.2 RC2 2012-11-26 22:47:09 +01:00
Phillip Webb 1e48c789da Update whats new in Spring 3.2
Issue: SPR-10015
2012-11-25 23:04:00 -08:00
Phillip Webb 37b0277a89 Restore custom reference manual titlepage
Restore the custom title page of the reference manual in order to
remove the large list of authors on the first page.

Note: This change will require updating to version 0.1.7 of the
docbook-reference-plugin when it is released.

Issue: SPR-10008
2012-11-25 20:22:26 -08:00
Phillip Webb 5a2130ad1a Polish maven samples to xml language
Set the language attribute on the maven <programlisting> elements
in the reference documentation to xml.
2012-11-25 20:13:41 -08:00
Phillip Webb 2b6d724fae Remove xsd versions from reference samples
Remove all xsd versions from the reference manual samples in favor of
"versionless" XSDs. For example, spring-beans-3.0.xsd becomes
spring-beans.xsd

Issue: SPR-10010
2012-11-25 20:00:25 -08:00
Phillip Webb 3749313d2f Drop Appendix E. spring-beans-2.0.dtd from docs
Issue: SPR-10011
2012-11-25 19:31:01 -08:00
Phillip Webb 438c2d8fc2 Update Spring logo in the PDF reference guide 2012-11-25 19:21:27 -08:00
Phillip Webb e0b1c0e614 Remove duplicate imagedata from reference guide
Prior to this commit many imagedata elements were duplicated in
order to configure PDF sizes. Since HTML generation is configured
to ignore image scaling altogether this was unnecessary duplication.

Issue: SPR-10033
2012-11-25 19:16:16 -08:00
Phillip Webb c37080d49d Migrate reference guide to well-formed docbook XML
Convert all docbook XML files to well-formed docbook 5 syntax:
 - Include xsi:schemaLocation element for tools support
 - Convert all id elements to xml:id
 - Convert all ulink elements to link
 - Simplify <lineannotation> mark-up
 - Fix misplaced </section> tags
 - Fix <interface> tags to <interfacename>
 - Cleanup trailing whitespace and tabs

Issue: SPR-10032
2012-11-25 19:02:55 -08:00
Juergen Hoeller 89b443c198 Allow for more async running time in succeedsWhenSubclassProxyAndScheduledMethodNotPresentOnInterface
After all, this test fails quite often as part of the CI build...
2012-11-26 00:54:07 +01:00
Juergen Hoeller 5af1c84b6d Preparations for 3.2 RC2 2012-11-25 23:41:32 +01:00
Sam Brannen 202b15e19b Fix typo and polish formatting 2012-11-25 15:57:15 +01:00
Phillip Webb c5f391550c Document global date time format configuration
Update reference documentation to detail how global date and time
formats can be specified.

Issue: SPR-9952
2012-11-21 20:42:41 -08:00
Phillip Webb fddb829b8b Update Joda Time references in documentation
Update documentation to reflect the fact that Joda Time is no longer
required to use the @DateTimeFormat annotation.
2012-11-21 20:42:40 -08:00
Phillip Webb 0e2904b71a Document cache and jdbc namespaces
Update the XSD section of the document with details of the cache and
jdbc namespace.

Issue: SPR-9824
2012-11-20 18:12:00 -08:00
Phillip Webb 27210ff3cc Polish XML snippets showing XSD imports
Remove <literal> tag from XML samples to improve the look of the
HTML output.
2012-11-20 18:10:04 -08:00
Phillip Webb c20b22a011 Consistent spelling for US/UK words
Replaced behaviour and summarised with US variants that seem to be
more prevalent in the rest of the document.
2012-11-20 16:39:54 -08:00
Phillip Webb d70762baaf Replace reference to aspectjrt with aspectjweaver
Replace reference to aspectjrt.jar with aspectjweaver.jar since
aspectjrt is a subset of aspectjweaver and the full jar is required
by Spring.

Issue: SPR-8896
2012-11-20 16:06:00 -08:00
Phillip Webb 59b27004de Document @Enable* annotations
Update reference manual with details of Java configuration @Enable*
annotations. Examples of Java style @Configuration is provided
when appropriate alongside existing XML samples.

Several existing @Configuration samples have been changed to placing
the @Enable annotation below the @Configuration annotation.
This has been done to provide consistency with existing Javadoc.

Issue: SPR-9920
2012-11-20 12:17:25 -08:00
Rossen Stoyanchev 77223d7ced Deprecate pre 3.1 @MVC support classes
Issue: SPR-10005
2012-11-20 14:59:01 -05:00
Rossen Stoyanchev 2a11007a04 Add Spring Framework integration with Tiles 3
Tiles 3 has modified packages and classes as well as additional
dependencies, notably "tiles-request-api", which is a request/response
abstraction independent of Servlet and JSP APIs.

In order to have both Tiles 2 and Tiles 3 integrations, the source for
the Tiles 3 integration is in a separate project spring-webmvc-tiles3.
The build process merges the compiled Tiles 3 integration classes into
the spring-webmvc module so in effect it contains both the Tiles 2 and
the Tiles 3 integrations.

This change originated as a pull request at spring-framework-issues:
https://github.com/SpringSource/spring-framework-issues/pull/30

And was additionally updated:
1f64be4aa5

Issue: SPR-8825
2012-11-20 12:24:08 -05:00
Juergen Hoeller f00559c440 Initial preparations for 3.2 RC2 2012-11-08 23:48:08 +01:00
Sam Brannen 9a6ec1b4b5 Increase sleep time in ScheduledATAITests
This commit increases the sleep time in
ScheduledAndTransactionalAnnotationIntegrationTests with the hope of
improving the robustness of the test suite on the CI build server.
2012-11-06 18:33:21 +01:00
Phillip Webb 583819ca5f Fix batch operations sample in reference docs
Remove superfluous code from the sample in section 13.4.3 of the
JDBC reference guide.

Issue: SPR-9937
2012-11-05 14:48:15 -08:00
Sam Brannen 85411be31f Update readme.txt regarding changelog location 2012-11-05 00:43:30 +01:00
Chris Beams 08514e25db Update changelog 2012-11-04 13:32:42 +01:00
Phillip Webb e02c309b77 Update changelog 2012-11-03 17:25:56 -07:00
Rossen Stoyanchev f528c39456 Add UnknownHttpStatusCodeException
This is more specific exception raised instead of RestClientException
when the raw HTTP status code received from the server is not one of
the HttpStatus enum values.

Issue: SPR-9406
2012-11-02 13:47:24 -04:00
Sam Brannen 00220ebab0 Fix typo in changelog 2012-10-31 20:35:11 +01:00
Phillip Webb 6c63271f55 Update changelog 2012-10-31 12:08:44 -07:00
Sam Brannen 5b59a25a59 Update changelog
Added missing JIRA issue IDs.
2012-10-31 18:45:31 +01:00
Juergen Hoeller af56b3b7e3 Extended support for meta-annotations etc 2012-10-31 12:11:12 +01:00
Phillip Webb 7fd18298d1 Update changelog 2012-10-28 12:01:39 -07:00
Sam Brannen 397d20b55a Update changelog
Issue: SPR-9593
2012-10-27 21:10:15 +02:00
Sam Brannen acc8364539 Update changelog
Issue: SPR-9724
2012-10-27 18:29:52 +02:00
Rossen Stoyanchev e14ba9dec3 Add config options for MVC async interceptors
The MVC namespace and the MVC Java config now allow configuring
CallableProcessingInterceptor and DeferredResultProcessingInterceptor
instances.

Issue: SPR-9914
2012-10-26 21:29:54 -04:00
Chris Beams 0bd4dab4e3 Filter @Configuration classes out of LTW test
Moving @EnableMBeanExport and its MBeanExportConfiguration
@Configuration class into context.annotation caused a side effect with
ComponentScanningWithLTWTests, which component scans context.annotation
in order to test LTW behavior. Picking up MBeanExportConfiguration
without proper MBean configuration resulted in a NullPointerException
during test execution.

This commit simply filters out all @Configuration classes from the LTW
test's component-scanning directive.

Issue: SPR-8943
2012-10-26 15:47:11 +02:00
Rossen Stoyanchev c7e7e80a3a Update AbstractView with method to set content type
Before this change View implementations set the response content type
to the fixed value they were configured with.

This change makes it possible to configure a View implementation with
a more general media type, e.g. "application/*+xml", and then set the
response type to the more specific requested media type, e.g.
"application/vnd.example-v1+xml".

Issue: SPR-9807.
2012-10-22 17:23:57 -04:00
Phillip Webb ae2d24808c Close 'beans' tag in MVC namespace documentation
Issue: SPR-9898
2012-10-22 09:56:07 -07:00
Rossen Stoyanchev e329698df5 Update changelog 2012-10-22 12:29:44 -04:00
Rossen Stoyanchev 2f504dda3a Update remoting chapter (minor)
Issue: SPR-9822
2012-10-22 11:04:48 -04:00
Sam Brannen c579cd1ce9 Update changelog regarding major new testing features 2012-10-16 16:07:16 -04:00
Juergen Hoeller 15bf31a09e ResourceDatabasePopulator etc 2012-10-11 00:35:03 +02:00
Juergen Hoeller c020096bbd Further changes for 3.2 RC1 2012-10-10 14:28:56 +02:00
Juergen Hoeller 76e28cb08b Initial changelog for 3.2 RC1 2012-09-24 23:16:49 +02:00
Chris Beams 3bebb23f64 Update changelog 2012-09-11 16:56:49 +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 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
Juergen Hoeller 15e384dfd3 updated changelog 2012-09-04 22:40:00 +02:00
Juergen Hoeller bd7a6f658a Typo in ApplicationContextAware and BeanNameAware section
Issue: SPR-9609
2012-08-29 22:00:24 +02:00
Rossen Stoyanchev cb564b287f Provide support for filter registrations
The AbstractDispatcherServletInitializer now provides support for
the registration of filters to be mapped to the DispatcherServlet.
It also sets the asyncSupported flag by default on the
DispatcherServlet and all registered filters.

Issue: SPR-9696
2012-08-28 22:29:23 -04:00
Rossen Stoyanchev 2201dd8c45 Add support for matrix variables
A new @MatrixVariable annotation allows injecting matrix variables
into @RequestMapping methods. The matrix variables may appear in any
path segment and should be wrapped in a URI template for request
mapping purposes to ensure request matching is not affected by the
order or the presence/absence of such variables. The @MatrixVariable
annotation has an optional "pathVar" attribute that can be used to
refer to the URI template where a matrix variable is located.

Previously, ";" (semicolon) delimited content was removed from the
path used for request mapping purposes. To preserve backwards
compatibility that continues to be the case (except for the MVC
namespace and Java config) and may be changed by setting the
"removeSemicolonContent" property of RequestMappingHandlerMapping to
"false". Applications using the  MVC namespace and Java config do not
need to do anything further to extract and use matrix variables.

Issue: SPR-5499, SPR-7818
2012-08-28 13:21:12 -04:00
Rossen Stoyanchev da05b094f5 Polish standard Spring MVC exception handling
Rename ExceptionHandlerSupport to ResponseEntityExceptionHandler and
emphasize the contrast to DefaultHandlerExceptionResovler -- i.e.
one returns a ResponseEntity and relies on message converters while
the other returns a ModelAndView and relies on view resolution.

Issue: SPR-9290
2012-08-27 14:06:06 -04:00
Rossen Stoyanchev b95550489b Add "New in Spring 3.2" section to reference docs 2012-08-23 13:31:32 -04:00
Rossen Stoyanchev b3f0b6e2d6 Fix links in MVC chapter
Issue: SPR-9344
2012-08-22 11:25:29 -04:00
Rossen Stoyanchev af1561634c Allow Errors after @RequestBody and @RequestPart
An @RequestBody or an @RequestPart argument can now be followed by an
Errors/BindingResult argument making it possible to handle validation
errors (as a result of an @Valid annotation) locally within the
@RequestMapping method.

Issue: SPR-7114
2012-08-21 14:34:05 -04:00
Rossen Stoyanchev 1cf4a2facd Add ExceptionHandlerSupport class
The new class is functionally equivalent to the
DefaultHandlerExceptionResolver (i.e. it translates Spring MVC
exceptions to various status codes) but uses an @ExceptionHandler
returning a ResponseEntity<Object>, which means it can be customized to
write error content to the body of the response.

Issue: SPR-9290
2012-08-21 11:32:11 -04:00
Sam Brannen 1f93777bbd Support ApplicationContextInitializers in the TCF
Starting with Spring 3.1 applications can specify
contextInitializerClasses via context-param and init-param in web.xml;
however, there is currently no way to have such initializers invoked in
integration testing scenarios without writing a custom
SmartContextLoader. For comprehensive integration testing it should
therefore be possible to re-use ApplicationContextInitializers in the
Spring TestContext Framework as well.

This commit makes this possible at the @ContextConfiguration level by
allowing an array of ACI types to be specified, and the out-of-the-box
SmartContextLoader implementations invoke the declared initializers at
the appropriate time.

 - Added initializers and inheritInitializers attributes to
   @ContextConfiguration.

 - Introduced support for ApplicationContextInitializers in
   ContextConfigurationAttributes, MergedContextConfiguration, and
   ContextLoaderUtils.

 - MergedContextConfiguration stores context initializer classes as a
   Set and incorporates them into the implementations of hashCode() and
   equals() for proper context caching.

 - ApplicationContextInitializers are invoked in the new
   prepareContext(GenericApplicationContext, MergedContextConfiguration)
   method in AbstractGenericContextLoader, and ordering declared via the
   Ordered interface and @Order annotation is honored.

 - Updated DelegatingSmartContextLoader to support initializers.
   Specifically, a test class may optionally declare neither XML
   configuration files nor annotated classes and instead declare only
   application context initializers. In such cases, an attempt will
   still be made to detect defaults, but their absence will not result
   an an exception.

 - Documented support for application context initializers in Javadoc
   and in the testing chapter of the reference manual.

Issue: SPR-9011
2012-08-20 15:31:46 +02:00
Rossen Stoyanchev e65b930e7a Introduced ControllerAdvice annotation
Classes with this annotation can contain @ExceptionHandler,
@InitBinder, and @ModelAttribute methods that apply to all controllers.
The new annotation is also a component annotation allowing
implementations to be discovered through component scanning.

Issue: SPR-9112
2012-08-14 16:35:37 -04:00
Chris Beams 4e0977ccdd Expand repackaged asm/cglib jars into spring-core
Prior to this change, the repackaged spring-asm and spring-cglib jars
were being included wholesale in the spring-core jar, whereas the
intention was to include the unzipped classfiles.

This change ensures that spring-asm and spring-cglib jars are unzipped
on the fly when creating the spring-core jar.

Issue: SPR-9669
2012-08-11 12:48:45 +02:00
Chris Beams 4691243fb0 Merge branch cbeams/SPR-9669
* SPR-9669:
  Upgrade to CGLIB 3 and inline into spring-core
  Remove spring-asm and inline ASM 4 into spring-core
  Upgrade JarJar to version 1.3
2012-08-10 00:53:23 +02:00
Chris Beams 92500ab902 Upgrade to CGLIB 3 and inline into spring-core
CGLIB 3 has been released in order to depend on ASM 4, which Spring now
depends on internally (see previous commit).

This commit eliminates spring-beans' optional dependency on cglib-nodep
v2.2 and instead repackages net.sf.cglib => org.springframework.cglib
much in the same way we have historically done with ASM.

This change is beneficial to users in several ways:

 - Eliminates the need to manually add CGLIB to the application
   classpath; especially important for the growing number of
   @Configuration class users. Java-based configuration functionality,
   along with proxy-target-class and method injection features now
   work 'out of the box' in Spring 3.2.

 - Eliminates the possibility of conflicts with other libraries that
   may dependend on differing versions of CGLIB, e.g. Hibernate
   3.3.1.ga and its dependency on CGLIB 2.1.3 would easily cause a
   conflict if the application were depending on CGLIB 3 for
   Spring-related purposes.

 - Picks up CGLIB 3's changes to support ASM 4, meaning that CGLIB is
   that much less likely to work well in a Java 7 environment due to
   ASM 4's support for transforming classes with invokedynamic
   bytecode instructions.

On CGLIB and ASM:

  CGLIB's own dependency on ASM is also transformed along the way to
  depend on Spring's repackaged org.springframework.asm, primarily to
  eliminate unnecessary duplication of ASM classfiles in spring-core and
  in the process save around 100K in the final spring-core JAR file size.

  It is coincidental that spring-core and CGLIB currently depend on the
  exact same version of ASM (4.0), but it is also unlikely to change any
  time soon. If this change does occur and versions of ASM drift, then
  the size optimization mentioned above will have to be abandoned. This
  would have no compatibility impact, however, so this is a reasonable
  solution now and for the forseeable future.

On a mysterious NoClassDefFoundError:

  During the upgrade to CGLIB 3.0, Spring test cases began failing due to
  NoClassDefFoundErrors being thrown from CGLIB's DebuggingClassWriter
  regarding its use of asm-util's TraceClassVisitor type. previous
  versions of cglib-nodep, particularly 2.2, did not cause this behavior,
  even though cglib-nodep has never actually repackaged and bundled
  asm-util classes. The reason for these NoClassDefFoundErrors occurring
  now is still not fully understood, but appears to be due to subtle JVM
  bytecode preverification rules. The hypothesis is that due to minor
  changes in DebuggingClassWriter such as additional casts, access to
  instance variables declared in the superclass, and indeed a change in
  the superclass hierarchy, preverification may be kicking in on the
  toByteArray method body, at which point the reference to the missing
  TraceClassVisitor type is noticed and the NCDFE is thrown. For this
  reason, a dummy implementation of TraceClassVisitor has been added to
  spring-core in the org.springframework.asm.util package. This class
  simply ensures that Spring's own tests never result in the NCDFE
  described above, and more importantly that Spring's users never
  encounter the same.

Other changes include:

 - rename package-private Cglib2AopProxy => CglibAopProxy
 - eliminate all 'cglibAvailable' checks, warnings and errors
 - eliminate all 'CGLIB2' language in favor of 'CGLIB'
 - eliminate all mention in reference and java docs of needing to add
   cglib(-nodep) to one's application classpath

Issue: SPR-9669
2012-08-10 00:38:49 +02:00
Chris Beams c16f18a5fd Remove spring-asm and inline ASM 4 into spring-core
ASM 4.0 is generally compatibile with Java 7 classfiles, particularly
including 'invokedynamic' instructions. This is important when
considering that Spring's component-scanning support is internally
ASM-based and it is increasingly likely that component classes having
invokedynamic instructions may be encountered and read by ASM.
This upgrade, then, is primarily preventive in nature.

Changes include:

 - upgrade from ASM 2.2.3 to ASM 4.0

 - adapt to ASM API changes as necessary throughout spring-core,
   resulting in no impact to the public Spring API.

 - remove dedicated spring-asm module

 - use new :spring-core:asmRepackJar task to repackage
   org.objectweb.asm => org.springframework.asm as per usual and write
   repackaged classes directly into spring-core jar

The choice to eliminate the spring-asm module altogether and instead
inline the repackaged classes directly into spring-core is first to
eliminate an otherwise unnecessary second jar. spring-core has a
non-optional dependency on spring-asm meaning it is always on the
application classpath. This change simplifies that situation by
consoliding two jars into one. The second reason for this choice is in
anticipation of upgrading CGLIB to version 3 and inlining it into
spring-core as well. See subsequent commit for details.

Issue: SPR-9669
2012-08-10 00:36:49 +02:00
Andy Clement f5d3cd07e7 Avoid NPE when registering a SpEL MethodFilter
Attempting to register a custom MethodFilter with a
StandardEvaluationContext after invoking setMethodResolvers() with a
custom list of MethodResolver instances results in a
NullPointerException. Based on the current documentation in
StandardEvaluationContext it is unclear what the expected behavior
should be, but either the implementation is broken, or the use case is
unsupported. In either case, allowing a NullPointerException to be
thrown is inappropriate.

This commit documents the fact that the SpEL MethodFilter is intended to
be used with the ReflectiveMethodResolver. Furthermore,
StandardEvaluationContext.registerMethodFilter() now throws an
IllegalStateException if the user attempts to set a filter after having
registered a custom set of resolvers.

Issue: SPR-9621
2012-08-09 23:05:08 +02:00
Andy Clement 75944cc88f Support nested double quotes in SpEL expressions
The Spring Expression Language currently supports nested single quotes
within expressions but not nested double quotes.

The SpEL tokenizer has been modified to support nested double quotes in
the same way it supports single quotes. A sequence of two double quotes
will now be replaced by one when evaluated.

Extra error handling has also been added to report when invalid escaping
is encountered, since SpEL does not support escaping with backslash.

Issue: SPR-9620
2012-08-09 22:12:06 +02:00
Andy Clement 58e6214b7b Support symbolic boolean operators for OR and AND
SpEL typically supports logical operators for boolean expressions
consistent with standard Java language syntax. However, the operators
for logical AND and logical OR are currently only supported as textual
operators. In other words, SpEL does not support the use of && and || as
logical operators.

The SpEL tokenizer has now been modified to recognize && and || as
symbolic boolean operators. The parser has been modified to allow the
use of either the textual or symbolic operators.

Issue: SPR-9614
2012-08-09 21:02:58 +02:00
Sam Brannen 826e565b7c Polish GenericTypeResolver
- renamed resolveParameterizedReturnType() to
   resolveReturnTypeForGenericMethod()
 - fleshed out Javadoc for resolveReturnType() and
   resolveReturnTypeForGenericMethod() regarding declaration of formal
   type variables
 - improved wording in log statements and naming of local variables
   within resolveReturnTypeForGenericMethod()

Issue: SPR-9493
2012-08-05 19:09:38 +02:00
Andy Clement a7418f480c Support case-insensitive null literals in SpEL
Prior to this commit null literals in SpEL expressions had to be
specified as "null" (i.e., all lowercase).

With this commit null literals in SpEL expressions are interpreted in a
case-insensitive manner, analogous to the current support for boolean
literals.

Issue: SPR-9613
2012-08-04 01:47:49 +02:00
Andy Clement e4a926ea3c Modify SpEL Tokenizer to support methods on numbers
When attempting to parse an Integer literal expression such as
42.toString(), SpEL currently throws a SpelParseException with a message
similar to: "EL1041E:(pos 3): After parsing a valid expression, there is
still more data in the expression: 'toString'". The problem here is that
'3.' is currently considered a valid number (including the dot).
However, SpEL succeeds at parsing an equivalent expression for a Double
literal such as 3.14.isInfinite().

To address this issue, the SpEL Tokenizer no longer consumes the
trailing '.' on an integer as part of the integer. So '3.foo()' will now
be parsed as '3' '.' 'foo()' and not '3.' 'foo()' -- which was what
prevented parsing of method invocations on integers. To keep the change
simple, the parser will no longer handle real numbers of the form
'3.e4'. From now on they must include the extra 0 (i.e., '3.0e4').

Issue: SPR-9612
2012-08-04 01:04:29 +02:00
Sam Brannen 015086cb9c Introduce new methods in tx base test classes
Recently new utility methods were added to JdbcTestUtils, and a
JdbcTemplate was introduced in abstract transactional base classes in
the TestContext framework. This presents an easy opportunity to make
these new utility methods available as convenience methods in the base
test classes.

This commit introduces new countRowsInTableWhere() and dropTables()
convenience methods in the abstract transactional base classes in the
TestContext framework. These new methods internally delegate to methods
of the same names in JdbcTestUtils.

Issue: SPR-9665
2012-08-03 22:50:39 +02:00
Sam Brannen 8d9637ada6 Provide JdbcTemplate in tx base classes in the TCF
Since Spring 2.5, the abstract transactional base classes in the
TestContext framework have defined and delegated to a protected
SimpleJdbcTemplate instance variable; however, SimpleJdbcTemplate has
deprecated since Spring 3.1. Consequently, subclasses of
AbstractTransactionalJUnit4SpringContextTests and
AbstractTransactionalTestNGSpringContextTests that use this instance
variable suffer from seemingly unnecessary deprecation warnings.

This commit addresses this issue by introducing a protected JdbcTemplate
instance variable in abstract transactional base classes to replace the
use of the existing SimpleJdbcTemplate. Furthermore, the existing
simpleJdbcTemplate instance variable has been deprecated, and utility
methods in the affected base classes now delegate to JdbcTestUtils
instead of the now deprecated SimpleJdbcTestUtils.

Issue: SPR-8990
2012-08-03 21:59:05 +02:00
Ian Brandt bd0c4b4d99 Deprecate SimpleJdbcTestUtils in favor of JdbcTestUtils
Several static utility methods in SimpleJdbcTestUtils accept an instance
of SimpleJdbcTemplate as an argument; however, SimpleJdbcTemplate has
been deprecated since Spring 3.1 in favor of simply using JdbcTemplate
which now also supports Java 5 language constructs such as var-args.
Consequently, use of such methods from SimpleJdbcTestUtils results in
deprecation warnings without an equivalent API to migrate to.

This commit addresses this issue by migrating all existing methods in
SimpleJdbcTestUtils to JdbcTestUtils. The migrated methods now accept an
instance of JdbcTemplate as an argument, thereby avoiding the
deprecation warnings but maintaining semantic compatibility with the
functionality previous available in SimpleJdbcTestUtils.

In addition, this commit also introduces two new methods:

 - countRowsInTableWhere(): counts the rows in a given table, using
   a provided `WHERE` clause
 - dropTables(): drops the tables with the specified names

Issue: SPR-9235
2012-08-03 20:55:09 +02:00
Sam Brannen f49b22c78f Introduce MockEnvironment in the spring-test module
For legacy reasons, a MockEnvironment implementation already exists in multiple places within Spring's test suite; however, it is not available to the general public.

This commit promotes MockEnvironment to a first-class citizen in the spring-test module, alongside the existing MockPropertySource.

In addition, the following house cleaning has been performed.

 - deleted MockPropertySource from the spring-expression module
 - deleted MockEnvironment from the "spring" integration testing module
 - updated test copies of MockPropertySource and MockEnvironment
 - documented MockEnvironment and MockPropertySource in the testing
   chapter of the reference manual

Issue: SPR-9492
2012-07-28 20:10:21 +02:00
Sam Brannen 2b7a629068 Support TransactionManagementConfigurer in the TCF
Currently the Spring TestContext Framework looks up a
PlatformTransactionManager bean named "transactionManager". The exact
name of the bean can be overridden via @TransactionConfiguration or
@Transactional; however, the bean will always be looked up 'by name'.

The TransactionManagementConfigurer interface that was introduced in
Spring 3.1 provides a programmatic approach to specifying the
PlatformTransactionManager bean to be used for annotation-driven
transaction management, and that bean is not required to be named
"transactionManager". However, as of Spring 3.1.2, using the
TransactionManagementConfigurer on a @Configuration class has no effect
on how the TestContext framework looks up the transaction manager.
Consequently, if an explicit name or qualifier has not been specified,
the bean must be named "transactionManager" in order for a transactional
integration test to work.

This commit addresses this issue by refactoring the
TransactionalTestExecutionListener so that it looks up and delegates to
a single TransactionManagementConfigurer as part of the algorithm for
determining the transaction manager.

Issue: SPR-9604
2012-07-28 01:24:32 +02:00
Sam Brannen f21fe33e74 Support single, unqualified tx manager in the TCF
TransactionalTestExecutionListener currently requires that the
PlatformTransactionManager bean be named "transactionManager" by
default. Otherwise, the bean name can only be overridden via the
transactionManager attribute of @TransactionConfiguration or the value
attribute of @Transactional.

However, if there is only a single PlatformTransactionManager in the
test's ApplicationContext, then the requirement to specify the exact
name of that bean (or to name it exactly "transactionManager") is often
superfluous.

This commit addresses this issue by refactoring the
TransactionalTestExecutionListener so that it is comparable to the
algorithm for determining the transaction manager used in
TransactionAspectSupport for "production" code. Specifically, the TTEL
now uses the following algorithm to retrieve the transaction manager.

 - look up by type and qualifier from @Transactional
 - else, look up by type and explicit name from
   @TransactionConfiguration
 - else, look up single bean by type
 - else, look up by type and default name from @TransactionConfiguration

Issue: SPR-9645
2012-07-28 00:06:46 +02:00
Sam Brannen 37dc211f58 Support named dispatchers in MockServletContext
Currently the getNamedDispatcher(String) method of MockServletContext
always returns null. This poses a problem in certain testing scenarios
since one would always expect at least a default Servlet to be present.
This is specifically important for web application tests that involve
the DefaultServletHttpRequestHandler which attempts to forward to the
default Servlet after retrieving it by name. Furthermore, there is no
way to register a named RequestDispatcher with the MockServletContext.

This commit addresses these issues by introducing the following in
MockServletContext.

 - a new defaultServletName property for configuring the name of the
   default Servlet, which defaults to "default"
 - named RequestDispatchers can be registered and unregistered
 - a MockRequestDispatcher is registered for the "default" Servlet
   automatically in the constructor
 - when the defaultServletName property is set to a new value the
   the current default RequestDispatcher is unregistered and replaced
   with a MockRequestDispatcher for the new defaultServletName

Issue: SPR-9587
2012-07-26 03:06:07 +02:00
Rossen Stoyanchev 64d939bb16 Add ContentNegotiationManagerFactoryBean
The new FactoryBean facilitates the creation of a
ContentNegotiationManager in XML configuration.

Issue: SPR-8420
2012-07-21 06:16:42 -04:00
Rossen Stoyanchev 028e15faa3 Add options to configure content negotiation
The MVC Java config and the MVC namespace now support options to
configure content negotiation. By default both support checking path
extensions first and the "Accept" header second. For path extensions
.json, .xml, .atom, and .rss are recognized out of the box if the
Jackson, JAXB2, or Rome libraries are available. The ServletContext
and the Java Activation Framework may be used as fallback options
for path extension lookups.

Issue: SPR-8420
2012-07-20 21:32:02 -04:00
Rossen Stoyanchev 92759ed1f8 Add exclude patterns for mapped interceptors
Add the ability provide exclude patterns for mapped interceptors in the
MVC namespace and in the MVC Java config.

Issue: SPR-6570
2012-07-20 14:47:46 -04:00
Rossen Stoyanchev 6cc512b51c Ensure async Callables are in sync with the call stack
After this change each call stack level pushes and pops an async
Callable to ensure the AsyncExecutionChain is in sync with the
call stack. Before this change, a controller returning a "forward:"
prefixed string caused the AsyncExecutionChain to contain a
extra Callables that did not match the actual call stack.

Issue: SPR-9611
2012-07-20 12:50:01 -04:00
Sam Brannen 33a3681975 Fix DeferredResult typo in changelog 2012-07-18 13:08:59 -04:00
Rossen Stoyanchev d3d00696a4 Create StandardServletAsyncWebRequest via reflection
Issue: SPR-9500
2012-07-18 10:02:15 -04:00
Rossen Stoyanchev eab6e1d134 Parameterize DeferredResult
Issue: SPR-9579
2012-07-18 09:43:03 -04:00
Rossen Stoyanchev 55bd99fa16 Fix typos in Spring MVC chapter of reference docs 2012-07-17 16:46:50 -04:00
Rossen Stoyanchev 67a05e4185 Update section on exception handling MVC chapter
Update section on exception handling in Spring MVC chapter to include
more guidance on exception handling when implementing a REST API.

Issue: SPR-9290
2012-07-10 19:13:10 -04:00
Rossen Stoyanchev a1b7a314c1 Add BindException to DefaultHandlerExceptionResolver
Previously DefaultHandlerExceptionResolver did not handle BindException
but after this change it does. A BindException is raised when an
@ModelAttribute annotated argument is not followed by a BindingResult
argument. Hence this is unlikely to affect browser rendering.
For programmatic clients however this change ensures an unhandled
BindException is at least turned into a 400 error.

Issue: SPR-9310
2012-07-10 17:32:13 -04:00
Rossen Stoyanchev e860fa9a8b Move feed message converters ahead of jackson/jaxb2
The Atom/RSS message converters are now registered ahead of the
Jackson and the JAXB2 message converters by default. Since the Atom
and RSS converters convert to and from very specific object types
Feed and Channel respectively, that shouldn't introduce any regressions
and will work more intuitively when the requested media type is "*/*".

Issue: SPR-9054
2012-07-10 17:12:06 -04:00
Rossen Stoyanchev c846198e46 Add support for global @ExceptionHandler methods
Before this change @ExceptionHandler methods could be located in and
apply locally within a controller. The change makes it possible to have
such methods applicable globally regardless of the controller that
raised the exception.

The easiest way to do that is to add them to a class annotated with
`@ExceptionResolver`, a new annotation that is also an `@Component`
annotation (and therefore works with component scanning). It is also
possible to register classes containing `@ExceptionHandler` methods
directly with the ExceptionHandlerExceptionResolver.

When multiple `@ExceptionResolver` classes are detected, or registered
directly, the order in which they're used depends on the the `@Order`
annotation (if present) or on the value of the order field (if the
Ordered interface is implemented).

Issue: SPR-9112
2012-07-09 17:27:03 -04:00
Juergen Hoeller ccd2da37ce preparations for 3.2 M2 2012-07-06 22:47:46 +02:00
Rossen Stoyanchev a4240d2864 Add defaultCharset field to StringHttpMessageConverter
Before this change the StringHttpMessageConverter used a fixed charset
"ISO-8859-1" if the requested content type did not specify one. This
change adds a defaultCharset field and a constructor to configure it in
StringHttpMessageConverter.

Issue: SPR-9487
2012-07-05 15:53:49 -04:00
Juergen Hoeller 4d297b475c preparations for 3.2 M2 2012-07-05 00:50:35 +02:00
Rossen Stoyanchev 4fd7645efd Enable smart suffix pattern match for request mapping
Following the introduction of ContentNegotiationManager that allows,
among other things, to configure the file extensions to use for content
negotiation, this change adds "smart" suffix pattern match that matches
against the configured file extensions only rather than against any
extension.

Given the request mapping "/jobs/{jobName}" and one configured file
extension ("json"), a request for "/jobs/my.job" will select the
pattern "/jobs/{jobName}" while a request for "/jobs/my.job.json" will
select the pattern "/jobs/{jobName}.json". Previously, both requests
would have resulted in the pattern "/jobs/{jobName}.*".

Issue: SPR-7632, SPR-8474
2012-06-25 21:30:10 -04:00
Rossen Stoyanchev a0747458e7 Add support for HTTP PATCH method
The HTTP PATCH method is now supported whereever HTTP methods are used.
Annotated controllers can be mapped to RequestMethod.PATCH.

On the client side the RestTemplate execute(..) and exchange(..)
methods can be used with HttpMethod.PATCH. In terms of HTTP client
libraries, Apache HttpComponents HttpClient version 4.2 or later is
required (see HTTPCLIENT-1191). The JDK HttpURLConnection does not
support the HTTP PATCH method.

Issue: SPR-7985
2012-06-22 16:57:22 -04:00
Rossen Stoyanchev f05e2bc56f Add abstractions for content negotiation
Introduced ContentNeogtiationStrategy for resolving the requested
media types from an incoming request. The available implementations
are based on path extension, request parameter, 'Accept' header,
and a fixed default content type. The logic for these implementations
is based on equivalent options, previously available only in the
ContentNegotiatingViewResolver.

Also in this commit is ContentNegotiationManager, the central class to
use when configuring content negotiation options. It accepts one or
more ContentNeogtiationStrategy instances and delegates to them.

The ContentNeogiationManager can now be used to configure the
following classes:

- RequestMappingHandlerMappingm
- RequestMappingHandlerAdapter
- ExceptionHandlerExceptionResolver
- ContentNegotiatingViewResolver

Issue: SPR-8410, SPR-8417, SPR-8418,SPR-8416, SPR-8419,SPR-7722
2012-06-22 11:55:46 -04:00
Sam Brannen 027e49c58a Document default scripts for embedded databases
The reference manual currently documents the wrong file name for the
default data SQL script used by EmbeddedDatabaseBuilder. In addition,
the testing chapter of the reference manual does not link to the testing
section of the JDBC chapter.

 - Updated the "Testing data access logic with an embedded database"
   section of the reference manual appropriately.
 - Added a new paragraph to the "JDBC Testing Support" section of the
   testing chapter which cross references the "Testing data access logic
   with an embedded database" section.

Issue: SPR-9467
2012-06-19 20:48:07 +02:00
Sam Brannen 5eae22abb8 Document SPR-9493 in the changelog
Issue: SPR-9493
2012-06-19 20:13:46 +02:00
Chris Beams de04d9c654 Fix typo in MessageSource reference docs
Issue: SPR-5022
2012-06-19 11:56:05 +02:00
Dmitry Katsubo aa415d7c0c BeanFactory for configuring a Jackson ObjectMapper
The BeanFactory makes it easier to configure a customized Jackson
ObjectMapper (for example enable/disable certain features).
This bean factory is usually used with
MappingJacksonHttpMessageConverter or MappingJacksonJsonView.
See JavaDoc for examples.

Issue: SPR-9125
2012-06-18 17:12:09 -04:00
Rossen Stoyanchev ab4952a959 Raise RestClientException for unknown status codes
HttpStatus cannot be created with an unknown status code. If a server
returns a status code that's not in the HttpStatus enum values, an
IllegalArgumentException is raised. Rather than allowing it to
propagate as such, this change ensures the actual exception raised is
a RestClientException.

Issue: SPR-9406
2012-06-13 08:27:16 -04:00
Sam Brannen 369d77bdf0 spring-test module now depends on junit:junit-dep
The junit:junit Maven artifact includes a bundled version of hamcrest
core. For projects that depend on later versions of hamcrest this causes
significant issues in terms of dependency management.

The spring-test module now depends on junit:junit-dep, thus allowing
developers to better manage their test dependencies on a more fine
grained level.

Also tidied up dependency issues regarding hamcrest-core and
hamcrest-all across the build.

Issue: SPR-6966
2012-06-10 02:39:27 +02:00
Chris Beams f582974b0c Update 3.2 M1 changelog 2012-05-28 11:08:41 +03:00
Sam Brannen 155b88ffce Improve dependency management for spring-test
In Spring 3.1 the spring-test Maven artifact did not have a required
dependency on spring-core, but there is practically no part of
spring-test that can be used without spring-core. Most test utilities
that are intended to be stand-alone utilities in fact use utility
classes from spring-core (e.g., ReflectionTestUtils). Even some of the
web mocks/stubs use spring-core (e.g., DelegatingServletInputStream).

In addition, the current Gradle build configuration for the spring-test
module is very simplistic -- in that it does not explicitly list any
optional dependencies such as the Servlet and Portlet APIs -- and it
defines a 'compile' dependency on spring-webmvc-portlet.

The resulting Maven dependencies in the generated POM are therefore not
what a typical consumer of the spring-test artifact would reasonably
expect.

To address these issues, the Gradle build configuration for the
spring-test module now explicitly defines the following 'compile'
dependencies:

 - spring-core
 - spring-webmvc, optional
 - spring-webmvc-portlet, optional
 - junit, optional
 - testng, optional
 - servlet-api, optional
 - jsp-api, optional
 - portlet-api, optional
 - activation, provided

The only required dependency is now spring-core; all other dependencies
are 'optional'.

Issue: SPR-8861
2012-05-28 11:08:41 +03:00
Chris Beams 2a2b6eef91 Introduce ConfigurableWebEnvironment
Changes introduced in Spring 3.1 for Environment support inadvertently
established a cyclic dependency between the
org.springframework.web.context and
org.springframework.web.context.support packages, specifically through
web.context.ContextLoader's invocation of
web.context.support.WebApplicationContextUtils#initServletPropertySources.

This commit introduces ConfigurableWebEnvironment to break this cyclic
dependency. All web.context.ConfigurableWebApplicationContext types now
return web.context.ConfigurableWebEnvironment from their #getEnvironment
methods; web.context.support.StandardServletEnvironment now implements
ConfigurableWebEnvironment and makes the call to
web.context.support.WebApplicationContextUtils#initServletPropertySources
within its implementation of #initPropertySources. This means that
web.context.ContextLoader now invokes
web.context.ConfigurableWebEnvironment#initPropertySources instead of
web.context.support.WebApplicationContextUtils#initServletPropertySources
and thus the cycle is broken.

Issue: SPR-9439
2012-05-26 14:35:57 +03:00
Chris Beams 53673d6c59 Support initial delay attribute for scheduled tasks
java.util.concurrent's ScheduledExecutorService and its #schedule*
methods allow for an 'initialDelay' parameter in milliseconds.
Similarly, Spring's TaskExecutor abstraction allows for a concrete
'startTime' expressed as a Date. However, Spring's <task:scheduled> XML
element and @Scheduled annotation have, to date, not allowed for an
initial delay parameter that can be propagated down to the underlying
TaskScheduler/ScheduledExecutorService.

This commit introduces initial-delay and #initialDelay attributes to
task:scheduled and @Scheduled respectively, both indicating the number
of milliseconds to wait before the first invocation of the method in
question. Specifying a delay in this fashion is only valid in
conjunction with fixed-rate and fixed-delay tasks (i.e. not with cron
or trigger tasks).

The principal changes required to support these new attributes lie in
ScheduledTaskRegistrar, which previously supported registration of
tasks in the form of a Runnable and a Long parameter indicating (in the
case of fixed-rate and fixed-delay tasks), the interval with which the
task should be executed. In order to accommodate a third (and optional)
'initialDelay' parameter, the IntervalTask class has been added as a
holder for the Runnable to be executed, the interval in which to run
it, and the optional initial delay. For symmetry, a TriggerTask and
CronTask have also been added, the latter subclassing the former. And a
'Task' class has been added as a common ancestor for all the above.

One oddity of the implementation is in the naming of the new
setters in ScheduledTaskRegistrar. Prior to this commit, the setters
were named #setFixedDelayTasks, #setFixedRateTasks, etc, each accepting
a Map<Runnable, long>. In adding new setters for each task type, each
accepting a List<IntervalTask>, List<CronTask> etc, naturally the
approach would be to use method overloading and to introduce methods
of the same name but with differing parameter types. Unfortunately
however, Spring does not support injection against overloaded methods
(due to fundamental limitations of the underlying JDK Introspector).
This is not a problem when working with the ScheduledTaskRegistrar
directly, e.g. from within a @Configuration class that implements
SchedulingConfigurer, but is a problem from the point of view of the
ScheduledTasksBeanDefinitionParser which parses the <task:scheduled>
element - here the ScheduledTaskRegistrar is treated as a Spring bean
and is thus subject to these limitations. The solution to this problem
was simply to avoid overloading altogether, thus the naming of the new
methods ending in "List", e.g. #setFixedDelayTasksList, etc. These
methods exist primarily for use by the BeanDefinitionParser and are
not really intended for use by application developers. The Javadoc for
each of the new methods makes note of this.

Issue: SPR-7022
2012-05-22 17:48:00 +03:00
Chris Beams 4d5fe57a08 Polish scheduled task execution infrastructure
In anticipation of substantive changes required to implement "initial
delay" support in the <task:scheduled> element and @Scheduled
annotation, the following updates have been made to the components and
infrastructure supporting scheduled task execution:

 - Fix code style violations
 - Fix compiler warnings
 - Add Javadoc where missing, update to use {@code} tags, etc.
 - Organize imports to follow conventions
2012-05-22 17:47:43 +03:00
Arjen Poutsma f64c13ad2e Add convenient WebAppInitializer base classes
This commit introduces three abstract WebApplicationInitializers, to be
used in the typical setup of a Spring-based web application.

 - AbstractContextLoaderInitializer provides an abstract base class for
   registering a ContextLoaderListener.

 - AbstractDispatcherServletInitializer provides an abstract base class
   for registering a DispatcherServlet, with an optional root context.

 - AbstractAnnotationConfigDispatcherServletInitializer provides an
   abstract base class for registering a DispatcherServlet and optional
   ContextLoaderListener based on annotated (e.g. @Configuration)
   classes.

Issue: SPR-9300
2012-05-22 17:31:55 +03:00
Chris Beams ed0576c181 Support executor qualification with @Async#value
Prior to this change, Spring's @Async annotation support was tied to a
single AsyncTaskExecutor bean, meaning that all methods marked with
@Async were forced to use the same executor. This is an undesirable
limitation, given that certain methods may have different priorities,
etc. This leads to the need to (optionally) qualify which executor
should handle each method.

This is similar to the way that Spring's @Transactional annotation was
originally tied to a single PlatformTransactionManager, but in Spring
3.0 was enhanced to allow for a qualifier via the #value attribute, e.g.

  @Transactional("ptm1")
  public void m() { ... }

where "ptm1" is either the name of a PlatformTransactionManager bean or
a qualifier value associated with a PlatformTransactionManager bean,
e.g. via the <qualifier> element in XML or the @Qualifier annotation.

This commit introduces the same approach to @Async and its relationship
to underlying executor beans. As always, the following syntax remains
supported

  @Async
  public void m() { ... }

indicating that calls to #m will be delegated to the "default" executor,
i.e. the executor provided to

  <task:annotation-driven executor="..."/>

or the executor specified when authoring a @Configuration class that
implements AsyncConfigurer and its #getAsyncExecutor method.

However, it now also possible to qualify which executor should be used
on a method-by-method basis, e.g.

  @Async("e1")
  public void m() { ... }

indicating that calls to #m will be delegated to the executor bean
named or otherwise qualified as "e1". Unlike the default executor
which is specified up front at configuration time as described above,
the "e1" executor bean is looked up within the container on the first
execution of #m and then cached in association with that method for the
lifetime of the container.

Class-level use of Async#value behaves as expected, indicating that all
methods within the annotated class should be executed with the named
executor. In the case of both method- and class-level annotations, any
method-level #value overrides any class level #value.

This commit introduces the following major changes:

 - Add @Async#value attribute for executor qualification

 - Introduce AsyncExecutionAspectSupport as a common base class for
   both MethodInterceptor- and AspectJ-based async aspects. This base
   class provides common structure for specifying the default executor
   (#setExecutor) as well as logic for determining (and caching) which
   executor should execute a given method (#determineAsyncExecutor) and
   an abstract method to allow subclasses to provide specific strategies
   for executor qualification (#getExecutorQualifier).

 - Introduce AnnotationAsyncExecutionInterceptor as a specialization of
   the existing AsyncExecutionInterceptor to allow for introspection of
   the @Async annotation and its #value attribute for a given method.
   Note that this new subclass was necessary for packaging reasons -
   the original AsyncExecutionInterceptor lives in
   org.springframework.aop and therefore does not have visibility to
   the @Async annotation in org.springframework.scheduling.annotation.
   This new subclass replaces usage of AsyncExecutionInterceptor
   throughout the framework, though the latter remains usable and
   undeprecated for compatibility with any existing third-party
   extensions.

 - Add documentation to spring-task-3.2.xsd and reference manual
   explaining @Async executor qualification

 - Add tests covering all new functionality

Note that the public API of all affected components remains backward-
compatible.

Issue: SPR-6847
2012-05-20 15:18:10 +03:00
Sam Brannen e71cd06a46 Doc. usage of JSR-250 lifecycle annotations in TCF
The reference manual previously did not mention the applicability of
JSR-250 lifecycle annotations within the TestContext framework. The
lacking documentation here has lead to misunderstandings of the support
provided for @PostConstruct and @PreDestroy in test classes.

The testing chapter of the reference manual has therefore been updated
to explicitly define the limited support for these annotations.

Also introduced Jsr250LifecycleTests for empirical verification of the 
expected behavior.

Issue: SPR-4868
2012-05-19 04:03:40 +02:00
Sam Brannen 49966258f1 Polish doc for 'annotated class' support in TCF
Revised the content in the @ContextConfiguration annotation section.

Issue: SPR-9401
2012-05-18 17:15:38 +02:00
Sam Brannen 504cdf498e Update documentation of 'annotated class' support in the TCF
Updated the testing chapter of the reference manual to refer to 
'annotated classes' instead of 'configuration classes' where 
appropriate.

Also revised the content and examples in the @ContextConfiguration 
annotation section, mentioned Gradle, and reformatted the entire text.

Issue: SPR-9401
2012-05-18 04:33:40 +02:00
Rossen Stoyanchev 77ae101402 Add required flag to @RequestBody
If true and there is no body => HttpMessageNotReadableException
If false and there is no body, the argument resolves to null.

Issue: SPR-9239
2012-05-17 17:48:48 -04:00
Rossen Stoyanchev 57307a0b2e Decode path vars when url decoding is turned off
When URL decoding is turned off in AbstractHandlerMapping, the
extracted path variables are also not encoded. Turning off URL decoding
may be necessary for request mapping to work correctly when the path
may contain the (encoded) special character '/'. At the same time there
is no good reason not to leave path variables encoded. This change
ensures path variables are encoded when URL decoding is turned off.

Issue: SPR-9098
2012-05-17 16:01:20 -04:00
Rossen Stoyanchev 01a9dd9772 Add option to set Content-Length in JSON Views
MappingJackson2JsonView and MappingJacksonJsonView now provide an
option that will set the Content-Length header of JSON responses.
Use of the option implies buffering of the response and it must be
enabled explicitly.

Issue: SPR-7866
2012-05-15 18:10:24 -04:00
Rossen Stoyanchev 2af294ab26 Add MessageCodesResolver hook to WebMvcConfigurer
This change makes it possible to provide a custom MessageCodesResolver
through the MVC Java config whether using @EnableWebMvc and extending
WebMVcConfigurerAdapter or sub-classing directly from
WebMvcConfigurationSupport.

Issue: SPR-9223
2012-05-15 17:11:28 -04:00
Chris Beams 9c223c1780 Fix broken link to JavaBean customization tutorial
Issue: SPR-9408
2012-05-15 22:51:46 +03:00
Rossen Stoyanchev bdc3599d3d Add CompositeRequestCondition
The new type makes it easier providing multiple custom request mapping
conditions via setters on RequestMappingHandlerMapping.

Issue: SPR-9350
2012-05-15 13:16:06 -04:00
Rossen Stoyanchev fbb2103e4d Add "excludedExceptions" to SimpleUrlHandlerMapping
The new property can be used to ignore specific exceptions that may
otherwise be matched by the "exceptionMappings" property or resolved
through the defaultErrorView.

Issue: SPR-5193
2012-05-15 13:16:06 -04:00
Sam Brannen 1167155182 Update reference manual regarding upgrade to JUnit 4.10 2012-05-15 14:40:13 +02:00
Sam Brannen 50d4ebcc71 Fix typo in section id 2012-05-15 14:25:10 +02:00
Oliver Gierke 2a75c57d3c Add missing section ids in reference documentation
Add missing id attributes to <section> elements in the reference
documentation to ensure stable anchor links in HTML output.

Issue: SPR-9346
2012-05-15 13:23:32 +03:00
Rossen Stoyanchev 1d0e484eac Support access to all URI vars via @PathVariable Map
Issue: SPR-9289
2012-05-14 16:01:16 -04:00
Rossen Stoyanchev 698d004260 Deprecate HttpStatus codes 419, 420, 421
Issue: SPR-7942
2012-05-14 14:34:33 -04:00
Chin Huang f1c062fe9e Fix typos in Reference Documentation 2012-05-12 00:53:51 -04:00
Rossen Stoyanchev d52fc3bd2f Prevent response updates if @ResponseStatus has reason
When @ResponseStatus has a reason and servletResponse.sendError() is
called, the response is committed and should no longer be written to.
After this change, the ServletInvocableHandlerMethod will mark the
response fully handled and will ignore any non-null return values.

Issue: SPR-9159
2012-05-11 17:41:14 -04:00
Sam Brannen 897f6d6c68 Update changelog regarding upgrade to JUnit 4.10 and TestNG 6.5.2 2012-05-11 21:02:25 +02:00
Rossen Stoyanchev 982cb2f258 Fix content negotiation issue with sort by q-value
Before this fix the q-value of media types in the Accept header were
ignored when using the new RequestMappingHandlerAdapter in combination
with @ResponseBody and HttpMessageConverters.

Issue: SPR-9160
2012-05-11 14:43:58 -04:00
Rossen Stoyanchev 816c1f47a4 Translate EOF to HttpMessageNotReadableException
The MappingJacksonHttpMessageConverter now catches all IOException
types raised while reading JSON and translates them into
HttpMessageNotReadableException.

Issue: SPR-9238
2012-05-10 17:17:29 -04:00
Rossen Stoyanchev d7efc0db80 Detect controller methods via InitializingBean hook
Previously RequestMappingHandlerMapping detected @RequestMapping
methods through an initApplicationContext() hook. However, the
HandlerMapping may not have been fully set up with all its
dependencies at that point including settings like useSuffixPattern
and others.

This change moves the detection @RequestMapping methods to an
InitializingBean.afterPropertiesSet() hook.

Issue: SPR-9371
2012-05-10 16:42:36 -04:00
Rossen Stoyanchev c499df2315 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
2012-05-10 16:01:14 -04:00
Rossen Stoyanchev e63ca04fdb Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids.
This change adds Jackson 2 as an optional dependency and also provides
MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use
with the new version.

The MVC namespace and the MVC Java config detect and use
MappingJackson2HttpMessageConverter if Jackson 2 is present.
Otherwise if Jackson 1.x is present,
then MappingJacksonHttpMessageConverter is used.

Issue: SPR-9302
2012-05-09 13:07:25 -04:00
Rossen Stoyanchev a33fe6fa0a Fix issue with encoded params in UriComponentsBuilder
The fromUri method of UriComponentsBuilder used uri.getXxx() methods,
which decode the URI parts causing URI parsing issues. The same method
now uses uri.getRawXxx().

Issue: SPR-9317
2012-05-01 16:10:38 -04:00
Rossen Stoyanchev 3642b0f365 Initial cut of Servlet 3.0 based async support
From a programming model perspective, @RequestMapping methods now
support two new return value types:

* java.util.concurrent.Callable - used by Spring MVC to obtain the
return value asynchronously in a separate thread managed transparently
by Spring MVC on behalf of the application.
* org.springframework.web.context.request.async.DeferredResult - used
by the application to produce the return value asynchronously in a
separate thread of its own choosing.

The high-level idea is that whatever value a controller normally
returns, it can now provide it asynchronously, through a Callable or
through a DeferredResult, with all remaining processing --
@ResponseBody, view resolution, etc, working just the same but
completed outside the main request thread.

From an SPI perspective, there are several new types:

* AsyncExecutionChain - the central class for managing async request
processing through a sequence of Callable instances each representing
work required to complete request processing asynchronously.
* AsyncWebRequest - provides methods for starting, completing, and
configuring async request processing.
* StandardServletAsyncWebRequest - Servlet 3 based implementation.
* AsyncExecutionChainRunnable - the Runnable used for async request
execution.

All spring-web and spring-webmvc Filter implementations have been
updated to participate in async request execution.
The open-session-in-view Filter and interceptors implementations in
spring-orm will be updated in a separate pull request.

Issue: SPR-8517
2012-04-18 16:36:09 -04:00
Chris Beams 57b89e0388 Fix typo in ApplicationContext reference doc 2012-04-16 13:36:12 +03:00
Chris Beams 0ab9e9a0c6 Upgrade AspectJ from 1.6.8 to 1.6.12
- Spring remains compatible against AJ version 1.6.8, but is now
   compiling and testing against 1.6.12

 - Encountered what appears to be an AJ bug introduced in 1.6.10: an
   assertion in org.aspectj.weaver.UnresolvedType causes a false
   negative failure when encountering org.springframework.io.Resource
   arrays, e.g. "[org.springframework.io.Resource@xxx". This problem
   has been reported to the AJ team and in the meantime, the recommended
   workaround is to disable assertions either completely, or at least
   selectively with

       -disableassertions:org.aspectj.weaver.UnresolvedType

Issue: SPR-7989, SPR-9272
2012-04-14 19:05:20 +03:00
Chris Beams f6003b5102 Fix typo in reference documentation
Issue: SPR-9321
2012-04-13 20:41:37 +03:00
Rossen Stoyanchev cfe2af7690 Use the type of the actual return value in @MVC
The new @MVC support classes select a HandlerMethodArgumentResolver
and a HandlerMethodReturnValueHandler statically, i.e. based on
the signature of the method, which means that a controller method
can't declare a more general return type like Object but actually
return a more specific one, e.g.  String vs RedirectView, and
expect the right handler to be used.

The fix ensures that a HandlerMethodReturnValueHandler is selected
based on the actual return value type, which is something that was
supported with the old @MVC support classes. One consequence
of the change is the selected HandlerMethodReturnValueHandler can
no longer be cached but that matches the behavior of the old
@MVC support classes.

Issues: SPR-9218
2012-04-06 16:50:22 -04:00
Rossen Stoyanchev ca8b98e947 Fix issue with parsing media types
Invalid Content-Type or Accept header values previously resulted in the
IllegalArgumentException getting propagated. After this change such
errors are detected and generally treated as a "no match", which
may for example result in a 406 in the case of the Accept header.

Issue: SPR-9148
2012-04-02 17:36:23 -04:00
Stevo Slavic 924c869b8a Remove note on singleton-scoped proxy raising BCE
Before this change bean scopes chapter in Spring reference documentation
had a note which mentioned that creating a scoped proxy for singleton-
or prototype-scoped beans will throw BeanCreationException.

This is no longer the case and this change removes the mentioned note.

Issue: SPR-7940
2012-03-01 12:29:40 +01:00
Phani Kandula 00d9c3f5e8 Fix typo in spring:eval taglib reference doc
- Replace 'javascriptEncoding' with 'javaScriptEscape'

Issue: SPR-9188
2012-03-01 12:12:52 +01:00
Phani Kandula 6c602d7bbc Fix typo in ApplicationContext reference doc
- Add missing '=' sign in sample code for section 4.2.3

Issue: SPR-8856
2012-03-01 12:12:45 +01:00
Chris Beams 37d547c506 Sync with 3.1.x
* 3.1.x:
  Warn re Environment construction and instance vars
  Disallow empty @PropertySource(value = {})
  Fix @PropertySource bug with multiple values
  final preparations for 3.1.1 release
  added "receive-timeout" attribute to "jms:listener-container" element
2012-02-20 14:19:04 +01:00
Chris Beams 3e81482760 Sync with 3.1.x
* 3.1.x:
  Demonstrate use of @Configuration as meta-annotation
  Prune dead code from JmsTransactionManager#doBegin
  Apply @Configuration BeanNameGenerator consistently
  Improve @Configuration bean name discovery
  Fix infinite recursion bug in nested @Configuration
  Polish static imports
  Minor fix in ServletResponseMethodArgumentResolver
  extracted ResourceUtils.useCachesIfNecessary(URLConnection) method (SP
  prepared for 3.1.1 release
  CustomSQLExceptionTranslatorRegistry/Registrar etc
  revised CustomSQLExceptionTranslatorRegistry/Registrar method naming
  use custom InputStream traversal instead of a full byte array (SPR-911
  PathMatchingResourcePatternResolver preserves caching for JNLP jar con
  Resource "contentLength()" implementations work with OSGi bundle resou
  fixed MethodInvokingJobDetailFactoryBean for compatibility with Quartz
  fixed MethodInvokingJobDetailFactoryBean for compatibility with Quartz
2012-02-16 13:00:28 +01:00
Chris Beams ee36c80ca9 Sync with 3.1.x
* 3.1.x: (61 commits)
  Compensate for changes in JDK 7 Introspector
  Avoid 'type mismatch' errors in ExtendedBeanInfo
  Polish ExtendedBeanInfo and tests
  Infer AnnotationAttributes method return types
  Minor fix in MVC reference doc chapter
  Hibernate 4.1 etc
  TypeDescriptor equals implementation accepts annotations in any order
  "setBasenames" uses varargs now (for programmatic setup; SPR-9106)
  @ActiveProfiles mechanism works with @ImportResource as well (SPR-8992
  polishing
  clarified Resource's "getFilename" method to consistently return null
  substituteNamedParameters detects and unwraps SqlParameterValue object
  Replace spaces with tabs
  Consider security in ClassUtils#getMostSpecificMethod
  Adding null check for username being null.
  Improvements for registering custom SQL exception translators in app c
  SPR-7680 Adding QueryTimeoutException to the DataAccessException hiera
  Minor polish in WebMvcConfigurationSupport
  Detect overridden boolean getters in ExtendedBeanInfo
  Polish ExtendedBeanInfoTests
  ...
2012-02-13 15:17:30 +01:00
Chris Beams 0ae973f995 Merge branch '3.1.x'
Conflicts:
	spring-webmvc/src/main/java/org/springframework/web/servlet/support/DefaultFlashMapManager.java
	spring-webmvc/src/test/java/org/springframework/web/servlet/support/DefaultFlashMapManagerTests.java
2012-02-01 11:39:48 +01:00
Chris Beams 398cf997b3 Merge branch '3.1.x'
This is the first merge from 3.1.x => master after the Gradle build
system migration. Notice how files changed under the 3.1.x directory
structure (org.springframework.*) merge seamlessly into the new
directory structure (spring-*).

Certain files had changed under 3.1.x that have since been deleted with
the Gradle build migration, e.g. all pom.xml files had <license>
sections added. These files showed up as a conflict during the merge,
but the resolution is to simply re-remove them and commit as they are
no longer relevant under 3.2.x / master.

Also noteworthy is the .gitignore file. It has been updated under 3.1.x
to ignore files and directories specific to the new Gradle-based
structure. However, this causes conflicts when trying to merge against
master, given that master should *not* ignore this directories. The
resolution in this situation is to simply force the 'master' version of
the file, i.e. when prompted for merge resolution:

    anakata:~/Work/spring-framework/spring-framework[master|MERGING]
    $ git status -sb
    ## master...springsource/master [ahead 24]
    UU .gitignore

    anakata:~/Work/spring-framework/spring-framework[master|MERGING]
    $ git checkout master .gitignore

    anakata:~/Work/spring-framework/spring-framework[master|MERGING]
    $ git commit

It is helpful in situations like this one to enable git's "rerere"
feature beforehand, which records and remembers resolution strategies,
avoiding the need to repeat them in future merges:

    $ git config --global rerere.enabled 1

See:
    http://progit.org/2010/03/08/rerere.html
    http://gitfu.wordpress.com/2008/04/20/git-rerere-rereremember-what-you-did-last-time

Conflicts:
    .gitignore
    .springframework.*/pom.xml
2012-01-31 16:03:24 +01:00
Chris Beams 366f0d7892 Generate -sources and -javadoc jars
Each spring-* subproject now has sourcesJar and javadocJar tasks

 - Ignore subproject overview.html files for now (not all have one)
 - Ensure @author attribution occurs
 - Javadoc 'header' is project description

spring-asm is a special case

 - source jar is created, but empty (to comply with entry rules for
   Maven Central)

 - add package-info.java explaining the nature of spring-asm
   this is nice, because it shows up in the public API docs now.

 - add SpringAsmInfo in the org.springframework.asm package as a
   placeholder allowing the generation of javadocs (see link to bug)

 - add explicit 'repackageAsm' Gradle task allowing for easy testing
   and merging of jar containing bundlor manifest as well as jar
   containing repackaged ASM classes.
2012-01-31 14:32:16 +01:00
Chris Beams 2bab8f3c0b Generate -docs, -schema and -dist zips
- Add 'api' gradle task to generate project-wide API Javadoc

   results in <root>/build/api

 - Add docsZip task including api and reference documentation

   suitable for publication to
   http://static.springframework.org/docs/spring-framework

 - Add schemaZip task including all spring-* XSD files

   suitable for publication to http://static.springframework.org/schema

 - Add distZip task to include all libs, docs and schema

   - filter src/dist/*.txt for ${copyright} and ${version}
   - copy legal (notice, license) dynamically into individual jar files
   - copy legal and readme files into root of distribution zip

 - Refactor location of 'wrapper' task

Each of the zip tasks (docsZip, schemaZip, distZip) have been added to
the 'archives' configuration, meaning that (a) they will be built
automatically with `gradle build` and (b) will be published
automatically to artifactory when using the Artifactory Gradle plugin
and/or Artifactory Bamboo integration.
2012-01-31 14:32:16 +01:00
Chris Beams 2ca6d0b2be Centralize license, notice, etc in src/dist
Prior to this change, license.txt and notice.txt files were duplicated
across every subproject in their respective src/main/resources/META-INF
directories.

This commit centralizes these files under the root project at src/dist,
along with the changelog and readme files. The definition of the 'jar'
task has been been extended to include the license and notice files in
module jars as they are created.

The directory is named src/dist because these files are all related to
distribution - the readme is different than the one you see at the root
of the source tree - the intended audience is for users who download
the spring-framework distribution zip. A task to create that
distribution zip will be added in subsequent commits.
2012-01-31 14:32:15 +01:00
Chris Beams 86b5066a96 Fix minor problems and polish reference docs
Problems

 - Eliminate &mdash; in favor of &#151;

   &mdash; was causing 'no such entity' errors during docbook
   processing; &#151; produces the equivalent output.

 - Fix column issues in appendices

   column counts were set to 3, when they are in fact 4. This passed
   under DocBook 4 and Spring Build for unknown reasons, but caused a
   hard stop under DocBook 5 and the docbook-reference-plugin.

 - Add jdbc callout section in docbook 5-friendly style

   use <co/> tags as advertised in DocBook documentation.

 - Set correct widths for PDF ref doc images

   images were rendering larger than the PDF page; just set all to
   width=400 and everything looks good.

Polish

 - Update reference doc copyright to 2012

 - Remove "work-in-progress" language from ref docs

 - Update maven URLs to repo.springsource.org

 - Update javadoc urls from 3.0.x/javadoc-api => current/api

 - Replace hardcoded "3.1" with ${version} in ref doc
2012-01-31 14:32:15 +01:00
Chris Beams 7a3aa70565 Remove <emphasis> to work around DocBook bug
It was determined (through painful trial and error) that after the
upgrade to DocBook 5 and the gradle-docbook-reference plugin, that
<emphasis> elements embedded within <programlisting> elements causes
NullPointerExceptions during processing.

This change eliminates these <emphasis> elements to work around the
problem. This means a slight degradation in presentation for the
affected areas of the reference documentation. After some research,
it is not clear what other workarounds may be possible that leave
the text actually emphasized.
2012-01-31 14:32:15 +01:00
Chris Beams 3641337186 Upgrade reference docs to DocBook 5
For compatibility with Gradle docbook-reference-plugin, which cannot
handle DocBook 4.
2012-01-31 14:32:15 +01:00
Chris Beams 62e94461f4 Move reference docs => src/reference
This change eliminates the spring-framework-reference subproject, moving
these sources into the root project's own src directory.

This makes sense because the reference docs span all submodules, and
also because api Javadoc is created at the root project level as well.
This means that both api and reference documentation output will now
reside in the root project's 'build' directory. This is more consistent
and easy to discover.
2012-01-31 14:32:14 +01:00
Chris Beams 0a07a0ed92 Move integration tests => src/test
This commit eliminates the 'integration-tests' subproject in favor of
managing these sources under the root project's own 'src' directory.

This helps to avoid special-case handling for integration-tests in the
Gradle build, e.g. avoiding publication of jars to Artifactory /
Maven Central.

It is also semantically more correct. This is not a Spring Framework
subproject so much as it is a collection of integration tests that
span functionality across many subprojects. In this way, it makes
sense to place them directly under the root project.

Issue: SPR-8116
2012-01-31 14:32:14 +01:00
Chris Beams 9fce69849a Move misplaced integration test to proper location 2011-08-15 21:44:18 +00:00
Chris Beams f480333d31 Merge 3.1.0 development branch into trunk
Branch in question is 'env' branch from git://git.springsource.org/sandbox/cbeams.git; merged into
git-svn repository with:

    git merge -s recursive -Xtheirs --no-commit env

No merge conflicts, but did need to

    git rm spring-build

prior to committing.

With this change, Spring 3.1.0 development is now happening on SVN
trunk. Further commits to the 3.0.x line will happen in an as-yet
uncreated SVN branch.  3.1.0 snapshots will be available
per the usual nightly CI build from trunk.
2010-10-25 19:48:20 +00:00