I already have a XML based Spring application. I have been asked to integrate Spring Security into it. I want to use Java based config. I have already initialized it as per the instructions here: Java Config but how and where do I load the SecurityConfig
class.
My web.xml
is:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/site.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
My SecurityWebApplicationInitializer
is:
public class SecurityWebApplicationInitializer extends
AbstractSecurityWebApplicationInitializer {
}
My SecurityConfig
is:
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().permitAll();
}
}
Aucun commentaire:
Enregistrer un commentaire