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 8 ■ Give Advice to Your <strong>Spring</strong> Application<br />

Now, let’s do your XML. This should be very easy (see Listing 8-15) because you only need to declare your<br />

CachingModule class and make a reference into the engineProxy bean.<br />

Listing 8-15. mydocuments-aop-context.xml<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

caching<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Next, you are going to add an extra method call of findByType in your test so you can see that the caching is really<br />

working (see Listing 8-16).<br />

Listing 8-16. MyDocumentAOPTest.java<br />

package com.apress.isf.spring.test;<br />

import static org.junit.Assert.assertEquals;<br />

import static org.junit.Assert.assertNotNull;<br />

import static org.junit.Assert.assertTrue;<br />

import java.util.List;<br />

import org.junit.Test;<br />

import org.junit.runner.RunWith;<br />

import org.slf4j.Logger;<br />

import org.slf4j.LoggerFactory;<br />

import org.springframework.beans.factory.annotation.Autowired;<br />

105

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

Saved successfully!

Ooh no, something went wrong!