- if you make spring boot project with security, default is security on
- Because formLogin method in default springsecurity filter
- we use security filterchain optional by overriding SequrityFilterChain
![](https://velog.velcdn.com/images/kgb/post/d0575cd9-c5e6-4086-aa8d-a4a8cd6f474c/image.png)
How to make Optional sequrityFilterChain
- myAccount, myBalance, myLoans, myCards need login and notices, contact is public
![](https://velog.velcdn.com/images/kgb/post/137900a4-2dd7-4e1b-b1f9-85cc7876c830/image.png)
![](https://velog.velcdn.com/images/kgb/post/591f372b-1ee3-4e3e-8195-f31a35ab5103/image.png)
- and remove componentscan annotation
- if you use componentscan annotation spring boot scan all component and apply sequrityFilterChain whatever it's authentication is
![](https://velog.velcdn.com/images/kgb/post/f940a575-e0f3-4bb0-85b7-35813eb6e782/image.png)
How to deny all request
http.authorizeHttpRequests((requests) -> requests
.anyRequest().denyAll())
.formLogin(Customizer.withDefaults())
.httpBasic(Customizer.withDefaults());
return http.build();
- and then you can see this page
![](https://velog.velcdn.com/images/kgb/post/977fc4af-21d8-43d6-9818-46935df39624/image.png)
Hot to accept all request
http.authorizeHttpRequests((requests) -> requests
.anyRequest().permitAll())
.formLogin(Customizer.withDefaults())
.httpBasic(Customizer.withDefaults());
return http.build();