Spring @ContextConfiguration

前端 未结 3 2175
甜味超标
甜味超标 2021-02-20 04:56

I am running the next test:

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.bean         


        
3条回答
  •  感情败类
    2021-02-20 05:38

    In your case you should use:

    @ContextConfiguration(locations = "file:src/main/resources/META-INF/spring/applicationContext.xml")
    

    Another hint, I see that you use your production applicationContext.xml in your test environment, IMHO it's not a good practice, try use a specific one for testing like applicationContext-test.xml, so you can play with your test context without hurting your production environment.

提交回复
热议问题