Excellent!  Many thanks; I'll give that a shot.

Joe Hindsley wrote:
Hi Rusty,

You can use your applicationContext.xml file, but you'll need to move it to the src/main/resources directory and update your web.xml to find it by looking on the classpath:

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext.xml</param-value>
</context-param>

When you build your war, the applicationContext.xml file will end up in the WEB-INF/classes directory.

The advantage of this method is you can easily override your applicationContext.xml for unit-tests by adding one to the src/test/resources directory. During the unit test phase, the resource files in the src/test/resources directory take precedence over the ones in the src/main/resources directory.

Hope this helps,

Joe Hindsley


Rusty Wright wrote:
So I'm not doing something right.

I have a test class that looks like the following

[code]
@ContextConfiguration
public final class EduUserDetailsServiceTest extends
        AbstractTestNGSpringContextTests {
private final transient Logger log = LoggerFactory.getLogger(getClass());

    @Autowired
    EduUserDetailsService eduUserDetailsService;
    ...
[/code]

This file is in the usual place where maven expects it, down in src/test/java, and the class it's testing, EduUserDetailsService is where maven expects it, down in src/main/java.

When I run 'mvn test' it blows up with a file not found exception for the file EduUserDetailsServiceTest-context.xml.

So that jibes with what the Spring Reference Guide says, but do I really need to create a <whatever>-context.xml file for each <whatever>.java test file I create? Can't I use my applicationContext.xml file that my main application is using? But it's way over in src/main/webapp/WEB-INF.

I'm lost in a twisty little maze. I'm hoping there's some maven pixie dust I'm missing that you maven wizards can share with me.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to