【发布时间】:2015-10-16 09:17:27
【问题描述】:
以下两种加载配置的方式有什么区别。
两个独立的配置类通过测试类中的@ContextConfiguration 加载。
将一个配置导入另一个配置,并将单个配置加载到测试类中的@ContextConfiguration。
我认为两者都将配置推送到公共池中。但我看到了不同。我有两个全局拦截器,一个在 java.config 中,另一个在 xml.config 中。如果我按照上面的第二种方法,两个拦截器都在加载。
但是如果我遵循第一种方法,则只有一个拦截器正在加载,具体取决于我是调用基于 xml 的网关还是基于 java 的网关。
https://github.com/manojp1988/Learning/tree/JavaDSL/Sample1
@RunWith(SpringJUnit4ClassRunner.class)
@ContextHierarchy({
@ContextConfiguration(locations = {"/applicationContext.xml"}),
@ContextConfiguration(classes = SpringConfiguration.class),
})
public class SampleTest {}
更新:
@Bean
@GlobalChannelInterceptor(patterns = "*_EL*", order=3)
public WireTap wireTap() {
【问题讨论】:
标签: spring spring-integration spring-test