How to turn off Spring Security in Spring Boot Application

As @Maciej Walkowiak mentioned, you should do this for your main class:

@SpringBootApplication(exclude = org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.class)
public class MainClass {

try this

1->Comment annotation @EnableWebSecurity in your security config

//@EnableWebSecurity

2->Add these lines in your security config

spring.security.enabled=false

management.security.enabled=false

security.basic.enabled=false