Substituting auto-configuration

Another way of disabling the auto-security configuration is to surpass it with our own custom configuration. Spring Security is a highly customizable framework and provides a fine-grained access mechanism based on URL and role.

To substitute auto-configuration with custom configuration, we need to specify the configuration class, as in the following snippet:

@Configuration@EnableWebSecurity@ComponentScan("com.nilangpatel.blogpress")public class WebSecurityConfig extends WebSecurityConfigurerAdapter {  …..}

The WebSecurityConfig custom configuration class extends the WebSecurityConfigurerAdapter abstract class. This abstract class has certain extension points (in the form of abstract methods for which you can ...

Get Spring 5.0 Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.