今天遇到了一个问题,就是Controller层自动注入service时,一直在报空指针异常,而使用getbean却好好的,百思不得其解,终于得到了解决的方法。
10-Dec-2018 22:21:21.619 严重 [http-nio-8080-exec-5] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [com.ly.controller.ShowViewServlet] in context with path [/spring] threw exception
java.lang.NullPointerException
at com.ly.controller.ShowViewServlet.doGet(ShowViewServlet.java:44)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterC