25.02.2015 Views

Introducing Spring Framework

Introducing Spring Framework

Introducing Spring Framework

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd<br />

http://www.springframework.org/schema/beans<br />

http://www.springframework.org/schema/beans/spring-beans.xsd<br />

http://www.springframework.org/schema/context<br />

http://www.springframework.org/schema/context/spring-context-4.0.xsd<br />

http://www.springframework.org/schema/rabbit<br />

http://www.springframework.org/schema/rabbit/spring-rabbit-1.2.xsd<br />

http://www.springframework.org/schema/util<br />

http://www.springframework.org/schema/util/spring-util-4.0.xsd"><br />

<br />

<br />

<br />

<br />

<br />

As you can see in Listing 16-6, you have split the context into two more resources so you don’t clutter your main<br />

configuration. It is important to know that at some point you are going to have many beans defined in your XML<br />

configurations, and one easy practice will be to separate them to better organize your concerns. In this example, you<br />

are separating a file for a RabbitMQ configuration and another for a JDBC.<br />

Listing 16-7 shows the JDBC that you are going to use to send some documents to RabbitMQ using the<br />

RabbitMQProducer class.<br />

Listing 16-7. mydocuments-jdbc-context.xml<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

select d.documentId, d.name, d.location, d.description as doc_desc,<br />

d.typeId, d.created, d.modified,<br />

t.name as type_name, t.description as type_desc, t.extension from<br />

documents d<br />

221

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

Saved successfully!

Ooh no, something went wrong!