diff --git a/spring-framework-reference/src/cci.xml b/spring-framework-reference/src/cci.xml index 4dcdad0c4d6..94528573a00 100644 --- a/spring-framework-reference/src/cci.xml +++ b/spring-framework-reference/src/cci.xml @@ -94,7 +94,7 @@ In a managed mode, you access a ConnectionFactory from JNDI; its properties will be configured in the application server. - + ]]> @@ -105,7 +105,7 @@ implementation of your connector, exposing the application-level CCI ConnectionFactory. - + @@ -142,7 +142,7 @@ in the application server (in managed mode) or on the corresponding local ManagedConnectionFactory implementation. - getConnection variant without argument, else the one with the ConnectionSpec argument. - @@ -190,7 +190,7 @@ proxies that behave accordingly, all sharing the same underlying physical connection. - @@ -235,7 +235,7 @@ developer can use a dedicated implementation of the RecordCreator interface. - @@ -249,7 +249,7 @@ shows how to use the RecordCreator interface and indexed/mapped records. - CciTemplate for extracting data from the output Record. - The following sample shows how to use the RecordExtractor interface. - Interaction interface provides two execute method signatures: - Interaction interface. - CciTemplate methods are the following: - CciTemplate.execute(..) methods. - ConnectionFactory, exposing it to concrete data access implementations in subclasses. - CciTemplate. This could be done in the application code like so: - + Or (recommended) in the Spring configuration, if the CciTemplate is configured as a dedicated bean instance: - + @@ -593,7 +593,7 @@ can be useful for example to get an associated RecordFactory instance and create indexed/mapped records, for example. - ConnectionFactory. - InteractionSpec must be done to specify which CICS program to access and how to interact with it. - Then the program can use CCI via Spring's template and specify mappings between custom objects and CCI Records. - As discussed previously, callbacks can be used to work directly on CCI connections or interactions. - Interaction will be managed and closed by the CciTemplate in this case. - For the examples above, the corresponding configuration of the involved Spring beans could look like this in non-managed mode: - + @@ -732,7 +732,7 @@ interactionSpec.setInteractionVerb(ECIInteractionSpec.SYNC_SEND_RECEIVE);]]>In managed mode (that is, in a J2EE environment), the configuration could look as follows: - + @@ -781,7 +781,7 @@ interactionSpec.setInteractionVerb(ECIInteractionSpec.SYNC_SEND_RECEIVE);]]>Here are the signatures of these methods: - - InteractionSpec: - @@ -827,7 +827,7 @@ MyMappingRecordOperation eisOperation = new MyMappingRecordOperation(getConnecti convert an input object into an input COMMAREA and the output COMMAREA into an output object. - Person class. - - The corresponding configuration of Spring beans could look as follows in non-managed mode: - @@ -990,7 +990,7 @@ MyMappingRecordOperation eisOperation = new MyMappingRecordOperation(getConnecti In managed mode (that is, in a J2EE environment), the configuration could look as follows: - + @@ -1021,7 +1021,7 @@ MyMappingRecordOperation eisOperation = new MyMappingRecordOperation(getConnecti initialized to specify which CICS program to access and how to interact with it. - Records. - The corresponding configuration of Spring beans could look as follows in non-managed mode: - + @@ -1086,7 +1086,7 @@ MyMappingRecordOperation eisOperation = new MyMappingRecordOperation(getConnecti In managed mode (that is, in a J2EE environment), the configuration could look as follows: - + @@ -1106,7 +1106,7 @@ MyMappingRecordOperation eisOperation = new MyMappingRecordOperation(getConnecti example with a CICS ECI connector), global transactions (for example with an IMS connector). - + @@ -1131,7 +1131,7 @@ MyMappingRecordOperation eisOperation = new MyMappingRecordOperation(getConnecti executes such local CCI transactions, fully compliant with Spring's generic PlatformTransactionManager abstraction. - + diff --git a/spring-framework-reference/src/dtd.xml b/spring-framework-reference/src/dtd.xml index 1108904986e..15444146978 100644 --- a/spring-framework-reference/src/dtd.xml +++ b/spring-framework-reference/src/dtd.xml @@ -2,7 +2,7 @@ <literal>spring-beans-2.0.dtd</literal> - <!-- + <!-- Spring XML Beans DTD, version 2.0 Authors: Rod Johnson, Juergen Hoeller, Alef Arendsen, Colin Sampaleanu, Rob Harrop diff --git a/spring-framework-reference/src/dynamic-languages.xml b/spring-framework-reference/src/dynamic-languages.xml index e03c62bca3b..1522b6218fc 100644 --- a/spring-framework-reference/src/dynamic-languages.xml +++ b/spring-framework-reference/src/dynamic-languages.xml @@ -119,7 +119,7 @@ class GroovyMessenger implements Messenger { For more information on schema-based configuration, see . - + ]]><!-- this bean is now 'refreshable' due to the presence of the 'refresh-check-delay' attribute --> - + package org.springframework.scripting.groovy; @@ -433,7 +433,7 @@ class GroovyMessenger implements Messenger { characters to denote a '<' character. In such a case surrounding the inline source in a <![CDATA[]]> region might be better.) - + require 'java' @@ -484,7 +484,7 @@ class GroovyMessenger implements Messenger { String anotherMessage }]]> - ]]> <!-- this next constructor argument will *not* be injected into the GroovyMessenger --> @@ -579,7 +579,7 @@ RubyMessenger.new]]> And here is the Spring XML that defines an instance of the RubyMessenger JRuby bean. - @@ -683,7 +683,7 @@ class GroovyCalculator implements Calculator { x + y } }]]> - <-- from the file 'beans.xml' --><-- from the file 'beans.xml' --> ]]> @@ -765,7 +765,7 @@ public class Main { Actually making use of a GroovyObjectCustomizer is easy if you are using the Spring 2.0 namespace support. - <!-- define the GroovyObjectCustomizer just like any other bean --> + <!-- define the GroovyObjectCustomizer just like any other bean --> ]]><!-- ... and plug it into the desired Groovy bean via the 'customizer-ref' attribute -->GroovyObjectCustomizer functionality. - + ]]><!-- define the GroovyObjectCustomizer (as an inner bean) --> @@ -857,7 +857,7 @@ void setMessage(String aMessage) { And here is the Spring XML that defines an 'instance' of the above 'class' (again, the term is used very loosely here). - @@ -935,7 +935,7 @@ class FortuneController implements Controller { return new ModelAndView("tell", "fortune", this.fortuneService.tellFortune()) } }]]> - @@ -1037,7 +1037,7 @@ class TestBeanValidator implements Validator { to define a Groovy bean scoped as a prototype. - + @@ -105,7 +105,7 @@ on the controller. This will save the reference as an instance variable in the controller: - myComponent property of the controller is done with a configuration entry such as: - @@ -148,7 +148,7 @@ public void setMyComponent(MyComponent myComponent) { consider using the <jee:local-slsb> configuration element in Spring's "jee" namespace: - @@ -278,19 +278,19 @@ public void setMyComponent(MyComponent myComponent) { Consider an example Stateless Session bean which actually delegates the implementation to a plain java service object. We have the business interface: - We also have the plain Java implementation object: - And finally the Stateless Session Bean itself: - - businessApplicationContext.xml contains the bean definitions for all business service POJOs): - + @@ -376,7 +376,7 @@ public void setMyComponent(MyComponent myComponent) { In the above example, the ServicesConstants.PRIMARY_CONTEXT_ID constant would be defined as follows: - + Please see the respective Javadocs for the BeanFactoryLocator and ContextSingletonBeanFactoryLocator classes for more information on @@ -395,7 +395,7 @@ public void setMyComponent(MyComponent myComponent) { in the EJB component class, or through an interceptor-binding XML element in the EJB deployment descriptor. - - java.util.Map is converted to a message. - Below is a simple implementation of an MDP: - Find below an example of how to define and configure one of the message listener containers that ships with Spring (in this case the DefaultMessageListenerContainer). - <!-- this is the Message Driven POJO (MDP) --> + <!-- this is the Message Driven POJO (MDP) --> ]]><!-- and this is the message listener container -->MessageListener interface, but also provides the message handling method with access to the JMS Session from which the Message was received. - contents of the various Message types that they can receive and handle. - - // implementation elided for clarity... In particular, note how the above implementation of the MessageDelegate interface (the above DefaultMessageDelegate class) has no JMS dependencies at all. It truly is a POJO that we will make into an MDP via the following configuration. - <!-- this is the Message Driven POJO (MDP) --> + <!-- this is the Message Driven POJO (MDP) --> @@ -646,16 +646,16 @@ public interface SessionAwareMessageListener { 'handleMessage'), but it is configurable (as you will see below). Notice also how the 'receive(..)' method is strongly typed to receive and respond only to JMS TextMessage messages. - - // implementation elided for clarity... The configuration of the attendant MessageListenerAdapter would look like this: - + @@ -673,12 +673,12 @@ public interface SessionAwareMessageListener { class is the ability to automatically send back a response Message if a handler method returns a non-void value. Consider the interface and class: - // notice the return type... - // implementation elided for clarity... If the above DefaultResponsiveTextMessageDelegate is used in @@ -714,7 +714,7 @@ public interface SessionAwareMessageListener { implementation, covering the case where database processing has committed but message processing failed to commit. - + @@ -736,13 +736,13 @@ public interface SessionAwareMessageListener { part of the same transaction (with unified commit semantics, at the expense of XA transaction log overhead). - + ]]> Then you just need to add it to our earlier container configuration. The container will take care of the rest. - + @@ -763,7 +763,7 @@ public interface SessionAwareMessageListener { JmsActivationSpecConfig as shown in the following example. - + @@ -778,7 +778,7 @@ public interface SessionAwareMessageListener { ActivationSpec object may also come from a JNDI lookup (using <jee:jndi-lookup>). - + @@ -793,7 +793,7 @@ public interface SessionAwareMessageListener { the target ResourceAdapter may be configured locally as depicted in the following example. - + @@ -846,7 +846,7 @@ public interface SessionAwareMessageListener { Spring 2.5 introduces an XML namespace for simplifying JMS configuration. To use the JMS namespace elements you will need to reference the JMS schema: - + xmlns:jms="http://www.springframework.org/schema/jms"<listener/> child elements. Here is an example of a basic configuration for two listeners. - + @@ -956,7 +956,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem highly-customized listener containers while still benefiting from the convenience of the namespace. - Configuring a JCA-based listener container with the "jms" schema support is very similar. - diff --git a/spring-framework-reference/src/jmx.xml b/spring-framework-reference/src/jmx.xml index de53abc63ba..7d992c2022b 100644 --- a/spring-framework-reference/src/jmx.xml +++ b/spring-framework-reference/src/jmx.xml @@ -60,7 +60,7 @@ MBeanServer. For example, consider the following class: - MBeanExporter class in your configuration file and pass in the bean as shown below: - + ]]><!-- this bean must not be lazily initialized if the exporting is to happen --> MBeanServer value returned by an MBeanServerFactoryBean; for example: - + @@ -204,7 +204,7 @@ public class JmxTestBean implements IJmxTestBean { cases, one should use the MBeanServer agentId to indicate which instance to be used: - + ]]><!-- indicate to first look for a server --> @@ -222,7 +222,7 @@ public class JmxTestBean implements IJmxTestBean { has a dynamic (or unknown) agentId which is retrieved through lookup methods, one should use factory-method: - + ]]><!-- Custom MBeanServerLocator -->MBeanExporter by setting the autodetect property to true: - + @@ -369,7 +369,7 @@ public class JmxTestBean implements IJmxTestBean { default registration behavior to the REGISTRATION_REPLACE_EXISTING behavior: - + @@ -455,7 +455,7 @@ public class JmxTestBean implements IJmxTestBean { class that you saw earlier marked with Commons Attributes metadata: - MBeanExporter to use the MetadataMBeanInfoAssembler: - + @@ -592,7 +592,7 @@ public class JmxTestBean implements IJmxTestBean { The example below shows a bean where the management interface is defined by the presence of JDK 5.0 annotation types: - As you can see little has changed, other than the basic syntax of the metadata definitions. - + @@ -910,7 +910,7 @@ public class AnnotationTestBean implements IJmxTestBean { ObjectName which results in a configuration like this: - + ]]><!-- notice how no 'beans' are explicitly configured here -->JmxTestBean class that you saw earlier: - - + @@ -1055,7 +1055,7 @@ public class AnnotationTestBean implements IJmxTestBean { as attributes and operations. The code below shows a sample configuration for this: - + @@ -1120,7 +1120,7 @@ public class AnnotationTestBean implements IJmxTestBean { The code below shows a sample configuration for the KeyNamingStrategy: - + @@ -1174,7 +1174,7 @@ public class AnnotationTestBean implements IJmxTestBean { configuration for the MetadataNamingStrategy: - + @@ -1208,7 +1208,7 @@ public class AnnotationTestBean implements IJmxTestBean { following bean would be: com.foo:type=MyClass,name=myBean. - ]]> + ]]> @@ -1225,7 +1225,7 @@ public class AnnotationTestBean implements IJmxTestBean { 'context' namespace in Spring 2.5. Rather than defining an MBeanExporter bean, provide this single element: - ]]> + ]]> You can provide a reference to a particular MBean server if necessary, and the defaultDomain attribute @@ -1237,7 +1237,7 @@ public class AnnotationTestBean implements IJmxTestBean { MetadataNamingStrategy. - ]]>. + ]]>. Do not use interface-based AOP proxies in combination with autodetection of @@ -1266,7 +1266,7 @@ public class AnnotationTestBean implements IJmxTestBean { JMXConnectorServer use the following configuration: - <bean id="serverConnector" class="org.springframework.jmx.support.ConnectorServerFactoryBean"/> + <bean id="serverConnector" class="org.springframework.jmx.support.ConnectorServerFactoryBean"/> By default ConnectorServerFactoryBean creates a JMXConnectorServer bound to @@ -1283,7 +1283,7 @@ public class AnnotationTestBean implements IJmxTestBean { MBeanServer use the serviceUrl and ObjectName properties respectively: - ConnectorServerFactoryBean when creating a JMXConnector: - - + ]]> @@ -1332,7 +1332,7 @@ public class AnnotationTestBean implements IJmxTestBean { MBeanServerConnectionFactoryBean as shown below: - + ]]> @@ -1349,7 +1349,7 @@ public class AnnotationTestBean implements IJmxTestBean { of protocols like SOAP, Hessian, Burlap over simple HTTP or SSL and others: - + ]]> @@ -1369,7 +1369,7 @@ public class AnnotationTestBean implements IJmxTestBean { proxy for an MBean running in a local MBeanServer: - + ]]> @@ -1391,7 +1391,7 @@ public class AnnotationTestBean implements IJmxTestBean { pointing to a remote MBeanServer to cater for proxies pointing to remote MBeans: - @@ -1429,7 +1429,7 @@ public class AnnotationTestBean implements IJmxTestBean { would like to be informed (via a Notification) each and every time an attribute of a target MBean changes. - - + @@ -1486,7 +1486,7 @@ public class ConsoleLoggingNotificationListener You can also use straight bean names as the link between exported beans and listeners: - + @@ -1516,7 +1516,7 @@ public class ConsoleLoggingNotificationListener as the key for an entry in the notificationListenerMappings property map; for example: - + @@ -1545,7 +1545,7 @@ public class ConsoleLoggingNotificationListener NotificationListenerBean instances is not wildly different to what was presented previously: - + @@ -1586,7 +1586,7 @@ public class ConsoleLoggingNotificationListener section of the JMX specification (1.2) entitled 'The JMX Notification Model'.) - + @@ -1689,7 +1689,7 @@ public class ConsoleLoggingNotificationListener a NotificationEvent every time the add(int, int) operation is invoked. - Usage Let's assume there is a business interface called OrderManager: - @@ -59,7 +59,7 @@
Basic <interfacename>MailSender</interfacename> and <classname>SimpleMailMessage</classname> usage - Find below the bean definitions for the above code: - + @@ -126,7 +126,7 @@ public class SimpleOrderManager implements OrderManager { JavaMailSender so that we are able to use the JavaMail MimeMessage class: - MimeMessageHelper it is pretty easy to create a MimeMessage: - // of course you would use DI in any real-world cases// of course you would use DI in any real-world cases The following example shows you how to use the MimeMessageHelper to send an email along with a single JPEG image attachment. - The following example shows you how to use the MimeMessageHelper to send an email along with an inline image. - template that this example will be using... as you can see it is HTML-based, and since it is plain text it can be created using your favorite HTML editor without recourse to having to know Java. - # in the com/foo/package# in the com/foo/package

Hi ${user.userName}, welcome to the Chipping Sodbury On-the-Hill message boards!

@@ -323,7 +323,7 @@ sender.send(message);]]>
Find below some simple code and Spring XML configuration that makes use of the above Velocity template to create email content and send email(s). - - + The Spring Attributes interface looks like this: - The best way to illustrate the usage of this annotation is to show an example: - // the SimpleMovieLister has a dependency on the MovieFindernot pass validation. - + ]]><!-- whoops, no MovieFinder is set (and this property is @Required) -->]]> @@ -213,7 +213,7 @@ public void echoException(Exception ex) throws Exception { to configure; simply drop the following bean definition into your Spring XML configuration. - ]]> + ]]> Finally, one can configure an instance of the RequiredAnnotationBeanPostProcessor class to look @@ -229,7 +229,7 @@ public void echoException(Exception ex) throws Exception { You can make a RequiredAnnotationBeanPostProcessor instance @Mandatory-aware like so: - + ]]> @@ -238,7 +238,7 @@ public void echoException(Exception ex) throws Exception { is itself annotated with appropriate annotations for its target and runtime retention policy. - - ]]> + ]]> 3. Next, define an attribute compilation task, which will use the Commons Attributes attribute-compiler task to "compile" the attributes in @@ -359,7 +359,7 @@ public @interface Mandatory { to a location specified by the destdir attribute. Here we show the use of a temporary directory for storing the generated files: - + @@ -397,7 +397,7 @@ public @interface Mandatory { create an index of all the attributes defined on your sources, for efficient lookup at runtime. The step looks like this: - + @@ -432,7 +432,7 @@ public @interface Mandatory { This builds on the Spring AOP autoproxy functionality. Configuration might look like this: - + diff --git a/spring-framework-reference/src/remoting.xml b/spring-framework-reference/src/remoting.xml index 7e95763ed92..103747bc073 100644 --- a/spring-framework-reference/src/remoting.xml +++ b/spring-framework-reference/src/remoting.xml @@ -54,7 +54,7 @@ While discussing the remoting capabilities of Spring, we'll use the following domain model and corresponding services: - - - - // the implementation doing nothing at the moment// the implementation doing nothing at the moment Of course, we first have to set up our service in the Spring container: - + ]]><!-- any additional properties, maybe a DAO? -->]]> Next we'll have to expose our service using the RmiServiceExporter: - + ]]><!-- does not necessarily have to be the same name as the bean to be exported --> @@ -138,7 +138,7 @@ public class AccountServiceImpl implements AccountService { Linking in the service at the client Our client is a simple object using the AccountService to manage accounts: - To link in the service on the client, we'll create a separate Spring container, containing the simple object and the service linking configuration bits: - + @@ -176,7 +176,7 @@ public class AccountServiceImpl implements AccountService { from Spring Web MVC usage, you can easily wire up such a servlet exposing your services. First we'll have to create a new servlet in your application (this an excerpt from 'web.xml'): - + remoting org.springframework.web.servlet.DispatcherServlet 1 @@ -203,7 +203,7 @@ public class AccountServiceImpl implements AccountService { Exposing your beans by using the <classname>HessianServiceExporter</classname> In the newly created application context called remoting-servlet.xml, we'll create a HessianServiceExporter exporting your services: - + ]]><!-- any additional properties, maybe a DAO? --> @@ -219,7 +219,7 @@ public class AccountServiceImpl implements AccountService { Alternatively, create a HessianServiceExporter in your root application context (e.g. in 'WEB-INF/applicationContext.xml'): - + ]]> @@ -227,7 +227,7 @@ public class AccountServiceImpl implements AccountService { in 'web.xml', with the same end result: The exporter getting mapped to the request path /remoting/AccountService. Note that the servlet name needs to match the bean name of the target exporter. - + accountExporter org.springframework.web.context.support.HttpRequestHandlerServlet @@ -245,7 +245,7 @@ public class AccountServiceImpl implements AccountService { a separate bean factory or application context and mention the following beans where the SimpleObject is using the AccountService to manage accounts: - + @@ -271,7 +271,7 @@ public class AccountServiceImpl implements AccountService { features, for example. Usually, you don't use per-user security credentials here, but rather shared credentials defined at the Hessian/BurlapProxyFactoryBean level (similar to a JDBC DataSource). - + @@ -315,7 +315,7 @@ public class AccountServiceImpl implements AccountService { To expose the AccountService (mentioned above) within a Spring Web MVC DispatcherServlet, the following configuration needs to be in place in the dispatcher's application context: - + @@ -325,14 +325,14 @@ public class AccountServiceImpl implements AccountService { as explained in the section on Hessian. Alternatively, create an HttpInvokerServiceExporter in your root application context (e.g. in 'WEB-INF/applicationContext.xml'): - + ]]> In addition, define a corresponding servlet for this exporter in 'web.xml', with the servlet name matching the bean name of the target exporter: - + accountExporter org.springframework.web.context.support.HttpRequestHandlerServlet @@ -349,7 +349,7 @@ public class AccountServiceImpl implements AccountService { do it when using Hessian or Burlap. Using a proxy, Spring will be able to translate your calls to HTTP POST requests to the URL pointing to the exported service. - + @@ -358,7 +358,7 @@ public class AccountServiceImpl implements AccountService { By default, the HttpInvokerProxy uses the J2SE HTTP functionality, but you can also use the Commons HttpClient by setting the httpInvokerRequestExecutor property: - + ]]> @@ -404,7 +404,7 @@ public class AccountServiceImpl implements AccountService { AccountService we extend Spring's ServletEndpointSupport class and implement our business logic here, usually delegating the call to the business layer. - /** + /** * JAX-RPC compliant RemoteAccountService implementation that simply delegates * to the AccountService implementation in the root web application context. * @@ -455,7 +455,7 @@ public class AccountServiceEndpoint extends ServletEndpointSupport implements Re in the previous section. You will see that Spring has great support for web services requiring little coding efforts - most of the setup is done in the Spring configuration file as usual: - + @@ -470,13 +470,13 @@ public class AccountServiceEndpoint extends ServletEndpointSupport implements Re Accessing the web service is now very easy as we have a bean factory for it that will expose it as RemoteAccountService interface. We can wire this up in Spring: - + ... ]]> From the client code we can access the web service just as if it was a normal class, except that it throws RemoteException. -RemoteException. This requires that we provide a non-RMI interface also. Our configuration is now: - + ]]> Where serviceInterface is changed to our non RMI interface. Our RMI interface is now defined using the property portInterface. Our client code can now avoid handling java.rmi.RemoteException: - We will use Axis to register bean mappings on the client side. To do this we need to register the bean mappings programmatically: - Handler is a callback interface. There is a convenience base class provided in jaxrpc.jar, namely javax.rpc.xml.handler.GenericHandler that we will extend: - postProcessJaxRpcService(..) method that is designed for this: - The last thing we must remember to do is to change the Spring configuration to use our factory bean: - + ... ]]>
@@ -615,7 +615,7 @@ public class AccountServiceEndpoint extends ServletEndpointSupport implements Re logic here, usually delegating the call to the business layer. We'll simply use Spring 2.5's @Autowired annotation for expressing such dependencies on Spring-managed beans. - /** + /** * JAX-WS compliant AccountService implementation that simply delegates * to the AccountService implementation in the root web application context. * @@ -669,7 +669,7 @@ public class AccountServiceEndpoint extends SpringBeanAutowiringSupport { Of course, annotation-driven injection through @Autowired will work as well. - +
@@ -684,7 +684,7 @@ public class AccountServiceEndpoint extends SpringBeanAutowiringSupport { This means that the endpoint implementation may look like as follows, without any superclass declared - and Spring's @Autowired configuration annotation still being honored: - AccountService endpoint (again): - + @@ -745,13 +745,13 @@ public class AccountServiceEndpoint { Accessing the web service is now very easy as we have a bean factory for it that will expose it as AccountService interface. We can wire this up in Spring: - + ...
]]>
From the client code we can access the web service just as if it was a normal class: - DispatcherServlet with a corresponding WebApplicationContext containing the services you will be exposing: - + xfire org.springframework.web.servlet.DispatcherServlet ]]> @@ -788,7 +788,7 @@ public class AccountServiceEndpoint { file to the contextConfigLocations context parameter picked up by the ContextLoaderListener (or ContextLoaderServlet for that matter). - + contextConfigLocation classpath:org/codehaus/xfire/spring/xfire.xml @@ -801,7 +801,7 @@ public class AccountServiceEndpoint { declared above) you only have to add one extra bean to expose the service using XFire. Add for example the following configuration in your 'xfire-servlet.xml' file: - + @@ -828,14 +828,14 @@ public class AccountServiceEndpoint { same non-transactional Session, and as such throughput will be very implementation dependent. The following interface is used on both the server and the client side. - The following simple implementation of the above interface is used on the server-side. - This configuration file contains the JMS-infrastructure beans that are shared on both the client and server. - + + - + JobDetail more of an actual JavaBean with sensible defaults. Let's have a look at an example: - @@ -50,7 +50,7 @@ So in this case, if the ExampleJob contains a property named timeout, the JobDetailBean will automatically apply it: - Using the MethodInvokingJobDetailFactoryBean Often you just need to invoke a method on a specific object. Using the MethodInvokingJobDetailFactoryBean you can do exactly this: - + ]]> The above example will result in the doIt method being called on the exampleBusinessObject method (see below): - // properties and collaborators - ]]> Using the MethodInvokingJobDetailFactoryBean, you don't need to create one-line jobs that just invoke a method, and you only need to create the actual @@ -106,7 +106,7 @@ public class ExampleJob extends QuartzJobBean { will not start before the first one has finished. To make jobs resulting from the MethodInvokingJobDetailFactoryBean non-concurrent, set the concurrent flag to false. - @@ -132,7 +132,7 @@ public class ExampleJob extends QuartzJobBean { schedules the actual jobs with those triggers. Find below a couple of examples: - + @@ -149,7 +149,7 @@ public class ExampleJob extends QuartzJobBean { Now we've set up two triggers, one running every 50 seconds with a starting delay of 10 seconds and one every morning at 6 AM. To finalize everything, we need to set up the SchedulerFactoryBean: - + @@ -180,7 +180,7 @@ public class ExampleJob extends QuartzJobBean { Using the TimerTask you can create customer timer tasks, similar to Quartz jobs: - Wiring it up is simple: - + test@springframework.org @@ -225,7 +225,7 @@ public class ExampleJob extends QuartzJobBean { Similar to the Quartz support, the Timer support also features a component that allows you to periodically invoke a method: - +
]]>
@@ -233,7 +233,7 @@ public class ExampleJob extends QuartzJobBean { The above example will result in the doIt method being called on the exampleBusinessObject (see below): - // properties and collaboratorsTimerFactoryBean sets up an actual Timer and schedules the tasks it has references to. You can specify whether or not daemon threads should be used. - + ]]><!-- see the example above -->ThreadPoolTaskExecutor to asynchronously print out a set of messages. - To configure the rules that the TaskExecutor will use, simple bean properties have been exposed. - + diff --git a/spring-framework-reference/src/transaction.xml b/spring-framework-reference/src/transaction.xml index 64a8e86ecc6..d136205e51d 100644 --- a/spring-framework-reference/src/transaction.xml +++ b/spring-framework-reference/src/transaction.xml @@ -1015,6 +1015,7 @@ Exception in thread "main" java.lang.UnsupportedOperationException +
diff --git a/spring-framework-reference/src/xml-custom.xml b/spring-framework-reference/src/xml-custom.xml index 96755e91bec..0936a8a1529 100644 --- a/spring-framework-reference/src/xml-custom.xml +++ b/spring-framework-reference/src/xml-custom.xml @@ -37,7 +37,7 @@ SimpleDateFormat (from the java.text package) in an easy manner. When we are done, we will be able to define bean definitions of type SimpleDateFormat like this: - ]]> @@ -51,7 +51,7 @@ starts with authoring an XML Schema to describe the extension. What follows is the schema we'll use to configure SimpleDateFormat objects. - <!-- myns.xsd (inside package org/springframework/samples/xml) --><!-- myns.xsd (inside package org/springframework/samples/xml) --> The above schema will be used to configure SimpleDateFormat objects, directly in an XML application context file using the <myns:dateformat/> element. - ]]> @@ -92,7 +92,7 @@ we're just creating a bean in the container, identified by the name 'dateFormat' of type SimpleDateFormat, with a couple of properties set. - + ]]> @@ -142,7 +142,7 @@ results in a single SimpleDateFormat bean definition). Spring features a number of convenience classes that support this scenario. In this example, we'll make use the NamespaceHandlerSupport class: - one distinct top-level XML element defined in the schema. In the parser, we'll have access to the XML element (and thus its subelements too) so that we can parse our custom XML content, as can be seen in the following example: - <dateformat/> element developed in the previous steps in a Spring XML configuration file. - + Nesting custom tags within custom tags This example illustrates how you might go about writing the various artifacts required to satisfy a target of the following configuration: - + 'components' property; this makes it hard (or rather impossible) to configure a bean definition for the Component class using setter injection. - The typical solution to this issue is to create a custom FactoryBean that exposes a setter property for the 'components' property. - the steps described previously, we'll start off by creating the XSD schema to define the structure of our custom tag. - + ]]> We'll then create a custom NamespaceHandler. - Next up is the custom BeanDefinitionParser. Remember that what we are creating is a BeanDefinition describing a ComponentFactoryBean. - JCache, and you want to ensure that the named JCache instance is eagerly started within the surrounding cluster: - jcache:cache-name="checking.account"><!-- other dependencies here... -->]]> @@ -481,7 +481,7 @@ http\://www.foo.com/schema/component/component.xsd=com/foo/component.xsd]]>BeanDefinition for the 'checkingAccountService' so that it will have a dependency on this new JCache-initializing BeanDefinition. - Now onto the custom extension. Firstly, the authoring of the XSD schema describing the custom attribute (quite easy in this case). - + ]]> Next, the associated NamespaceHandler. - Next, the parser. Note that in this case, because we are going to be parsing an XML attribute, we write a BeanDefinitionDecorator rather than a BeanDefinitionParser. - Referencing the schemas To switch over from the DTD-style to the new XML Schema-style, you need to make the following change. - + @@ -60,7 +60,7 @@ ]]> The equivalent file in the XML Schema-style would be... - + util namespace are available to you. - + xmlns:util="http://www.springframework.org/schema/util" <literal><util:constant/></literal> Before... - + @@ -129,7 +129,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem and clearly expresses the developer's intent ('inject this constant value'), and it just reads better. - + @@ -149,13 +149,13 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem using the staticField property: - ]]> There is also a convenience usage form where the static field is specified as the bean name: - ]]> This does mean that there is no longer any choice in what the bean id is (so @@ -164,7 +164,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem inner bean since the id doesn't have to be specified for the bean reference: - + @@ -183,7 +183,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem as the FieldRetrievingFactoryBean). Let's look at an example to see how easy injecting an enum value is; consider this JDK 5 enum: - Now consider a setter of type PersistenceContextType: - .. and the corresponding bean definition: - + ]]> @@ -216,7 +216,7 @@ public class Client {
<literal><util:property-path/></literal> Before... - <!-- target bean to be referenced by name --><!-- target bean to be referenced by name --> @@ -235,7 +235,7 @@ public class Client { property of the 'testBean' bean. After... - <!-- target bean to be referenced by name --><!-- target bean to be referenced by name --> @@ -257,7 +257,7 @@ public class Client { name. This value may then be used in another bean definition as a property value or constructor argument. Here's an example where a path is used against another bean, by name: - @@ -274,7 +274,7 @@ public class Client { ]]> In this example, a path is evaluated against an inner bean: - <!-- will result in 12, which is the value of property 'age' of the inner bean --><!-- will result in 12, which is the value of property 'age' of the inner bean --> @@ -285,14 +285,14 @@ public class Client { ]]> There is also a shortcut form, where the bean name is the property path. - <!-- will result in 10, which is the value of property 'age' of bean 'person' --><!-- will result in 10, which is the value of property 'age' of bean 'person' -->]]> This form does mean that there is no choice in the name of the bean. Any reference to it will also have to use the same id, which is the path. Of course, if used as an inner bean, there is no need to refer to it at all: - + @@ -306,7 +306,7 @@ public class Client {
<literal><util:properties/></literal> Before... - <!-- creates a java.util.Properties instance with values loaded from the supplied location --><!-- creates a java.util.Properties instance with values loaded from the supplied location --> ]]> @@ -316,13 +316,13 @@ public class Client { the supplied Resource location). After... - <!-- creates a java.util.Properties instance with values loaded from the supplied location --><!-- creates a java.util.Properties instance with values loaded from the supplied location -->]]>
<literal><util:list/></literal> Before... - <!-- creates a java.util.List instance with values loaded from the supplied 'sourceList' --><!-- creates a java.util.List instance with values loaded from the supplied 'sourceList' --> @@ -339,7 +339,7 @@ public class Client { with values taken from the supplied 'sourceList'. After... - <!-- creates a java.util.List instance with values loaded from the supplied 'sourceList' --><!-- creates a java.util.List instance with values loaded from the supplied 'sourceList' --> pechorin@hero.org raskolnikov@slums.org @@ -351,7 +351,7 @@ public class Client { attribute on the <util:list/> element. For example, if we really need a java.util.LinkedList to be instantiated, we could use the following configuration: - + jackshaftoe@vagabond.org eliza@thinkingmanscrumpet.org vanhoek@pirate.org @@ -367,7 +367,7 @@ public class Client {
<literal><util:map/></literal> Before... - <!-- creates a java.util.Map instance with values loaded from the supplied 'sourceMap' --><!-- creates a java.util.Map instance with values loaded from the supplied 'sourceMap' --> @@ -384,7 +384,7 @@ public class Client { with key-value pairs taken from the supplied 'sourceMap'. After... - <!-- creates a java.util.Map instance with values loaded from the supplied 'sourceMap' --><!-- creates a java.util.Map instance with values loaded from the supplied 'sourceMap' --> @@ -396,7 +396,7 @@ public class Client { attribute on the <util:map/> element. For example, if we really need a java.util.TreeMap to be instantiated, we could use the following configuration: - + @@ -412,7 +412,7 @@ public class Client {
<literal><util:set/></literal> Before... - <!-- creates a java.util.Set instance with values loaded from the supplied 'sourceSet' --><!-- creates a java.util.Set instance with values loaded from the supplied 'sourceSet' --> @@ -429,7 +429,7 @@ public class Client { with values taken from the supplied 'sourceSet'. After... - <!-- creates a java.util.Set instance with values loaded from the supplied 'sourceSet' --><!-- creates a java.util.Set instance with values loaded from the supplied 'sourceSet' --> pechorin@hero.org raskolnikov@slums.org @@ -441,7 +441,7 @@ public class Client { attribute on the <util:set/> element. For example, if we really need a java.util.TreeSet to be instantiated, we could use the following configuration: - + pechorin@hero.org raskolnikov@slums.org stavrogin@gov.org @@ -463,7 +463,7 @@ public class Client { the following preamble at the top of your Spring XML configuration file; the emboldened text in the following snippet references the correct schema so that the tags in the jee namespace are available to you. - + xmlns:jee="http://www.springframework.org/schema/jee" <literal><jee:jndi-lookup/></literal> (simple) Before... - + @@ -486,7 +486,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem dataSource"/>]]> After... - + ]]><!-- Spring will do the cast automatically (as usual) --> <literal><jee:jndi-lookup/></literal> (with single JNDI environment setting) Before... - + @@ -505,14 +505,14 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem ]]> After... - + foo=bar ]]>
<literal><jee:jndi-lookup/></literal> (with multiple JNDI environment settings) Before... - + @@ -522,7 +522,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem ]]> After... - + ]]><!-- newline-separated, key-value pairs for the environment (standard Properties format) --> foo=bar @@ -533,7 +533,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem
<literal><jee:jndi-lookup/></literal> (complex) Before... - + @@ -542,7 +542,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem ]]> After... - The <jee:local-slsb/> tag configures a reference to an EJB Stateless SessionBean. Before... - ]]> After... - ]]>
<literal><jee:local-slsb/></literal> (complex) - @@ -575,7 +575,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem ]]> After... - The <jee:remote-slsb/> tag configures a reference to a remote EJB Stateless SessionBean. Before... - @@ -598,7 +598,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem ]]> After... - lang namespace are available to you. - + xmlns:lang="http://www.springframework.org/schema/lang"jms namespace are available to you. - + xmlns:jms="http://www.springframework.org/schema/jms"tx namespace are available to you. - + aop namespace are available to you. - + xmlns:aop="http://www.springframework.org/schema/aop"BeanfactoryPostProcessors. The following snippet references the correct schema so that the tags in the context namespace are available to you. - + xmlns:context="http://www.springframework.org/schema/context"Find below an example of the <meta/> tag in the context of a surrounding <bean/> (please note that without any logic to interpret it the metadata is effectively useless as-is). - + + Create a new XML file (you can name this file whatever you want). In the example below, the file is named 'context.xml'. Copy and paste the following text into the file so that it matches the screenshot. - +