这个错误是由于Spring无法找到JwtAccessDeniedHandler的实例导致的。可能的原因是:

  1. module-security模块没有正确地被添加到Gradle项目的依赖中,导致JwtAccessDeniedHandler类无法被找到。

  2. JwtAccessDeniedHandler类没有被正确地标记为Spring bean,因此它无法被自动检测到和实例化。

解决方法:

  1. 确保module-security模块已经被正确地添加到Gradle项目中,可以通过在settings.gradle中添加include ':module-security'来实现。

  2. 在JwtAccessDeniedHandler类上添加@Component或@Service注解,以便Spring能够自动创建该实例。

  3. 如果JwtAccessDeniedHandler类没有被正确地扫描和创建,可以在Spring配置类中手动创建该实例,例如:

    @Bean public JwtAccessDeniedHandler jwtAccessDeniedHandler() { return new JwtAccessDeniedHandler();

java gradle引入了implementation projectmodule-security其中module-security中有Compenent注解的类JwtAccessDeniedHandler在类SecurityConfig类中RequiredArgsConstructorConfigurationEnableWebSecurityEnableGlobalAuthenticati

原文地址: https://www.cveoy.top/t/topic/hwxM 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录