私は検索して検索していますが、例外の適切な解決策を見つけることができません。私はjava、spring mvc、hibernate & MySQLでWebアプリケーションを構築しています。私はSpring Securityを使用しました。許可されたユーザーだけがWebアプリケーションを使用できるからです。私は次の例外を取得したリソースにアクセスするとき、私は、それが良い見えるようにする(ブートストラップ)CSSを使用しますが、ここで問題ですよ:リソースハンドラSpring例外:org.springframework.web.servlet.DispatcherServlet noHandlerFound
aug 25, 2016 10:41:38 AM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with URI [/ToolManagementSystem/admin/resources/css/alfen.css] in DispatcherServlet with name 'dispatcher'
aug 25, 2016 10:41:38 AM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with URI [/ToolManagementSystem/admin/resources/img/logo.jpg] in DispatcherServlet with name 'dispatcher'
aug 25, 2016 10:41:38 AM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with URI [/ToolManagementSystem/admin/resources/css/bootstrap.css] in DispatcherServlet with name 'dispatcher'
唯一の方法は(私がこれまでに見つかった)にこれを防ぐために明示的にここで
// Grants access to resources
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
}
私resourcehandler内のすべてのパスをコーディング私のセキュリティ設定は正しい方向に私を指して/私を助けるため
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/css/**", "/js/**", "/images/**").permitAll().anyRequest().authenticated()
.antMatchers("/resources/**").permitAll().anyRequest().authenticated()
.antMatchers("/admin/**").access("hasRole('ADMIN')")
.antMatchers("/db/**").access("hasRole('DBA')")
.antMatchers("/lead/**").access("hasRole('LEAD')")
.antMatchers("/responsible/**").access("hasRole('RESPONSIBLE')")
.and().formLogin().loginPage("/login").successHandler(customSuccessHandler)
.usernameParameter("ssoId").passwordParameter("password")
.and().csrf()
.and().exceptionHandling().accessDeniedPage("/Access_Denied");
}
乾杯、みんな、です!
// Grants access to resources
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("classpath:/resources/");
registry.addResourceHandler("/**/resources/**".addResourceLocations("/resources/)"
}
とセキュリティコンフィグを変更するいくつかの方法が、私はすべてのアイデア/提案を開いています:(私の謝罪これは重複した質問を判明した場合)私が試した
ソリューションです!