@autowired for JwtBuilder class is not working, error: required a bean of type 'io.jsonwebtoken.JwtBuilder' that could not be found
@autowired for JwtBuilder class is not working, error: required a bean of type 'io.jsonwebtoken.JwtBuilder' that could not be found
我正在尝试自动装配从此包导入的 JJWT JwtBuilder io.jsonwebtoken.JwtBuilder,但是我收到如下所示的错误(在问题的末尾)
通过在我导入的库 的开头使用@service 注释,我在自动装配自己的 class 时修复了一个类似的错误,但是因为这是一个标准库我无法向其添加@service 注释
我在我的 impl 文件中这样调用库:
import io.jsonwebtoken.JwtBuilder;
....
@Autowired
JwtBuilder jwtBuilder;
gradle 中的依赖是
compile 'io.jsonwebtoken:jjwt:0.9.0'
错误:
APPLICATION FAILED TO START
***************************
Description:
Field jwtBuilder in ....CustomerServiceImpl required a bean of type 'io.jsonwebtoken.JwtBuilder' that could not be found.
Action:
Consider defining a bean of type 'io.jsonwebtoken.JwtBuilder' in your configuration.
预计您使用 Jwts
class.
的静态 builder()
方法创建 JwtBuilder
的实例
JwtBuilder builder = Jwts.builder()
我正在尝试自动装配从此包导入的 JJWT JwtBuilder io.jsonwebtoken.JwtBuilder,但是我收到如下所示的错误(在问题的末尾)
通过在我导入的库 的开头使用@service 注释,我在自动装配自己的 class 时修复了一个类似的错误,但是因为这是一个标准库我无法向其添加@service 注释
我在我的 impl 文件中这样调用库:
import io.jsonwebtoken.JwtBuilder;
....
@Autowired
JwtBuilder jwtBuilder;
gradle 中的依赖是
compile 'io.jsonwebtoken:jjwt:0.9.0'
错误:
APPLICATION FAILED TO START
***************************
Description:
Field jwtBuilder in ....CustomerServiceImpl required a bean of type 'io.jsonwebtoken.JwtBuilder' that could not be found.
Action:
Consider defining a bean of type 'io.jsonwebtoken.JwtBuilder' in your configuration.
预计您使用 Jwts
class.
builder()
方法创建 JwtBuilder
的实例
JwtBuilder builder = Jwts.builder()