ApplicationContext applicationContext = ContextLoader.getCurrentWebApplicationContext();
applicationContext.getBean(Service.class);
// 这个是在 WebMvcConfigrer 中
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(mybatisPlugin());
}
@Bean
public MybatisPlugin mybatisPlugin() {
return new MybatisPlugin();
}
1
joooooker21 2018 年 12 月 19 日
|
2
zizaiv2 2018 年 12 月 20 日
tkmybatis
|
3
cyhulk 2018 年 12 月 25 日
Interceptor 中引入一个 static 变量呗,等 context 起来之后 set 进去不就行了
|