Webアプリケーションを更新して、特定のページにしかアクセスできない新しいユーザーロールを追加しています。このアップデートの前に、ユーザがログインしてセッションが切れ、ページが更新されたときはいつでも、ログイン画面が表示されます。これで、ログインしていないためにデータをロードできないため、NULLポインタ例外を引き起こすページをロードしようとします。ここで Spring MVC - ログインしていない場合にログインにリダイレクトする方法
は、私は知らない私は、私がログインページにリダイレクトするために、このXML設定を使用していたhttp.csrf().ignoringAntMatchers("/notification/**");
http.csrf().ignoringAntMatchers("/embed/**/apply");
http.csrf().ignoringAntMatchers("/view/**/apply");
http.csrf().ignoringAntMatchers("/login");
http.csrf().ignoringAntMatchers("/logout");
http.csrf().ignoringAntMatchers("/register");
http.authorizeRequests()
.antMatchers("/").permitAll()
.antMatchers("/index").permitAll()
.antMatchers("/static/**").permitAll()
.antMatchers("/assets/**").permitAll()
.antMatchers("/register").permitAll()
.antMatchers("/skillRequest/**").permitAll()
.antMatchers("/skillRequest/skillFormUpdate/**").permitAll()
.antMatchers("/password/reset").permitAll()
.antMatchers("/password/reset/complete").permitAll()
.antMatchers("/email/verify").permitAll()
.antMatchers("/view/**").permitAll()
.antMatchers("/embed/**").permitAll()
.antMatchers("/dashboard").fullyAuthenticated()
.antMatchers("/profile").fullyAuthenticated()
.antMatchers("/candidate-profile/**").fullyAuthenticated()
.antMatchers("/users.json").fullyAuthenticated()
.antMatchers("/candidate/**/add").fullyAuthenticated()
.antMatchers("/candidate/**/edit").fullyAuthenticated()
.antMatchers("/**").not().hasAnyAuthority("ROLE_CANDIDATE")
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.defaultSuccessUrl("/dashboard", false) //Force user to always go to the home page.
//.successHandler(successHandler())
.permitAll()
.and()
.httpBasic()
.and()
.logout()
.permitAll();
これは何のXML設定ですか? web.xml? – Dylan
設定クラスに同じ設定を追加できるはずです – Bala