spring - Java config /j_spring_security_check not found -


i'm noob spring framework.

trying configure security options app. have following (xml-less) security config:

@configuration @enablewebsecurity public class securityconfig extends websecurityconfigureradapter { @autowired @qualifier("accountservice") userdetailsservice userdetailsservice;  @autowired public void configureglobal(authenticationmanagerbuilder auth) throws exception {     auth.userdetailsservice(userdetailsservice).passwordencoder(passwordencoder()); }  @override protected void configure(httpsecurity http) throws exception {      http.csrf().disable().authorizerequests()             .antmatchers("/admin/**" ).hasrole( "admin" )             .and()             .formlogin()             .loginpage("/")             .loginprocessingurl( "/j_spring_security_check" )             .failureurl( "/loginfailed" )             .permitall()             .and().logout().logoutsuccessurl("/logout")             .and().exceptionhandling().accessdeniedpage("/403"); }  @bean public passwordencoder passwordencoder(){     passwordencoder encoder = new bcryptpasswordencoder();     return encoder; }  } 

it displays login page when submit throws me /j_spring_security_check not found exception. appreciated.

my web config thus:

public class webconfig implements webapplicationinitializer {  public void onstartup( servletcontext servletcontext ) throws servletexception {      annotationconfigwebapplicationcontext applicationcontext = new annotationconfigwebapplicationcontext();     applicationcontext.register( mvcservletconfig.class );     applicationcontext.register( securityconfig.class );      //add servlet mapping manually , make initialize automatically     servletregistration.dynamic servlet = servletcontext.addservlet( "dispatcher", new dispatcherservlet( applicationcontext ) );     servletcontext.addlistener(new contextloaderlistener(applicationcontext));     servlet.addmapping( "/" );     servlet.setloadonstartup( 1 ); } } 

see docs

.loginpage("/") overrides url have submit to.

probably want .loginpage("/j_spring_security_check")


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -