I am trying to autowire the JJWT JwtBuilder which is imported from this package io.jsonwebtoken.JwtBuilder , however I am getting an error as shown below (at the end of the question)
I have fixed a similar error when autowiring my own class by using a @service annotation in the beginning of my imported library, however since this is a standard library I can't add @service annotation to it
I am calling the library like this in my impl file:
import io.jsonwebtoken.JwtBuilder;
....
@Autowired
JwtBuilder jwtBuilder;
The dependency in gradle is
compile 'io.jsonwebtoken:jjwt:0.9.0'
The error:
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.
It is expected that you create the instance of JwtBuilder
using the static builder()
method of Jwts
class.
JwtBuilder builder = Jwts.builder()
You can refer following documentation.