Results 1 to 2 of 2

Thread: Trouble with @ContextConfiguration and JUnit test

  1. #1
    Join Date
    Apr 2010
    Posts
    104

    Default Trouble with @ContextConfiguration and JUnit test

    Hi,

    I'm using Spring 3 and I have a class that has the annotation configuration ...

    Code:
    @Configuration
    public class Application {
    
    	@Bean(name="sqlClient")
    	public AnnotationSessionFactoryBean getSessionFactory(@Qualifier("dataSource") DataSource dataSource) {
    		...
    From my JUnit test, how do I configure the @ContextConfiguration annotation to read from this class? I have tried ...

    Code:
    @RunWith(SpringJUnit4ClassRunner.class)
    @ContextConfiguration(locations="daos.xml", classes=Application.class)
    public class TestDB {
    but I'm getting a compilation error stating that "classes" is not a valid attribute of ContextConfiguration. Anyway, appreciate the help, - Dave

  2. #2
    Join Date
    Aug 2009
    Location
    Wesley Chapel, FL
    Posts
    35

    Default

    I don't see "classes" in ContextConfiguration and that is the error you are getting.

    http://javasourcecode.org/html/open-...iguration.html

    Maybe I am missing something.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •