1
votes
import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.web.bind.annotation.*;

@RestController
@SpringBootApplication
public class Example {

    @RequestMapping("/")
    String home() {
        return "Hello World!";
    }

    public static void main(String[] args) throws Exception {
        SpringApplication.run(Example.class, args);
    }

}

I use only this dependency: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web/1.4.4.RELEASE

I don't need any filters, any security, I want that after Spring received request and checks routing it will call home method.

How to configure Spring Boot to disable all filters, all security, all stuff?

1
By not including the dependencies.M. Deinum
please share the pom.xml which you are usingRavindra Devadiga
@M.Deinum I have only one dependency and filters are executed anywayRomper
@RavindraDevadiga I've added depndenciesRomper
If that is the only dependency there is no security...M. Deinum

1 Answers

0
votes

You can use security.ignored property or you can accept all requests using this configuration (spring boot 1.4.2) :

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration
@EnableWebSecurity
public class UnsafeWebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(final HttpSecurity http) throws Exception {
        // Accept all requests and disable CSRF
        http.csrf().disable()
            .authorizeRequests()
            .anyRequest().permitAll();

        // To be able to see H2 console.
        http.headers().frameOptions().disable();
    }

}