我正在尝试将我的 springboot 应用程序部署到 heroku,但我收到一个错误,说它找不到 JwtDecoder bean。我试过用谷歌搜索一下,但找不到任何有用的东西。在本地一切正常,只是在部署到 heroku 时不行。
这是我的 Heroku 日志 --tail:
2021-02-27T20:18:45.134160+00:00 app[web.1]: ***************************
2021-02-27T20:18:45.134160+00:00 app[web.1]: APPLICATION FAILED TO START
2021-02-27T20:18:45.134160+00:00 app[web.1]: ***************************
2021-02-27T20:18:45.134161+00:00 app[web.1]:
2021-02-27T20:18:45.134161+00:00 app[web.1]: Description:
2021-02-27T20:18:45.134161+00:00 app[web.1]:
2021-02-27T20:18:45.134179+00:00 app[web.1]: Method springSecurityFilterChain in
org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration
required a bean of type 'org.springframework.security.oauth2.jwt.JwtDecoder' that
could not be found.
2021-02-27T20:18:45.134179+00:00 app[web.1]:
2021-02-27T20:18:45.134179+00:00 app[web.1]:
2021-02-27T20:18:45.134180+00:00 app[web.1]: Action:
2021-02-27T20:18:45.134180+00:00 app[web.1]:
2021-02-27T20:18:45.134181+00:00 app[web.1]: Consider defining a bean of type
'org.springframework.security.oauth2.jwt.JwtDecoder' in your configuration.
网络安全配置:
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception{
http.csrf().disable().cors().configurationSource(corsConfigurationSource())
.and()
.authorizeRequests()
.antMatchers("/*")
.authenticated()
.and()
.oauth2ResourceServer()
.jwt();
}
我不确定还需要添加什么...请随意评论我应该添加的其他内容。或者,回购位于 https://github.com/AndreTheTallGuy/Kelp2
预先感谢您提供的任何帮助!