【发布时间】:2017-02-05 21:37:56
【问题描述】:
当我运行命令“mvn clean install”时,构建失败。错误原因:
结果:
原因: org.springframework.boot.context.embedded.EmbeddedServletContainerException: 无法启动嵌入式 Tomcat
引起:org.springframework.beans.factory.BeanCreationException: 创建具有名称的 bean 时出错 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': 注入自动装配的依赖项失败;嵌套异常是 org.springframework.beans.factory.BeanCreationException:不能 自动装配方法:公共无效 org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) 抛出 java.lang.Exception;嵌套异常是 org.springframework.beans.factory.BeanExpressionException:表达式 解析失败;嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名为“securityConfiguration”的bean:注入 自动装配依赖失败;嵌套异常是 org.springframework.beans.factory.BeanCreationException:不能 自动装配字段:私有 org.springframework.security.core.userdetails.UserDetailsService com.orderone.app.config.SecurityConfiguration.userDetailsService; 嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名为“userDetailsService”的bean:注入自动装配 依赖失败;嵌套异常是 org.springframework.beans.factory.BeanCreationException:不能 自动装配字段:私有 com.orderone.app.repository.UserRepository com.orderone.app.security.UserDetailsService.userRepository;嵌套的 例外是 org.springframework.beans.factory.BeanCreationException: 创建名为“userRepository”的 bean 时出错:无法创建内部 bean '(inner bean)#4711c601' 类型 [org.springframework.orm.jpa.SharedEntityManagerCreator] 设置时 bean 属性 'entityManager';嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名为“(内部 bean)#4711c601”的 bean:无法解析 在设置构造函数时引用 bean 'entityManagerFactory' 争论;嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建在类路径中定义的名称为“entityManagerFactory”的bean 资源 [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: 调用 init 方法失败;嵌套异常是 org.hibernate.HibernateException:缺少表:订单在 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
引起:org.springframework.beans.factory.BeanCreationException: 无法自动装配方法:public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) 抛出 java.lang.Exception;嵌套异常是 org.springframework.beans.factory.BeanExpressionException:表达式 解析失败;嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名为“securityConfiguration”的bean:注入 自动装配依赖失败;嵌套异常是 org.springframework.beans.factory.BeanCreationException:不能 自动装配字段:私有 org.springframework.security.core.userdetails.UserDetailsService com.orderone.app.config.SecurityConfiguration.userDetailsService; 嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名为“userDetailsService”的bean:注入自动装配 依赖失败;嵌套异常是 org.springframework.beans.factory.BeanCreationException:不能 自动装配字段:私有 com.orderone.app.repository.UserRepository com.orderone.app.security.UserDetailsService.userRepository;嵌套的 例外是 org.springframework.beans.factory.BeanCreationException: 创建名为“userRepository”的 bean 时出错:无法创建内部 bean '(inner bean)#4711c601' 类型 [org.springframework.orm.jpa.SharedEntityManagerCreator] 设置时 bean 属性 'entityManager';嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名为“(内部 bean)#4711c601”的 bean:无法解析 在设置构造函数时引用 bean 'entityManagerFactory' 争论;嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建在类路径中定义的名称为“entityManagerFactory”的bean 资源 [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: 调用 init 方法失败;嵌套异常是 org.hibernate.HibernateException:缺少表:订单
【问题讨论】:
-
如果你检查日志你会发现嵌套错误是 org.hibernate.HibernateException: Missing table: order
-
告诉我解决此错误需要遵循哪些步骤
-
嵌套异常是 org.hibernate.HibernateException: Missing table: order
-
其他实体工作正常但只有这个实体抛出错误......