本地应用正常,部署后报错:
Caused by: org.springframework.context.ApplicationContextException:
Unable to start embedded container; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webSecurityConfiguration': Unsatisfied dependency expressed through field 'userDetailsService'; nested exception
上周我部署了一个旧版本的相同的应用程序并且应用程序运行正常。我该如何解决?
@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- 上使用 spring boot 和 war 与 providedRuntime('org.springframework.boot:spring-boot-starter-tomcat'
b12
最佳答案
@Autowired//
private UserDetailsService userDetailsService;
package org.springframework.security.core.userdetails就我而言,问题出在数据库上,代码本身是正确的,不需要更改
关于spring - 在本地工作但不在生产环境中使用 UnsatisfiedDependencyException 创建名称为 'webSecurityConfiguration 的 bean,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41077370/