spring intercepts localhost:8080/1 to intercept my chat page, but not to the root directory. Go back to the default index page;
there are several lines of log output in the console log
2018-06-04 15:46:03.601 INFO 15836 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/login] onto handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController]
2018-06-04 15:46:03.601 INFO 15836 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Root mapping to handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController]
2018-06-04 15:46:03.601 INFO 15836 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/1] onto handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController]
2018-06-04 15:46:03.663 INFO 15836 --- [ restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index
configuration of springMVC
@Configuration
public class WebMvcConfg implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("/login");
registry.addViewController("/").setViewName("/chat");
registry.addViewController("/1").setViewName("/chat");
}
}
configuration of spring security
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.anyRequest()
.authenticated()
.and()
//
.formLogin()
//
.loginPage("/login")
//
.defaultSuccessUrl("/")
.permitAll()
.and()
//
.logout()
.permitAll();
}
}