SpringBoot fails to boot up after add @EnableWebSecurity

Issue

This Content is from Stack Overflow. Question asked by Elvis

I’m trying to add security headers to my spring boot applicattion.

It already had a java class with multiple filters extending from WebSecurityConfigurerAdapter.
But whwnever I try to add the anottation @EnableWebSecurity to this class or even with a new custom one I always receive nullPointerException for the bean springSecurityFilterChain.

Changing the order to add some filters seems to solve this problem but whenever I try to enter the app I can’t because it seems the HTTP Authorization header field is null (which I recover inside one of my custom filters)

Do any have a clue of what is happening? Thanks in advantage!



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?