@@ -826,8 +826,9 @@ deployed onto a Java 8 runtime. Please upgrade to Spring 4 for Java 8 based appl
826826Java EE version 6 or above is now considered the baseline for Spring Framework 4, with
827827the JPA 2.0 and Servlet 3.0 specifications being of particular relevance. In order to
828828remain compatible with Google App Engine and older application servers, it is possible
829- to deploy a Spring application into a Servlet 2.5 environment; however, Servlet 3.0+
830- is recommended when at all possible.
829+ to deploy a Spring 4 application into a Servlet 2.5 environment. However, Servlet 3.0+
830+ is strongly recommended and a prerequisite in Spring's test and mock packages for test
831+ setups in development environments.
831832
832833[NOTE]
833834====
@@ -2333,19 +2334,6 @@ the values in the `name` attribute of the target bean.
23332334 <ref bean="someBean"/>
23342335----
23352336
2336- Specifying the target bean through the `local` attribute leverages the ability of the
2337- XML parser to validate XML `id` references within the same file. The value of the `local`
2338- attribute must be the same as the `id` attribute of the target bean. The XML parser
2339- issues an error if no matching element is found in the same file. As such, using the
2340- local variant is the best choice (in order to know about errors as early as possible) if
2341- the target bean is in the same XML file.
2342-
2343- [source,xml,indent=0]
2344- [subs="verbatim,quotes"]
2345- ----
2346- <ref local="someBean"/>
2347- ----
2348-
23492337Specifying the target bean through the `parent` attribute creates a reference to a bean
23502338that is in a parent container of the current container. The value of the `parent`
23512339attribute may be the same as either the `id` attribute of the target bean, or one of the
@@ -2376,6 +2364,13 @@ container with a proxy that will have the same name as the parent bean.
23762364 </bean>
23772365----
23782366
2367+ [NOTE]
2368+ ====
2369+ The `local` attribute on the `ref` element is no longer supported in the 4.0 beans xsd
2370+ since it does not provide value over a regular `bean` reference anymore. Simply change
2371+ your existing `ref local` references to `ref bean` when upgrading to the 4.0 schema.
2372+ ====
2373+
23792374
23802375[[beans-inner-beans]]
23812376===== Inner beans
@@ -3385,12 +3380,12 @@ processed by the Spring `DispatcherServlet`, or `DispatcherPortlet`, then no spe
33853380setup is necessary: `DispatcherServlet` and `DispatcherPortlet` already expose all
33863381relevant state.
33873382
3388- If you use a Servlet 2.4+ web container, with requests processed outside of Spring's
3383+ If you use a Servlet 2.5 web container, with requests processed outside of Spring's
33893384DispatcherServlet (for example, when using JSF or Struts), you need to register the
33903385`org.springframework.web.context.request.RequestContextListener` `ServletRequestListener`.
33913386For Servlet 3.0+, this can done programmatically via the `WebApplicationInitializer`
3392- interface. Alternatively, or for older containers, add the following declaration to your
3393- web applications `web.xml` file:
3387+ interface. Alternatively, or for older containers, add the following declaration to
3388+ your web application's `web.xml` file:
33943389
33953390[source,xml,indent=0]
33963391[subs="verbatim,quotes"]
@@ -3406,12 +3401,9 @@ web applications `web.xml` file:
34063401 </web-app>
34073402----
34083403
3409- If you use an older web container (Servlet 2.3), use the provided `javax.servlet.Filter`
3410- implementation. The following snippet of XML configuration must be included in the
3411- `web.xml` file of your web application if you want to access web-scoped beans in
3412- requests outside of Spring's DispatcherServlet on a Servlet 2.3 container. (The filter
3413- mapping depends on the surrounding web application configuration, so you must change it
3414- as appropriate.)
3404+ Alternatively, if there are issues with your listener setup, consider the provided
3405+ `RequestContextFilter`. The filter mapping depends on the surrounding web
3406+ application configuration, so you have to change it as appropriate.
34153407
34163408[source,xml,indent=0]
34173409[subs="verbatim,quotes"]
@@ -5977,7 +5969,10 @@ The use of `<context:component-scan>` implicitly enables the functionality of
59775969====
59785970The scanning of classpath packages requires the presence of corresponding directory
59795971entries in the classpath. When you build JARs with Ant, make sure that you do __not__
5980- activate the files-only switch of the JAR task.
5972+ activate the files-only switch of the JAR task. Also, classpath directories may not
5973+ get exposed based on security policies in some environments, e.g. standalone apps on
5974+ JDK 1.7.0_45 and higher (which requires 'Trusted-Library' setup in your manifests; see
5975+ http://stackoverflow.com/questions/19394570/java-jre-7u45-breaks-classloader-getresources).
59815976====
59825977
59835978Furthermore, the `AutowiredAnnotationBeanPostProcessor` and
@@ -8141,16 +8136,6 @@ You can create `ApplicationContext` instances declaratively by using, for exampl
81418136`ContextLoader`. Of course you can also create `ApplicationContext` instances
81428137programmatically by using one of the `ApplicationContext` implementations.
81438138
8144- The `ContextLoader` mechanism comes in two flavors: the `ContextLoaderListener` and the
8145- `ContextLoaderServlet`. They have the same functionality but differ in that the listener
8146- version is not reliable in Servlet 2.3 containers. In the Servlet 2.4 specification,
8147- Servlet context listeners must execute immediately after the Servlet context for the web
8148- application is created and is available to service the first request (and also when the
8149- Servlet context is about to be shut down). As such a Servlet context listener is an
8150- ideal place to initialize the Spring `ApplicationContext`. All things being equal, you
8151- should probably prefer `ContextLoaderListener`; for more information on compatibility,
8152- have a look at the Javadoc for the `ContextLoaderServlet`.
8153-
81548139You can register an `ApplicationContext` using the `ContextLoaderListener` as follows:
81558140
81568141[source,xml,indent=0]
@@ -16358,7 +16343,7 @@ interfaces an `IntroductionInterceptor` is prepared to support, the
1635816343`IntroductionAdvisor` used will control which interfaces are actually exposed. An
1635916344introduced interface will conceal any implementation of the same interface by the target.
1636016345
16361- Thus LockMixin subclasses `DelegatingIntroductionInterceptor` and implements Lockable
16346+ Thus ` LockMixin` extends `DelegatingIntroductionInterceptor` and implements ` Lockable`
1636216347itself. The superclass automatically picks up that Lockable can be supported for
1636316348introduction, so we don't need to specify that. We could introduce any number of
1636416349interfaces in this way.
@@ -17216,32 +17201,23 @@ attributes. You need to:
1721617201 an existing advice, merely implementing a static pointcut that picks up the custom
1721717202 attribute.
1721817203
17219- It's possible for such advisors to be unique to each advised class (for example,
17220- mixins): they simply need to be defined as prototype, rather than singleton, bean
17221- definitions. For example, the `LockMixin` introduction interceptor from the Spring test
17222- suite, shown above, could be used in conjunction with an attribute-driven pointcut to
17223- target a mixin, as shown here. We use the generic `DefaultPointcutAdvisor`, configured
17224- using JavaBean properties:
17204+ It's possible for such advisors to be unique to each advised class (for example, mixins):
17205+ they simply need to be defined as prototype, rather than singleton, bean definitions.
17206+ For example, the `LockMixin` introduction interceptor from the Spring test suite,
17207+ shown above, could be used in conjunction with a generic `DefaultIntroductionAdvisor`:
1722517208
1722617209[source,xml,indent=0]
1722717210[subs="verbatim,quotes"]
1722817211----
17229- <bean id="lockMixin" class="org.springframework.aop.LockMixin"
17230- scope="prototype"/>
17212+ <bean id="lockMixin" class="test.mixin.LockMixin" scope="prototype"/>
1723117213
17232- <bean id="lockableAdvisor" class="org.springframework.aop.support.DefaultPointcutAdvisor "
17214+ <bean id="lockableAdvisor" class="org.springframework.aop.support.DefaultIntroductionAdvisor "
1723317215 scope="prototype">
17234- <property name="pointcut" ref="myAttributeAwarePointcut"/>
17235- <property name="advice" ref="lockMixin"/>
17216+ <constructor-arg ref="lockMixin"/>
1723617217 </bean>
17237-
17238- <bean id="anyBean" class="anyclass" ...
1723917218----
1724017219
17241- If the attribute aware pointcut matches any methods in the `anyBean` or other bean
17242- definitions, the mixin will be applied. Note that both `lockMixin` and `lockableAdvisor`
17243- definitions are prototypes. The `myAttributeAwarePointcut` pointcut can be a singleton
17244- definition, as it doesn't hold state for individual advised objects.
17220+ Note that both `lockMixin` and `lockableAdvisor` are defined as prototypes.
1724517221
1724617222
1724717223
@@ -17603,6 +17579,9 @@ dealing with Spring MVC `ModelAndView` objects.
1760317579To test your Spring MVC `Controller` s, use `ModelAndViewAssert` combined with
1760417580`MockHttpServletRequest`, `MockHttpSession`, and so on from the <<mock-objects-servlet,
1760517581`org.springframework.mock.web`>> package.
17582+
17583+ Note: As of Spring 4.0, the set of mocks in the `org.springframework.mock.web` package
17584+ is now based on the Servlet 3.0 API.
1760617585====
1760717586
1760817587
0 commit comments