Introducing Spring Framework

Introducing Spring Framework Introducing Spring Framework

25.02.2015 Views

Chapter 16 ■ Messaging with Your Spring Application Listing 16-7 shows you the JDBC XML configuration, but why are you using this JDBC if you are going to use the RabbitMQ anyway? Well, you need to have some documents to send, right? So you are going to use the ones either in the in-memory database using JDBC or the documents in the MongoDB server. So let’s also see the MongoDB XML configuration in Listing 16-8. Listing 16-8. mydocuments-mongo-context.xml In Listings 16-7 and Listing 16-8, you are going to just take the documents from the in-memory database and the MongoDB server. Next, let’s see the Marshaller bean definition, shown in Listing 16-9. This XML configuration has the beans that will help to convert your documents into XML and vice versa. Listing 16-9. mydocuments-oxm-context.xml com.apress.isf.java.model.Document 223

Chapter 16 ■ Messaging with Your Spring Application Listing 16-9 shows the xstreamMarshaller bean that is a reference to the Spring’s org.springframework.oxm. xstream.XStreamMarshaller class that you are going to use as a helper, and it is being imported in the RabbitMQ XML context. You can also see that you are using some features that the XStream library provides, like the aliases, so instead of your XML starting with , it will alias to . You can check out the “Alias Tutorial” from the XStream web site at http://xstream.codehaus.org/alias-tutorial.html. Also, the book’s companion source code includes a unit test of the OXM Marshaller. Now, let’s take a look at the special XML configuration, the RabbitMQ, shown in Listing 16-10. Listing 16-10. mydocuments-rabbitmq-context.xml 224

Chapter 16 ■ Messaging with Your <strong>Spring</strong> Application<br />

Listing 16-9 shows the xstreamMarshaller bean that is a reference to the <strong>Spring</strong>’s org.springframework.oxm.<br />

xstream.XStreamMarshaller class that you are going to use as a helper, and it is being imported in the RabbitMQ<br />

XML context. You can also see that you are using some features that the XStream library provides, like the aliases, so<br />

instead of your XML starting with , it will alias to . You can<br />

check out the “Alias Tutorial” from the XStream web site at http://xstream.codehaus.org/alias-tutorial.html.<br />

Also, the book’s companion source code includes a unit test of the OXM Marshaller.<br />

Now, let’s take a look at the special XML configuration, the RabbitMQ, shown in Listing 16-10.<br />

Listing 16-10. mydocuments-rabbitmq-context.xml<br />

<br />

<br />

224<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!