diff --git a/spring-framework-reference/src/aop-api.xml b/spring-framework-reference/src/aop-api.xml index eaf125e0d95..2097750f734 100644 --- a/spring-framework-reference/src/aop-api.xml +++ b/spring-framework-reference/src/aop-api.xml @@ -859,8 +859,8 @@ public interface IntroductionInfo { - Specify whether to use CGLIB (see below and also the section - entitled ). + Specify whether to use CGLIB (see below and also + ). @@ -875,8 +875,7 @@ public interface IntroductionInfo { if the target class is to be proxied, rather than the target class' interfaces. If this property value is set to true, then CGLIB proxies will be created (but see - also below the section entitled ). + also ). @@ -927,8 +926,7 @@ public interface IntroductionInfo { proxyInterfaces: array of String interface names. If this isn't supplied, a CGLIB proxy for the target class - will be used (but see also below the section entitled ). + will be used (but see also ). diff --git a/spring-framework-reference/src/aop.xml b/spring-framework-reference/src/aop.xml index 1b2e62d75c2..4a2a90ba589 100644 --- a/spring-framework-reference/src/aop.xml +++ b/spring-framework-reference/src/aop.xml @@ -271,8 +271,8 @@ indication that the Spring team favors the @AspectJ annotation-style approach over the Spring XML configuration-style. - See the section entitled for a - fuller discussion of the whys and wherefores of each style. + See for a + more complete discussion of the whys and wherefores of each style. @@ -294,7 +294,7 @@ to a method as a concrete type. It is important to grasp the fact that Spring AOP is - proxy-based. See the section entitled proxy-based. See for a thorough examination of exactly what this implementation detail actually means. diff --git a/spring-framework-reference/src/beans.xml b/spring-framework-reference/src/beans.xml index bf759bf44bf..618645df003 100644 --- a/spring-framework-reference/src/beans.xml +++ b/spring-framework-reference/src/beans.xml @@ -9,8 +9,7 @@ This chapter covers the Spring Framework implementation of the Inversion of Control (IoC) - See the section entitled + See principle. IoC is also known as dependency injection (DI). It is a process whereby objects define their dependencies, that is, the other objects they work with, only through @@ -216,8 +215,8 @@ The footnote should x-ref to first section in that chapter but I can't find the metadata from a variety of external resources such as the local file system, from the Java CLASSPATH, and so on. - ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"services.xml", - "daos.xml"}); + ApplicationContext context = + new ClassPathXmlApplicationContext(new String[] {"services.xml", "daos.xml"}); After you learn about Spring's IoC container, you may want to @@ -233,7 +232,7 @@ The footnote should x-ref to first section in that chapter but I can't find the The following example shows the service layer objects (services.xml) configuration file: - <?xml version="1.0" encoding="UTF-8"?> + <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans @@ -256,13 +255,14 @@ The footnote should x-ref to first section in that chapter but I can't find the The following example shows the data access objects daos.xml) file: - <?xml version="1.0" encoding="UTF-8"?> + <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - <bean id="accountDao" class="org.springframework.samples.jpetstore.dao.ibatis.SqlMapAccountDao"> + <bean id="accountDao" + class="org.springframework.samples.jpetstore.dao.ibatis.SqlMapAccountDao"> <!-- additional collaborators and configuration for this bean go here --> </bean> @@ -361,7 +361,8 @@ The footnote should x-ref to first section in that chapter but I can't find the to read bean definitions and access them as follows: // create and configure beans -ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"services.xml", "daos.xml"}); +ApplicationContext context = + new ClassPathXmlApplicationContext(new String[] {"services.xml", "daos.xml"}); // retrieve configured instance PetStoreServiceImpl service = context.getBean("petStore", PetStoreServiceImpl.class); @@ -1076,7 +1077,7 @@ public class ExampleBean { properties themselves are not set until the bean is actually created. Beans that are singleton-scoped and set to be pre-instantiated (the default) are created when the container is - created. Scopes are defined in the section Otherwise, the bean is created only when it is requested. Creation of a bean potentially causes a graph of beans to be created, as the bean's dependencies and its dependencies' @@ -1300,19 +1301,19 @@ public class ExampleBean { linkend="beans-p-namespace">p-namespace for even more succinct XML configuration. - <beans xmlns="http://www.springframework.org/schema/beans" + <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" + <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" + destroy-method="close" p:driverClassName="com.mysql.jdbc.Driver" p:url="jdbc:mysql://localhost:3306/mydb" p:username="root" p:password="masterkaoli"/> - </beans> @@ -1329,8 +1330,9 @@ public class ExampleBean { You can also configure a java.util.Properties instance as: - <bean id="mappings" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> - + <bean id="mappings" + class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> + <!-- typed as a java.util.Properties --> <property name="properties"> <value> @@ -1395,7 +1397,7 @@ public class ExampleBean { time. <property name="targetName"> - <!-- a bean with an id of 'theTargetBean' must exist; otherwise an XML exception will be thrown --> + <!-- a bean with id 'theTargetBean' must exist; otherwise an exception will be thrown --> <idref local="theTargetBean"/> </property> @@ -1465,14 +1467,12 @@ public class ExampleBean { </bean> <!-- in the child (descendant) context --> -<bean id="accountService" <-- notice that the name of this bean is the same as the name of the parent bean +<bean id="accountService" <-- bean name is the same as the parent bean --> class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="target"> - <ref parent="accountService"/> <-- notice how we refer to the parent bean + <ref parent="accountService"/> <!-- notice how we refer to the parent bean --> </property> - <!-- insert other configuration and dependencies as required as here --> + <!-- insert other configuration and dependencies as required here --> </bean> @@ -2231,8 +2231,8 @@ support=support@example.co.uk If you use Java 5 and thus have access to source-level - annotations, you may find to be of interest. + annotations, you may find to be of interest.
@@ -2278,12 +2278,13 @@ public class CommandManager implements ApplicationContextAware { return command.execute(); } - // the Command returned here could be an implementation that executes asynchronously, or whatever protected Command createCommand() { - return this.applicationContext.getBean("command", Command.class); // notice the Spring API dependency + // notice the Spring API dependency! + return this.applicationContext.getBean("command", Command.class); } - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + public void setApplicationContext(ApplicationContext applicationContext) + throws BeansException { this.applicationContext = applicationContext; } } @@ -2565,6 +2566,14 @@ public class ReplacementComputeValue implements MethodReplacer { + + Thread-scoped beans + As of Spring 3.0, a thread scope is available, but is + not registered by default. For more information, see the documentation for + SimpleThreadScope. + For instructions on how to register this or any other custom scope, see + . +
The singleton scope @@ -2609,11 +2618,8 @@ public class ReplacementComputeValue implements MethodReplacer { <bean id="accountService" class="com.foo.DefaultAccountService"/> -<!-- the following is equivalent, though redundant (singleton scope is the default); using spring-beans-2.0.dtd --> -<bean id="accountService" class="com.foo.DefaultAccountService" scope="singleton"/> - -<!-- the following is equivalent and preserved for backward compatibility in spring-beans.dtd --> -<bean id="accountService" class="com.foo.DefaultAccountService" singleton="true"/> +<!-- the following is equivalent, though redundant (singleton scope is the default) --> +<bean id="accountService" class="com.foo.DefaultAccountService" scope="singleton"/>
@@ -2648,10 +2654,7 @@ public class ReplacementComputeValue implements MethodReplacer { The following example defines a bean as a prototype in XML: <!-- using spring-beans-2.0.dtd --> -<bean id="accountService" class="com.foo.DefaultAccountService" scope="prototype"/> - -<!-- the following is equivalent and preserved for backward compatibility in spring-beans.dtd --> -<bean id="accountService" class="com.foo.DefaultAccountService" singleton="false"/> +<bean id="accountService" class="com.foo.DefaultAccountService" scope="prototype"/> In contrast to the other scopes, Spring does not manage the complete lifecycle of a prototype bean: the container instantiates, @@ -2694,32 +2697,6 @@ public class ReplacementComputeValue implements MethodReplacer { and injecting its dependencies. If you need a new instance of a prototype bean at runtime more than once, see - - - Backwards compatibility and specifying the lifecycle scope in - XML - - If you reference the spring-beans.dtd DTD - in a bean definition file, and you are explicit about the lifecycle - scope of your beans, you must use the singleton - attribute to express the lifecycle scope. The singleton lifecycle - scope is the default. If you reference the - spring-beans-2.0.dtd DTD or the Spring 2.0 XSD - schema, you must use the scope attribute, because - the singleton attribute was removed from the - definition of the new DTD and XSD files in favor of the - scope attribute. - - This means that if you use the singleton - attribute in an XML bean definition, you must - reference the spring-beans.dtd DTD in - that file. If you use the scope - attribute, you must reference either the - spring-beans-2.0.dtd DTD or the - spring-beans-3.0.xsd XSD in that - file. -
@@ -2766,7 +2743,9 @@ public class ReplacementComputeValue implements MethodReplacer { <web-app> ... <listener> - <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> + <listener-class> + org.springframework.web.context.request.RequestContextListener + </listener-class> </listener> ... </web-app> @@ -3131,18 +3110,21 @@ public class ReplacementComputeValue implements MethodReplacer { Suppose that you write your custom Scope implementation, and then register - it as follows: + it as below. + + The example below uses SimpleThreadScope + which is included with Spring, but not registered by default. The instructions + would be the same for your own custom Scope implementations. + - // note: the ThreadScope class does not ship with the Spring Framework -Scope customScope = new ThreadScope(); -beanFactory.registerScope("thread", customScope); + +Scope threadScope = new SimpleThreadScope(); +beanFactory.registerScope("thread", threadScope); You then create bean definitions that adhere to the scoping rules of your custom Scope: - <bean id="..." class="..." scope="thread"/> + <bean id="..." class="..." scope="thread"> With a custom Scope implementation, you are not limited to programmatic registration of @@ -3163,13 +3145,13 @@ beanFactory.registerScope("thread", customScope <property name="scopes"> <map> <entry key="thread"> - <bean class="com.foo.ThreadScope"/> + <bean class="org.springframework.context.support.SimpleThreadScope"/> </entry> </map> </property> </bean> - <bean id="bar" class="x.y.Bar" scope="thread"> + <bean id="bar" class="x.y.Bar" scope="thread"> <property name="name" value="Rick"/> <aop:scoped-proxy/> </bean> @@ -3546,7 +3528,7 @@ public final class Boot { BeanFactory type if the field, constructor, or method in question carries the @Autowired annotation. For more - information, see the section entitled . When an ApplicationContext creates a class that implements the @@ -3792,11 +3774,13 @@ import org.springframework.beans.BeansException; public class InstantiationTracingBeanPostProcessor implements BeanPostProcessor { // simply return the instantiated bean as-is - public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { + public Object postProcessBeforeInitialization(Object bean, String beanName) + throws BeansException { return bean; // we could potentially return any object reference here... } - public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { + public Object postProcessAfterInitialization(Object bean, String beanName) + throws BeansException { System.out.println("Bean '" + beanName + "' created : " + bean.toString()); return bean; } @@ -3862,8 +3846,7 @@ org.springframework.scripting.groovy.GroovyMessenger@272961 Using callback interfaces or annotations in conjunction with a custom BeanPostProcessor implementation is a common means of extending the Spring IoC container. An example is - shown in the section entitled which demonstrates the + shown in which demonstrates the usage of a custom BeanPostProcessor implementation that ships with the Spring distribution which ensures that JavaBean properties on beans that are marked with an (arbitrary) @@ -3907,8 +3890,7 @@ org.springframework.scripting.groovy.GroovyMessenger@272961 instances (the objects that are created from the configuration metadata), then you instead need to use a BeanPostProcessor (described above in - the section entitled . + . Also, BeanFactoryPostProcessors are scoped per-container. This is only relevant if you are @@ -4292,11 +4274,12 @@ dataSource.url=jdbc:mysql:mydb public class MovieRecommender { private MovieCatalog movieCatalog; - + private CustomerPreferenceDao customerPreferenceDao; @Autowired - public void prepare(MovieCatalog movieCatalog, CustomerPreferenceDao customerPreferenceDao) { + public void prepare(MovieCatalog movieCatalog, + CustomerPreferenceDao customerPreferenceDao) { this.movieCatalog = movieCatalog; this.customerPreferenceDao = customerPreferenceDao; } @@ -4460,7 +4443,8 @@ dataSource.url=jdbc:mysql:mydb private CustomerPreferenceDao customerPreferenceDao; @Autowired - public void prepare(@Qualifier("main") MovieCatalog movieCatalog, CustomerPreferenceDao customerPreferenceDao) { + public void prepare(@Qualifier("main") MovieCatalog movieCatalog, + CustomerPreferenceDao customerPreferenceDao) { this.movieCatalog = movieCatalog; this.customerPreferenceDao = customerPreferenceDao; } @@ -4668,14 +4652,14 @@ public @interface Offline { public @interface MovieQualifier { String genre(); - + Format format(); } In this case Format is an enum: public enum Format { - + VHS, DVD, BLURAY } @@ -4766,7 +4750,8 @@ public @interface MovieQualifier { if they are not annotated with Spring's @Qualifier annotation. - <bean id="customAutowireConfigurer" class="org.springframework.beans.factory.annotation.CustomAutowireConfigurer"> + <bean id="customAutowireConfigurer" + class="org.springframework.beans.factory.annotation.CustomAutowireConfigurer"> <property name="customQualifierTypes"> <set> <value>example.CustomQualifier</value> @@ -4887,7 +4872,7 @@ public @interface MovieQualifier { only recognizes the @Resource annotation but also the JSR-250 lifecycle annotations. Introduced in Spring 2.5, the support for these annotations offers yet - another alternative to those described in the sections on initialization callbacks and destruction @@ -5140,10 +5125,11 @@ public class JpaMovieFinder implements MovieFinder { custom - org.example.MyCustomTypeFilter + org.example.MyTypeFilter A custom implementation of the - org.springframework.core.type.TypeFilter + org.springframework.core.type + .TypeFilter interface. @@ -5154,11 +5140,12 @@ public class JpaMovieFinder implements MovieFinder { @Repository annotations and using "stub" repositories instead. - <beans ...> + <beans> <context:component-scan base-package="org.example"> <context:include-filter type="regex" expression=".*Stub.*Repository"/> - <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Repository"/> + <context:exclude-filter type="annotation" + expression="org.springframework.stereotype.Repository"/> </context:component-scan> </beans> @@ -5184,22 +5171,21 @@ public class JpaMovieFinder implements MovieFinder { @Configuration annotated classes. Here is a simple example: - @Component + @Component public class FactoryMethodComponent { - @Bean @Qualifier("public") - public TestBean publicInstance() { - return new TestBean("publicInstance"); - } + @Bean @Qualifier("public") + public TestBean publicInstance() { + return new TestBean("publicInstance"); + } - public void DoWork() - { - // Component method implementation omitted - } + public void doWork() { + // Component method implementation omitted + } } This class is a Spring component that has application-specific - code contained in its DoWork method. However, + code contained in its doWork method. However, it also contributes a bean definition that has a factory method referring to the method publicInstance. The @Bean annotation identifies the factory method and @@ -5208,37 +5194,39 @@ public class FactoryMethodComponent { annotations that can be specified are @Scope, @Lazy, and custom qualifier annotations. Autowired fields and methods are supported as previously discussed, with - additional support for autowiring of @Bean methods: + additional support for autowiring of @Bean methods: @Component public class FactoryMethodComponent { - private static int i; + private static int i; - @Bean @Qualifier("public") - public TestBean publicInstance() { - return new TestBean("publicInstance"); - } + @Bean @Qualifier("public") + public TestBean publicInstance() { + return new TestBean("publicInstance"); + } - // use of a custom qualifier and autowiring of method parameters + // use of a custom qualifier and autowiring of method parameters - @Bean @BeanAge(1) - protected TestBean protectedInstance(@Qualifier("public") TestBean spouse, @Value("#{privateInstance.age}") String country) { - TestBean tb = new TestBean("protectedInstance", 1); - tb.setSpouse(tb); - tb.setCountry(country); - return tb; - } + @Bean @BeanAge(1) + protected TestBean protectedInstance(@Qualifier("public") TestBean spouse, + @Value("#{privateInstance.age}") String country) { + TestBean tb = new TestBean("protectedInstance", 1); + tb.setSpouse(tb); + tb.setCountry(country); + return tb; + } - @Bean @Scope(BeanDefinition.SCOPE_SINGLETON) - private TestBean privateInstance() { - return new TestBean("privateInstance", i++); - } + @Bean @Scope(BeanDefinition.SCOPE_SINGLETON) + private TestBean privateInstance() { + return new TestBean("privateInstance", i++); + } - @Bean @Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.TARGET_CLASS) - public TestBean requestScopedInstance() { - return new TestBean("requestScopedInstance", 3); - } + @Bean @Scope(value = WebApplicationContext.SCOPE_SESSION, + proxyMode = ScopedProxyMode.TARGET_CLASS) + public TestBean requestScopedInstance() { + return new TestBean("requestScopedInstance", 3); + } } @@ -5304,7 +5292,7 @@ public class MovieFinderImpl implements MovieFinder { scanner: - <beans ...> + <beans> <context:component-scan base-package="org.example" name-generator="org.example.MyNameGenerator" /> @@ -5341,7 +5329,7 @@ public class MovieFinderImpl implements MovieFinder { scanner: - <beans ...> + <beans> <context:component-scan base-package="org.example" scope-resolver="org.example.MyScopeResolver" /> @@ -5356,7 +5344,7 @@ public class MovieFinderImpl implements MovieFinder { interfaces, and targetClass. For example, the following configuration will result in standard JDK dynamic proxies: - <beans ...> + <beans> <context:component-scan base-package="org.example" scoped-proxy="interfaces" /> @@ -5528,8 +5516,7 @@ public class AppConfig { @Configuration-annotated class supports the regular lifecycle callbacks. Any classes defined with the @Bean annotation can use the @PostConstruct and @PreDestroy annotations from - JSR-250, see the section on JSR-250 + JSR-250, see JSR-250 annotations for further details. The regular Spring The standard set of *Aware interfaces such as BeanFactoryAware, + linkend="beans-beanfactory">BeanFactoryAware, BeanNameAware, + linkend="beans-factory-aware">BeanNameAware, MessageSourceAware, ApplicationContextAware, + linkend="beans-factory-aware">ApplicationContextAware, and so on are also fully supported. The @Bean annotation supports @@ -5716,7 +5703,7 @@ public CommandManager commandManager() { the name attribute. @Configuration public class AppConfig { - @Bean(name = "bar") + @Bean(name = "myFoo") public Foo foo() { return new Foo(); } @@ -5732,7 +5719,7 @@ public class AppConfig { The context namespace introduced in Spring 2.5 provides a load-time-weaver element. - <beans ...> + <beans> <context:load-time-weaver/> diff --git a/spring-framework-reference/src/cci.xml b/spring-framework-reference/src/cci.xml index d34fdfe0be1..9e4bd3d191c 100644 --- a/spring-framework-reference/src/cci.xml +++ b/spring-framework-reference/src/cci.xml @@ -448,8 +448,7 @@ This property simply holds an implementation of the RecordCreator interface, used for that purpose. The RecordCreator interface has - already been discussed in the section entitled . The + already been discussed in . The outputRecordCreator property must be directly specified on the CciTemplate. This could be done in the application code like so: @@ -880,8 +879,7 @@ MyMappingRecordOperation eisOperation = new MyMappingRecordOperation(getConnecti output records as with CciTemplate is available. Every operation object provides a corresponding setOutputRecordCreator(..) method. For further - information, see the section entitled . + information, see .
diff --git a/spring-framework-reference/src/classic-aop-spring.xml b/spring-framework-reference/src/classic-aop-spring.xml index cd33f0c0ab9..e5bad09153c 100644 --- a/spring-framework-reference/src/classic-aop-spring.xml +++ b/spring-framework-reference/src/classic-aop-spring.xml @@ -825,7 +825,7 @@ public interface IntroductionInfo { Specify the target you want to proxy. - Specify whether to use CGLIB (see below and also the section entitled + Specify whether to use CGLIB (see below and also ). @@ -840,8 +840,7 @@ public interface IntroductionInfo { proxyTargetClass: true if the target class is to be proxied, rather than the target class' interfaces. If this property value is set to true, then CGLIB proxies - will be created (but see also below the section entitled - ). + will be created (but see also below ). @@ -890,8 +889,7 @@ public interface IntroductionInfo { proxyInterfaces: array of String interface names. If this isn't supplied, a CGLIB proxy for the target class - will be used (but see also below the section entitled - ). + will be used (but see also below ). diff --git a/spring-framework-reference/src/dynamic-languages.xml b/spring-framework-reference/src/dynamic-languages.xml index 3cbcc5b2870..a72e19d6858 100644 --- a/spring-framework-reference/src/dynamic-languages.xml +++ b/spring-framework-reference/src/dynamic-languages.xml @@ -42,7 +42,7 @@ Fully working examples of where this dynamic language support can be immediately useful - are described in the section entitled . + are described in . Note: Only the specific versions as listed above are supported @@ -167,8 +167,8 @@ http://www.springframework.org/schema/lang http://www.springframework.org/schema idioms of the supported dynamic languages. For example, if you want to use Groovy to write certain of the classes in your application, then the assumption is that you already know Groovy. If you need further details - about the dynamic languages themselves, please consult the section - entitled at the end of this chapter. + about the dynamic languages themselves, please consult + at the end of this chapter.
@@ -388,7 +388,7 @@ class GroovyMessenger implements Messenger { The refreshable bean behavior described above does not apply to dynamic language source files defined using the <lang:inline-script/> element - notation (see the section entitled ). + notation (see ). Additionally, it only applies to beans where changes to the underlying source file can actually be detected; for example, by code that checks the last modified date of a @@ -426,8 +426,8 @@ class GroovyMessenger implements Messenger { some scenarios. For instance, we might want to quickly add a Spring Validator implementation to a Spring MVC Controller. This is but a moment's work - using inline source. (See the section entitled - for such an example.) + using inline source. (See + for such an example.) Find below an example of defining the source for a JRuby-based bean @@ -629,7 +629,7 @@ RubyMessenger.new]]> source file as a whole must return an object (for Spring to configure). - See the section entitled for some + See for some scenarios where you might want to use JRuby-based beans.
@@ -711,8 +711,8 @@ public class Main { (unsurprisingly) 10. (Exciting example, huh? Remember that the intent is to illustrate the concept. Please consult the dynamic language showcase project for a - more complex example, or indeed the section entitled - later in this chapter). + more complex example, or indeed + later in this chapter). It is important that you do not define more than one @@ -865,7 +865,7 @@ void setMessage(String aMessage) { ]]> - See the section entitled for some + See for some scenarios where you might want to use BeanShell-based beans.
@@ -907,7 +907,7 @@ void setMessage(String aMessage) { In order to effect this automatic 'pickup' of any changes to dynamic-language-backed beans, you will have had to enable the - 'refreshable beans' functionality. See the section entitle + 'refreshable beans' functionality. See for a full treatment of this feature. @@ -966,7 +966,7 @@ class FortuneController implements Controller { Please note that in order to effect the automatic 'pickup' of any changes to dynamic-language-backed beans, you will have had to enable the - 'refreshable beans' feature. See the section entitled + 'refreshable beans' feature. See for a full and detailed treatment of this feature. @@ -974,9 +974,8 @@ class FortuneController implements Controller { Find below an example of a Spring org.springframework.validation.Validator - implemented using the Groovy dynamic language. (See the section entitled - for a discussion of the - Validator interface.) + implemented using the Groovy dynamic language. (See + for a discussion of the Validator interface.) ]]> - See the section entitled in + See in for a fuller discussion of the scoping support in the Spring Framework. diff --git a/spring-framework-reference/src/expressions.xml b/spring-framework-reference/src/expressions.xml index 4c7ed33209e..43d33a37144 100644 --- a/spring-framework-reference/src/expressions.xml +++ b/spring-framework-reference/src/expressions.xml @@ -407,7 +407,7 @@ Boolean b = simple.booleanList.get(0); @Autowired public void configure(MovieFinder movieFinder, - @Value("#{ systemProperties['user.region']"} String defaultLocale) { + @Value("#{ systemProperties['user.region'] }"} String defaultLocale) { this.movieFinder = movieFinder; this.defaultLocale = defaultLocale; } @@ -418,12 +418,12 @@ Boolean b = simple.booleanList.get(0); public class MovieRecommender { private String defaultLocale; - + private CustomerPreferenceDao customerPreferenceDao; @Autowired public MovieRecommender(CustomerPreferenceDao customerPreferenceDao, - @Value("#{ systemProperties['user.country']"} String defaultLocale) { + @Value("#{systemProperties['user.country']}"} String defaultLocale) { this.customerPreferenceDao = customerPreferenceDao; this.defaultLocale = defaultLocale; } diff --git a/spring-framework-reference/src/jdbc.xml b/spring-framework-reference/src/jdbc.xml index 24548d9a02d..152ec54cb26 100644 --- a/spring-framework-reference/src/jdbc.xml +++ b/spring-framework-reference/src/jdbc.xml @@ -602,7 +602,7 @@ public int countOfActors(Actor exampleActor) { JdbcOperations interface. - See also the section entitled See also for some advice on how to best use the NamedParameterJdbcTemplate class in the context of an application. @@ -696,10 +696,9 @@ public Actor findActor(String specialty, int age) { return this.simpleJdbcTemplate.queryForObject(sql, mapper, specialty, age); }
- See also the section entitled for some advice on how to best use - the SimpleJdbcTemplate class in the context of an - application. + See also + for some advice on how to best use the SimpleJdbcTemplate + class in the context of an application. The SimpleJdbcTemplate class only offers @@ -2755,4 +2754,4 @@ public class DataAccessUnitTestTemplate { ]]>
- \ No newline at end of file + diff --git a/spring-framework-reference/src/jms.xml b/spring-framework-reference/src/jms.xml index 397621cd84f..80c662850a4 100644 --- a/spring-framework-reference/src/jms.xml +++ b/spring-framework-reference/src/jms.xml @@ -260,9 +260,8 @@ One of the most common uses of JMS messages in the EJB world is to drive message-driven beans (MDBs). Spring offers a solution to create message-driven POJOs (MDPs) in a way that does not tie a user to an EJB - container. (See the section entitled for detailed coverage of - Spring's MDP support.) + container. (See + for detailed coverage of Spring's MDP support.) A message listener container is used to receive messages from a JMS message queue and drive the MessageListener that is injected into @@ -955,10 +954,9 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem The example above is equivalent to creating two distinct listener container bean definitions and two distinct MessageListenerAdapter bean definitions as - demonstrated in the section entitled . In addition to - the attributes shown above, the listener element may - contain several optional ones. The following table describes all available + demonstrated in . + In addition to the attributes shown above, the listener element + may contain several optional ones. The following table describes all available attributes: diff --git a/spring-framework-reference/src/jmx.xml b/spring-framework-reference/src/jmx.xml index dd30c5838e3..1620fa16171 100644 --- a/spring-framework-reference/src/jmx.xml +++ b/spring-framework-reference/src/jmx.xml @@ -18,8 +18,7 @@ This chapter is not an introduction to JMX... it doesn't try to explain the motivations of why one might want to use JMX (or indeed what the letters JMX actually stand for). If you are new to JMX, check out - the section entitled at the end of this - chapter. + at the end of this chapter. Specifically, Spring's JMX support provides four core @@ -128,7 +127,7 @@ public class JmxTestBean implements IJmxTestBean { beans Map is used as the ObjectName for the bean referenced by the corresponding entry value. This behavior can be changed as described in - the section entitled . + . With this configuration the testBean bean is exposed as an MBean under the ObjectName @@ -270,8 +269,7 @@ public class JmxTestBean implements IJmxTestBean { already a valid JMX MBean and will be automatically registered by Spring. By default, beans that are autodetected for JMX registration have their bean name used as the ObjectName. This - behavior can be overridden as detailed in the section entitled - . + behavior can be overridden as detailed in .
@@ -954,8 +952,8 @@ public class AnnotationTestBean implements IJmxTestBean { to include it. The only problem with this approach is that the name of the JmxTestBean now has business meaning. You can address this issue by changing the default behavior for - ObjectName creation as defined in the section - entitled . + ObjectName creation as defined in + .
@@ -1760,4 +1758,4 @@ public class JmxTestBean implements IJmxTestBean, NotificationPublisherAware {
- \ No newline at end of file + diff --git a/spring-framework-reference/src/new-in-2.xml b/spring-framework-reference/src/new-in-2.xml index af52615be20..751ec0f84ea 100644 --- a/spring-framework-reference/src/new-in-2.xml +++ b/spring-framework-reference/src/new-in-2.xml @@ -66,8 +66,8 @@ existing configuration needs to change, and no existing configuration will break. - Both the new and the original scopes are detailed in the section - entitled . + Both the new and the original scopes are detailed in + .
@@ -77,8 +77,7 @@ of the new XML configuration syntax based on XML Schema. If you want to take advantage of the new tags that Spring provides (and the Spring team certainly suggest that you do because they make configuration less - verbose and easier to read), then do read the section entitled . + verbose and easier to read), then do read . On a related note, there is a new, updated DTD for Spring 2.0 that you may wish to reference if you cannot take advantage of the XML @@ -169,8 +168,7 @@ backed by regular Java objects. This support takes advantage of the AspectJ pointcut language and offers fully typed advice (i.e. no more casting and Object[] argument manipulation). Details - of this support can be found in the section entitled . + of this support can be found in .
@@ -258,9 +256,8 @@ usage patterns. If you are interested in using a JPA-implementation as the - backbone of your persistence layer, the section entitled is dedicated to detailing Spring's support and - value-add in this area. + backbone of your persistence layer, is + dedicated to detailing Spring's support and value-add in this area. Spring 2.5 upgrades its OpenJPA support to OpenJPA 1.0, with support for advanced features such as savepoints. @@ -277,7 +274,7 @@ receiving of messages. Spring 2.0 now ships with full support for the reception of - messages in an asynchronous fashion, as detailed in the section entitled + messages in an asynchronous fashion, as detailed in . As of Spring 2.5, the JCA style of setting up asynchronous @@ -339,7 +336,7 @@ of (always good-to-have) consistency across a codebase. Spring MVC's convention-over-configuration support is detailed in - the section entitled +
@@ -347,8 +344,7 @@ Spring 2.0 ships with a Portlet framework that is conceptually similar to the Spring MVC framework. Detailed coverage of the Spring - Portlet framework can be found in the section entitled . + Portlet framework can be found in .
@@ -376,7 +372,7 @@ the job of authoring JSP pages much easier when using Spring MVC; the Spring team is confident it will satisfy all of those developers who voted for the issue on JIRA. The new tag library is itself covered in - the section entitled , and a quick + , and a quick reference to all of the new tags can be found in the appendix entitled .
@@ -419,7 +415,7 @@ Spring 2.0 introduced support for beans written in languages other than Java, with the currently supported dynamic languages being JRuby, Groovy and BeanShell. This dynamic language support is comprehensively - detailed in the section entitled . + detailed in . Spring 2.5 refines the dynamic languages support with autowiring and support for the recently released JRuby 1.0. @@ -486,9 +482,8 @@ Task scheduling Spring 2.0 offers an abstraction around the scheduling of tasks. - For the interested developer, the section entitled contains all of the - details. + For the interested developer, + contains all of the details. The TaskExecutor abstraction is used throughout the framework itself as well, e.g. for the asynchronous JMS support. diff --git a/spring-framework-reference/src/new-in-3.xml b/spring-framework-reference/src/new-in-3.xml index 564ef22480b..81de6545022 100644 --- a/spring-framework-reference/src/new-in-3.xml +++ b/spring-framework-reference/src/new-in-3.xml @@ -306,6 +306,10 @@ public class RewardsTestDatabase { @Bean + + @DependsOn + + @Primary @@ -324,8 +328,10 @@ public class RewardsTestDatabase { Here is an example of a Java class providing basic configuration - using the new JavaConfig features: @Configuration -public class AppConfig{ + using the new JavaConfig features: package org.example.config; + +@Configuration +public class AppConfig { private @Value("#{jdbcProperties.url}") String jdbcUrl; private @Value("#{jdbcProperties.username}") String username; private @Value("#{jdbcProperties.password}") String password; @@ -357,8 +363,9 @@ public class AppConfig{ } To get this to work you need to add the following component scanning entry in your minimal application context XML file. - <context:component-scan - base-package="com.myco.config"/> + <context:component-scan base-package="org.example.config"/> +<util:properties id="jdbcProperties" location="classpath:org/example/config/jdbc.properties"/> +
diff --git a/spring-framework-reference/src/portlet.xml b/spring-framework-reference/src/portlet.xml index be0c6e49350..c9e06979a9f 100644 --- a/spring-framework-reference/src/portlet.xml +++ b/spring-framework-reference/src/portlet.xml @@ -116,7 +116,7 @@ normal and global). This is not a specific feature of Spring Portlet MVC itself, but rather of the WebApplicationContext container(s) that Spring Portlet MVC uses. These bean scopes are described - in detail in the section entitled + in detail in
@@ -921,8 +921,8 @@ public class SampleController extends AbstractController { the view technologies from Spring Web MVC. This includes not only the various View implementations themselves, but also the ViewResolver implementations. - For more information, refer to the sections entitled - and respectively. + For more information, refer to and + respectively. A few items on using the existing View and ViewResolver implementations are worth mentioning: @@ -1798,4 +1798,4 @@ public class MyFormController { of your portlets. - \ No newline at end of file + diff --git a/spring-framework-reference/src/resources.xml b/spring-framework-reference/src/resources.xml index cdc29acdd9b..be7a0964b82 100644 --- a/spring-framework-reference/src/resources.xml +++ b/spring-framework-reference/src/resources.xml @@ -329,8 +329,8 @@ Loaded as a URL, from the filesystem. - But see also the section entitled . + But see also + . @@ -394,9 +394,9 @@ ResourceLoader as an alternative to implementing the ResourceLoaderAware interface. The "traditional" constructor and byType - autowiring modes (as described in the section entitled - ) are now capable of providing a - dependency of type ResourceLoader for either a + autowiring modes (as described in ) + are now capable of providing a dependency of type + ResourceLoader for either a constructor argument or setter method parameter respectively. For more flexibility (including the ability to autowire fields and multiple parameter methods), consider using the new annotation-based autowiring features. In that case, the @@ -405,7 +405,7 @@ ResourceLoader type as long as the field, constructor, or method in question carries the @Autowired annotation. For more information, - see the section entitled . + see .
@@ -739,4 +739,4 @@ ApplicationContext ctx = new FileSystemXmlApplicationContext("file:/conf/context.xml");]]>
- \ No newline at end of file + diff --git a/spring-framework-reference/src/view.xml b/spring-framework-reference/src/view.xml index e93f1d8db06..1e8c7adcbbd 100644 --- a/spring-framework-reference/src/view.xml +++ b/spring-framework-reference/src/view.xml @@ -1669,8 +1669,7 @@ New York This example is a trivial Spring application that creates a list of words in the Controller and adds them to the model map. The map is returned along with the view name of our - XSLT view. See the section entitled - for details of Spring Web MVC's + XSLT view. See for details of Spring Web MVC's Controller interface. The XSLT view will turn the list of words into a simple XML document ready for transformation. diff --git a/spring-framework-reference/src/web-integration.xml b/spring-framework-reference/src/web-integration.xml index 177cb2c5390..c322ee5bd27 100644 --- a/spring-framework-reference/src/web-integration.xml +++ b/spring-framework-reference/src/web-integration.xml @@ -51,8 +51,8 @@ to use Struts for the presentation layer of your web application, the assumption is that you are already familiar with Struts. If you need further details about any of the supported web frameworks themselves, - please do consult the section entitled at the end of this chapter. + please do consult at the end + of this chapter. diff --git a/spring-framework-reference/src/xsd-configuration.xml b/spring-framework-reference/src/xsd-configuration.xml index 3dc0c6957c9..8605baf0cfc 100644 --- a/spring-framework-reference/src/xsd-configuration.xml +++ b/spring-framework-reference/src/xsd-configuration.xml @@ -364,7 +364,7 @@ public class Client { List implementation will be chosen by the container. Finally, you can also control the merging behavior using the 'merge' attribute of the <util:list/> - element; collection merging is described in more detail in the section entitled + element; collection merging is described in more detail in .
@@ -409,7 +409,7 @@ public class Client { Map implementation will be chosen by the container. Finally, you can also control the merging behavior using the 'merge' attribute of the <util:map/> - element; collection merging is described in more detail in the section entitled + element; collection merging is described in more detail in .
@@ -454,7 +454,7 @@ public class Client { Set implementation will be chosen by the container. Finally, you can also control the merging behavior using the 'merge' attribute of the <util:set/> - element; collection merging is described in more detail in the section entitled + element; collection merging is described in more detail in .
@@ -776,19 +776,19 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem
<literal><component-scan/></literal> - This element is detailed in the section entitled . + This element is detailed in .
<literal><load-time-weaver/></literal> - This element is detailed in the section entitled . + This element is detailed in .
<literal><spring-configured/></literal> - This element is detailed in the section entitled . + This element is detailed in .
<literal><mbean-export/></literal> - This element is detailed in the section entitled . + This element is detailed in .
@@ -811,7 +811,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem Last but not least we have the tags in the beans schema. These are the same tags that have been in Spring since the very dawn of the framework. Examples of the various tags in the beans schema are not shown here - because they are quite comprehensively covered in the section entitled + because they are quite comprehensively covered in (and indeed in that entire chapter). One thing that is new to the beans tags themselves in Spring 2.0 is the idea of arbitrary bean metadata. In Spring 2.0 it is now possible to add zero or more