Results 1 comments of yanwei

我昨天自己测试,使用这种方式拦截器中的properties会 NPE ,然后我把properties对象当方法参数传进来,不自己new,结果也NPE,我怀疑每次请求拦截器都是不同的对象,因为容器默认的bean是单例嘛,然后我把拦截器中的properties声明为static类型,结果好了。作者能回答一下为什么NPE么? xjs1919 于2019年4月24日周三 上午8:29写道: > @Configuration public class MybatisConfig { @Bean public Interceptor > getInterceptor(){ AutoDateInterceptor interceptor = new > AutoDateInterceptor(); Properties properties = new Properties(); > properties.put("createDateColumn",...