Skip to content
Advertisement

How to solve the @Bean required error while implementing JWT token

I am trying to do an authentication web API using spring boot. I have used spring security and JWT token methods to build this API. But at some Extent I get this error:

JavaScript

Here is my JwtFilterRequest file:

JavaScript

Here is my JwtUtils file:

JavaScript

I tried adding @Bean annotation at the area and it throwed an error again that it is not allowed there.

Advertisement

Answer

Add @Component annotation to JwtUtils so that Spring creates its bean at runtime which can be injected in JwtFilterRequest.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement