我有一个看起来像这样的代码。
@Configuration
@EnableWebMvcSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private UserService userService;
@Autowired
private RoleService roleService;
这会导致以下错误: -
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webSecurityConfig': Injection of autowired dependencies failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1208)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:368)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1117)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1012)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.boot.context.embedded.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:211)
at org.springframework.boot.context.embedded.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:167)
at org.springframework.boot.context.embedded.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:162)
at org.springframework.boot.context.embedded.ServletContextInitializerBeans.addAdaptableBeans(ServletContextInitializerBeans.java:144)
at org.springframework.boot.context.embedded.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:74)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getServletContextInitializerBeans(EmbeddedWebApplicationContext.java:233)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.selfInitialize(EmbeddedWebApplicationContext.java:220)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.access$000(EmbeddedWebApplicationContext.java:84)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext$1.onStartup(EmbeddedWebApplicationContext.java:205)
at org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory$Initializer.onStartup(UndertowEmbeddedServletContainerFactory.java:510)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:183)
... 17 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webSecurityConfig': Injection of autowired dependencies failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:649)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 44 common frames omitted
Caused by: org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webSecurityConfig': Injection of autowired dependencies failed; nested exception is java.lang.NullPointerException
at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:164)
at org.springframework.beans.factory.support.AbstractBeanFactory.evaluateBeanDefinitionString(AbstractBeanFactory.java:1365)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:957)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:606)
... 46 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webSecurityConfig': Injection of autowired dependencies failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1208)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:523)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:512)
at org.springframework.security.config.annotation.web.configuration.AutowiredWebSecurityConfigurersIgnoreParents.getWebSecurityConfigurers(AutowiredWebSecurityConfigurersIgnoreParents.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:113)
at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:129)
at org.springframework.expression.spel.ast.MethodReference.access$000(MethodReference.java:49)
at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:342)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:88)
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:120)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:242)
at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:161)
... 50 common frames omitted
Caused by: java.lang.NullPointerException: null
at org.sourav.propman.dao.impl.UserDaoImpl.getAll(UserDaoImpl.java:54)
at org.sourav.propman.dao.impl.UserDaoImpl$$FastClassBySpringCGLIB$$30efcce2.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
at org.sourav.propman.dao.impl.UserDaoImpl$$EnhancerBySpringCGLIB$$b3f42b88.getAll(<generated>)
at org.sourav.propman.service.impl.UserServiceImpl.getAll(UserServiceImpl.java:49)
at org.sourav.propman.WebSecurityConfig.configureGlobal(WebSecurityConfig.java:131)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:642)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 72 common frames omitted
2015-11-02 17:12:15.173 INFO 6348 --- [lication.main()] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2015-11-02 17:12:15.180 INFO 6348 --- [lication.main()] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/C:/Users/sourav/workspace/propman/src/main/resources/, file:/C:/Users/sourav/workspace/propman/src/main/resources/, file:/C:/Users/sourav/workspace/propman/target/classes/, file:/C:/Users/sourav/.m2/repository/org/springframework/spring-context/4.1.8.RELEASE/spring-context-4.1.8.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/1.2.7.RELEASE/spring-boot-starter-jdbc-1.2.7.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.6.3/jackson-core-2.6.3.jar, file:/C:/Users/sourav/.m2/repository/org/yaml/snakeyaml/1.14/snakeyaml-1.14.jar, file:/C:/Users/sourav/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.2.7.RELEASE/spring-boot-starter-logging-1.2.7.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/com/maxmind/geoip/geoip-api/1.2.15/geoip-api-1.2.15.jar, file:/C:/Users/sourav/.m2/repository/org/thymeleaf/thymeleaf-spring4/2.1.4.RELEASE/thymeleaf-spring4-2.1.4.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/spring-webmvc/4.1.8.RELEASE/spring-webmvc-4.1.8.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/com/google/code/gson/gson/1.7.1/gson-1.7.1.jar, file:/C:/Users/sourav/.m2/repository/org/jboss/xnio/xnio-nio/3.3.0.Final/xnio-nio-3.3.0.Final.jar, file:/C:/Users/sourav/.m2/repository/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar, file:/C:/Users/sourav/.m2/repository/ch/qos/logback/logback-classic/1.1.3/logback-classic-1.1.3.jar, file:/C:/Users/sourav/.m2/repository/io/undertow/undertow-websockets-jsr/1.1.8.Final/undertow-websockets-jsr-1.1.8.Final.jar, file:/C:/Users/sourav/.m2/repository/org/jgroups/jgroups/3.3.4.Final/jgroups-3.3.4.Final.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/boot/spring-boot-starter-undertow/1.2.7.RELEASE/spring-boot-starter-undertow-1.2.7.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/jsoup/jsoup/1.8.3/jsoup-1.8.3.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/security/spring-security-web/3.2.8.RELEASE/spring-security-web-3.2.8.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.4.6/jackson-annotations-2.4.6.jar, file:/C:/Users/sourav/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.2.7.RELEASE/spring-boot-autoconfigure-1.2.7.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar, file:/C:/Users/sourav/.m2/repository/org/scala-lang/scala-library/2.10.4/scala-library-2.10.4.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/data/spring-data-jpa/1.7.4.RELEASE/spring-data-jpa-1.7.4.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/security/spring-security-core/3.2.8.RELEASE/spring-security-core-3.2.8.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/jboss/spec/javax/jms/jboss-jms-api_2.0_spec/1.0.0.Final/jboss-jms-api_2.0_spec-1.0.0.Final.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/spring-jdbc/4.1.8.RELEASE/spring-jdbc-4.1.8.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/unbescape/unbescape/1.1.0.RELEASE/unbescape-1.1.0.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/hornetq/hornetq-native/2.4.7.Final/hornetq-native-2.4.7.Final.jar, file:/C:/Users/sourav/.m2/repository/org/aspectj/aspectjweaver/1.8.7/aspectjweaver-1.8.7.jar, file:/C:/Users/sourav/.m2/repository/org/hibernate/hibernate-core/4.3.11.Final/hibernate-core-4.3.11.Final.jar, file:/C:/Users/sourav/.m2/repository/ch/qos/logback/logback-core/1.1.3/logback-core-1.1.3.jar, file:/C:/Users/sourav/.m2/repository/net/sf/opencsv/opencsv/2.3/opencsv-2.3.jar, file:/C:/Users/sourav/.m2/repository/org/aspectj/aspectjrt/1.8.7/aspectjrt-1.8.7.jar, file:/C:/Users/sourav/.m2/repository/org/jboss/jandex/1.1.0.Final/jandex-1.1.0.Final.jar, file:/C:/Users/sourav/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar, file:/C:/Users/sourav/.m2/repository/org/slf4j/jul-to-slf4j/1.7.12/jul-to-slf4j-1.7.12.jar, file:/C:/Users/sourav/.m2/repository/io/undertow/undertow-core/1.1.8.Final/undertow-core-1.1.8.Final.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/spring-jms/4.1.8.RELEASE/spring-jms-4.1.8.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/jboss/logging/jboss-logging/3.1.3.GA/jboss-logging-3.1.3.GA.jar, file:/C:/Users/sourav/.m2/repository/org/hornetq/hornetq-core-client/2.4.7.Final/hornetq-core-client-2.4.7.Final.jar, file:/C:/Users/sourav/.m2/repository/org/hibernate/hibernate-entitymanager/4.3.11.Final/hibernate-entitymanager-4.3.11.Final.jar, file:/C:/Users/sourav/.m2/repository/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar, file:/C:/Users/sourav/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.0.28/tomcat-embed-el-8.0.28.jar, file:/C:/Users/sourav/.m2/repository/org/hibernate/common/hibernate-commons-annotations/4.0.5.Final/hibernate-commons-annotations-4.0.5.Final.jar, file:/C:/Users/sourav/.m2/repository/org/apache/tomcat/embed/tomcat-embed-logging-juli/8.0.28/tomcat-embed-logging-juli-8.0.28.jar, file:/C:/Users/sourav/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar, file:/C:/Users/sourav/.m2/repository/io/undertow/undertow-servlet/1.1.8.Final/undertow-servlet-1.1.8.Final.jar, file:/C:/Users/sourav/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.12/log4j-over-slf4j-1.7.12.jar, file:/C:/Users/sourav/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.0.28/tomcat-embed-core-8.0.28.jar, file:/C:/Users/sourav/.m2/repository/org/projectlombok/lombok/1.16.6/lombok-1.16.6.jar, file:/C:/Users/sourav/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar, file:/C:/Users/sourav/.m2/repository/org/apache/geronimo/specs/geronimo-jms_1.1_spec/1.1.1/geronimo-jms_1.1_spec-1.1.1.jar, file:/C:/Users/sourav/.m2/repository/ognl/ognl/3.0.8/ognl-3.0.8.jar, file:/C:/Users/sourav/.m2/repository/org/jboss/logging/jboss-logging-annotations/1.2.0.Beta1/jboss-logging-annotations-1.2.0.Beta1.jar, file:/C:/Users/sourav/.m2/repository/org/jboss/spec/javax/websocket/jboss-websocket-api_1.1_spec/1.1.0.Final/jboss-websocket-api_1.1_spec-1.1.0.Final.jar, file:/C:/Users/sourav/.m2/repository/mysql/mysql-connector-java/5.1.36/mysql-connector-java-5.1.36.jar, file:/C:/Users/sourav/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar, file:/C:/Users/sourav/.m2/repository/org/jolokia/jolokia-core/1.2.3/jolokia-core-1.2.3.jar, file:/C:/Users/sourav/.m2/repository/org/parboiled/parboiled-scala_2.10/1.1.6/parboiled-scala_2.10-1.1.6.jar, file:/C:/Users/sourav/.m2/repository/org/apache/geronimo/specs/geronimo-j2ee-management_1.1_spec/1.0.1/geronimo-j2ee-management_1.1_spec-1.0.1.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/spring-web/4.1.8.RELEASE/spring-web-4.1.8.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/spring-tx/4.1.8.RELEASE/spring-tx-4.1.8.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/boot/spring-boot-starter-hornetq/1.2.7.RELEASE/spring-boot-starter-hornetq-1.2.7.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.2.7.RELEASE/spring-boot-starter-tomcat-1.2.7.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/security/spring-security-config/3.2.8.RELEASE/spring-security-config-3.2.8.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/spring-core/4.1.8.RELEASE/spring-core-4.1.8.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/spring-aspects/4.1.8.RELEASE/spring-aspects-4.1.8.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/boot/spring-boot-starter-aop/1.2.7.RELEASE/spring-boot-starter-aop-1.2.7.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/boot/spring-boot-starter/1.2.7.RELEASE/spring-boot-starter-1.2.7.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar, file:/C:/Users/sourav/.m2/repository/org/hornetq/hornetq-jms-client/2.4.7.Final/hornetq-jms-client-2.4.7.Final.jar, file:/C:/Users/sourav/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.12/jcl-over-slf4j-1.7.12.jar, file:/C:/Users/sourav/.m2/repository/nz/net/ultraq/thymeleaf/thymeleaf-layout-dialect/1.2.9/thymeleaf-layout-dialect-1.2.9.jar, file:/C:/Users/sourav/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/boot/spring-boot-starter-data-jpa/1.2.7.RELEASE/spring-boot-starter-data-jpa-1.2.7.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/apache/tomcat/tomcat-juli/8.0.28/tomcat-juli-8.0.28.jar, file:/C:/Users/sourav/.m2/repository/org/apache/tomcat/tomcat-jdbc/8.0.28/tomcat-jdbc-8.0.28.jar, file:/C:/Users/sourav/.m2/repository/com/zaxxer/HikariCP/2.4.1/HikariCP-2.4.1.jar, file:/C:/Users/sourav/.m2/repository/io/netty/netty-all/4.0.13.Final/netty-all-4.0.13.Final.jar, file:/C:/Users/sourav/.m2/repository/org/thymeleaf/thymeleaf/2.1.4.RELEASE/thymeleaf-2.1.4.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/glassfish/javax.el/3.0.0/javax.el-3.0.0.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/data/spring-data-commons/1.9.4.RELEASE/spring-data-commons-1.9.4.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/spring-aop/4.1.8.RELEASE/spring-aop-4.1.8.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/spring-messaging/4.1.8.RELEASE/spring-messaging-4.1.8.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/boot/spring-boot-starter-security/1.2.7.RELEASE/spring-boot-starter-security-1.2.7.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/spring-expression/4.1.8.RELEASE/spring-expression-4.1.8.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/boot/spring-boot-starter-thymeleaf/1.2.7.RELEASE/spring-boot-starter-thymeleaf-1.2.7.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.2.7.RELEASE/spring-boot-starter-web-1.2.7.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar, file:/C:/Users/sourav/.m2/repository/org/parboiled/parboiled-core/1.1.6/parboiled-core-1.1.6.jar, file:/C:/Users/sourav/.m2/repository/com/fasterxml/classmate/1.0.0/classmate-1.0.0.jar, file:/C:/Users/sourav/.m2/repository/org/apache/activemq/activemq-client/5.10.2/activemq-client-5.10.2.jar, file:/C:/Users/sourav/.m2/repository/org/fusesource/hawtbuf/hawtbuf/1.10/hawtbuf-1.10.jar, file:/C:/Users/sourav/.m2/repository/org/hibernate/hibernate-jpamodelgen/4.3.11.Final/hibernate-jpamodelgen-4.3.11.Final.jar, file:/C:/Users/sourav/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/boot/spring-boot/1.2.7.RELEASE/spring-boot-1.2.7.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/hornetq/hornetq-commons/2.4.7.Final/hornetq-commons-2.4.7.Final.jar, file:/C:/Users/sourav/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.4.6/jackson-databind-2.4.6.jar, file:/C:/Users/sourav/.m2/repository/org/hornetq/hornetq-journal/2.4.7.Final/hornetq-journal-2.4.7.Final.jar, file:/C:/Users/sourav/.m2/repository/org/hibernate/hibernate-validator/5.1.3.Final/hibernate-validator-5.1.3.Final.jar, file:/C:/Users/sourav/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.0.28/tomcat-embed-websocket-8.0.28.jar, file:/C:/Users/sourav/.m2/repository/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/spring-orm/4.1.8.RELEASE/spring-orm-4.1.8.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/xml-resolver/xml-resolver/1.2/xml-resolver-1.2.jar, file:/C:/Users/sourav/.m2/repository/org/springframework/spring-beans/4.1.8.RELEASE/spring-beans-4.1.8.RELEASE.jar, file:/C:/Users/sourav/.m2/repository/org/jboss/xnio/xnio-api/3.3.0.Final/xnio-api-3.3.0.Final.jar, file:/C:/Users/sourav/.m2/repository/org/neo4j/neo4j-cypher-compiler-2.1/2.1.5/neo4j-cypher-compiler-2.1-2.1.5.jar]
2015-11-02 17:12:15.181 ERROR 6348 --- [lication.main()] o.s.boot.SpringApplication : Application startup failed
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webSecurityConfig': Injection of autowired dependencies failed; nested exception is java.lang.NullPointerException
起初,roleService类中缺少Service注释。那个时候它只是没有自动装配roleService类。现在它只给出空指针异常 编辑: 这是userDao中的getAll实现
@Override
public List<UserDto> getAll() throws IOException {
List<Map<String,Object>> rows = template.queryForList(FETCH);
List <UserDto> user_accounts= new ArrayList<UserDto>();
for(Map<String,Object> row:rows) {
UserDto user_account=new UserDto();
user_account.setUserId((Integer)(row.get("USERID")));
user_account.setUserName((String)row.get("USERNAME"));
user_account.setPassword((String)row.get("PASSWORD"));
user_account.setManagerId((Integer)row.get("MANAGER_ID"));
user_account.setMobileNumber((Long)row.get("MOBILENUMBER"));
user_account.setEmail((String)row.get("EMAIL"));
user_account.setFirstName((String)row.get("FIRSTNAME"));
user_account.setLastName((String)row.get("LASTNAME"));
user_account.setAddressId((Integer)row.get("ADDRESS_ID"));
user_account.setOrgId((Integer)row.get("ORGID"));
user_account.setRoleId((Integer)row.get("ROLEID"));
user_account.setUserStatusId((Integer)row.get("USERSTATUSID"));
user_accounts.add(user_account);
}
return user_accounts;