문제

So the thing is I want to load a set of application contexts that follow the regular expression that is anything follow by -context.xml, ok?

This saves me a lot of time since I don't need to add a lot of application contexts one by one. Now, one of those application context is giving me trouble and I want it to not be included in the context configuration. Can I add something to the @ContextConfiguration annotation that removes a particular application context from the previous locations?

Is not a big nuisance, but I'm curious... Here's some code if this helps you:

@RunWith(SpringJUnit4ClassRunner.class)
    @ContextConfiguration(locations = {
            "classpath*:resources/*-context.xml"
            })
    public class Tests{
    ...
    }
도움이 되었습니까?

해결책

Context exclusion is not possible in Spring. You can declare which contexts to use by using Spring Profiles. In each test you can select which profile will be used, so in turn which beans will be loaded to context.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top