我正在尝试使用 Spring Boot 2 创建 OAuth2 授权服务器。但是,每当我尝试启动我的应用程序时,我都会收到一个错误:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-08-17 08:17:53.946 ERROR 38996 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
从堆栈跟踪来看,问题的根源似乎在于创建entityManagerFactorybean。但是,我无法弄清楚为什么这会成为一个问题。问题始于我的 AppConfig,它引用了在我的 AuthServerConfig 中找到的JwtAccessTokenConverter:
@Configuration
public class AppConfig {
@Value("${spring.datasource.url}")
private String datasourceUrl;
@Value("${spring.datasource.driverClassName}")
private String dbDriverClassName;
@Value("${spring.datasource.username}")
private String dbUsername;
@Value("${spring.datasource.password}")
private String dbPassword;
@Autowired
JwtAccessTokenConverter accessTokenConverter;
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Bean
public ModelMapper modelMapper() {
ModelMapper mapper = new ModelMapper();
return mapper;
}
@Bean
public DataSource dataSource() {
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(dbDriverClassName);
dataSource.setUrl(datasourceUrl);
dataSource.setUsername(dbUsername);
dataSource.setPassword(dbPassword);
return dataSource;
}
@Bean
public TokenStore tokenStore() {
return new JwtTokenStore(accessTokenConverter);
}
}
HUWWW
相关分类