I have a project which is consisting of several modules. (web,jms,service,persistence) When I wrote tests of persistence module it worked fine as I used the below code snippet.
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = PersistenceConfig.class)
public class SomeTestClass{
@Autowired
SomeRepository someRepository;
here you can see I am using PersistenceConfig config class and it works really fine. When It comes to test the service layer which has dependencies in JMS module where I am configuring jms properties via properties file. The problem is @PropertyResource is not being injected to test class ,I need to read that file to configure JMSConfig class.
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = {PersistenceConfig.class, JmsConfig.class, CachingConfig.class})
@TestPropertySource("classpath:asynch_test.properties")
public class SomeServiceTest {
@Autowired
@Qualifier("somePersistenceService")
SomeService someService;
Any Comment is appreciated.