2014-09-26 8 views
-1

Spring Boot 프로젝트에서 리소스 폴더를 설정하려고합니다. 그러나 그것을 만들 수 없습니다. 도와주세요. 나는 thymeleaf를 통합하려고합니다.Spring Boot 및 Thymeleaf 리소스 폴더 문제

Project Structure

나는 index.html을 을 얻을 수 있어요하지만 index.html을에서 자원 /css/mobile-angular-ui-desktop.min.css 파일을 포함 할 수 없습니다입니다. 404 페이지를 찾을 수 없습니다. 오류가 발생했습니다.

index.html을

<!DOCTYPE html> 

<html> 
<head> 
<title>Provision Admin</title> 

<link rel="stylesheet" th:href="@{/css/mobile-angular-ui-base.min.css}" 
    href="../static/css/mobile-angular-ui-base.min.css" /> 
<link rel="stylesheet" 
    href="/css/mobile-angular-ui-desktop.min.css" /> 

<script type="text/javascript"> 
    var appContext = '/profilebatch'; 

</script> 


</head> 
<body> 

</body> 
</html> 

나는 다음과 같은 보안 설정.

@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) 
    protected static class ApplicationSecurity extends 
      WebSecurityConfigurerAdapter { 

     @Autowired 
     private SecurityProperties security; 

     @Override 
     protected void configure(HttpSecurity http) throws Exception { 
      http.csrf().disable().authorizeRequests().antMatchers("/css/**") 
        .permitAll().antMatchers("**/favicon.ico").permitAll() 
        .antMatchers("/secure/**").fullyAuthenticated().and() 
        .formLogin().loginPage("/login").failureUrl("/login?error") 
        .permitAll().and().logout() 
        .logoutRequestMatcher(new AntPathRequestMatcher("/logout")) 
        .logoutSuccessUrl("/login"); 
     } 

     @Override 
     public void configure(AuthenticationManagerBuilder auth) 
       throws Exception { 
      auth.inMemoryAuthentication().withUser("user").password("user") 
        .roles("USER").and().withUser("admin").password("admin") 
        .roles("ADMIN"); 
     } 

    } 
+0

실제 렌더링 된 HTML의 'href'는 어떤 모양입니까? – chrylis

답변

1

마지막으로 정상적으로 작동합니다. 내 구성에서 @EnableWebMvc를 제거했습니다.

-1

당신이 번째가 없습니다 : 당신이 기본에 액세스 할 수 있는지 데스크탑 HREF 때문에이 문제입니다 : 대신/공공/SRC에서

th:href="@{/css/mobile-angular-ui-desktop.min.css}" 
+0

나는 그것을 시도했지만 여전히 문제. – user2589193

+0

자세한 정보를 공유하십시오. 로그에 오류가 있습니까? –

+0

페이지를 찾을 수 없다는 경고 만 오류가 표시되지 않습니다. – user2589193

-1

정적 자원의 기본 위치는/주/리소스/정적

+0

그래도 시도했지만 여전히 문제입니다. 내 Rest 서비스에 대해 ContentNegotiation의 deafult를 APPLICATION_JSON으로 설정했습니다. 저는 Rest & Web Thymeleaf를 둘 다 가지고 있습니다. ContentNegotiation – user2589193

+0

스프링 부트를위한 폴더를 제외시키는 아이디어는 또한'/ static'에서 제공됩니다. – chrylis

+0

설명해 주시겠습니까? – user2589193

관련 문제