单独使用WIKI中提供的FilterRegistrationBean那段代码可以成功,单独使用SpringUtils调用service也可以成功,同时使用时就会报错。报错如下
java.lang.RuntimeException: Can not create instance of class: com.microservice.wechat.weixin.WeixinConfig
at com.jfinal.core.JFinalFilter.createJFinalConfig(JFinalFilter.java:103)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:47)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:112)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4590)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5233)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException: null
at com.microservice.wechat.common.utils.SpringUtils.getBean(SpringUtils.java:28)
at com.microservice.wechat.weixin.WeixinConfig.<init>(WeixinConfig.java:74)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at java.lang.Class.newInstance(Class.java:438)
at com.jfinal.core.JFinalFilter.createJFinalConfig(JFinalFilter.java:101)
... 12 common frames omitted
虚心求教,望大神指教