public void configConstant(Constants me) { me.setInjectDependency(true);//配置可依赖注入 loadPropertyFile("config/dbconfig.properties"); me.setDevMode(true);//配置开发模式 me.setBaseUploadPath("uploadImage");//配置上传的文件基础路径 } public class SearchController extends BaseController { // 日志操作 private static final Logger logger = LoggerFactory.getLogger(SearchController.class); // 搜索业务处理 @Inject SearchService search; public void list() { String word = getPara("word"); int type = getParaToInt("type",0); int pageNumber = getParaToInt("pageNumber",1); int pageSize = getParaToInt("pageSize",10); Integer userId = getUidBySession(); Map<String,Object> map = search.getSearchList(pageNumber,pageSize,type,word,userId); renderJson(new Result<Map<String,Object>>(StatusCode.OK,map,"ok")); } } java.lang.NullPointerException at com.zyhl.whw.wiki.controller.SearchController.list(SearchController.java:143) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.jfinal.aop.Invocation.invoke(Invocation.java:75) at com.zyhl.whw.base.interceptor.ExceptionInterceptor.intercept(ExceptionInterceptor.java:22) at com.jfinal.aop.Invocation.invoke(Invocation.java:69) at com.jfinal.core.ActionHandler.handle(ActionHandler.java:81) at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:86) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:209) at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:244) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2527) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2516) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source)
配置里面也按照说明配置了me.setInjectDependency(true);
注解也加上了,但是运行后,还是报空指针异常,请问这个是什么原因呢?(我是从3.4升到3.5的,用的是tomcat)
项目:JFinal