【问题标题】:Working locally but not on production UnsatisfiedDependencyException creating bean with name 'webSecurityConfiguration在本地工作,但不在生产环境中使用 UnsatisfiedDependencyException 创建名为“webSecurityConfiguration”的 bean
【发布时间】:2017-04-25 22:23:15
【问题描述】:

应用在本地运行正常,但部署后报错:

引起:org.springframework.context.ApplicationContextException:

无法启动嵌入式容器;嵌套异常是 org.springframework.beans.factory.UnsatisfiedDependencyException: 创建名为“webSecurityConfiguration”的 bean 时出错:不满意 通过字段 'userDetailsS​​ervice' 表达的依赖关系;嵌套的 异常

上周我部署了同一应用程序的旧版本,并且应用程序运行正常。我该如何解决?

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {

    @Autowired
    private EntryPointUnauthorizedHandler unauthorizedHandler;

    @Autowired//package org.springframework.security.core.userdetails;
    private UserDetailsService userDetailsService;

我在服务器 Apache Tomcat/7.0.68 和 java: 1.8.0_11-b12 上使用 Spring Boot 和 providedRuntime('org.springframework.boot:spring-boot-starter-tomcat' 进行战争

【问题讨论】:

    标签: spring spring-mvc tomcat spring-boot spring-security


    【解决方案1】:
     @Autowired//
     private UserDetailsService userDetailsService;
    

    package org.springframework.security.core.userdetails 就我而言,问题出在数据库上,代码本身是正确的,不需要更改

    【讨论】:

      猜你喜欢
      • 2016-07-16
      • 2018-03-23
      • 1970-01-01
      • 2019-08-17
      • 2021-12-08
      • 2014-04-27
      • 2023-01-30
      • 2017-09-11
      • 2021-03-17
      相关资源
      最近更新 更多