2016-12-19 15 views
0

内のリソースを見つけることができません。テンプレートとページを見つけてテンプレートが見つからないように、cssjsファイルをプロジェクト全体を構成しました。Thymeleafは、私が<em>Springboot</em>と<em>Thymeleaf</em>でプロジェクトを作成していSpringbootプロジェクト

私はSpringbootバージョン1.4.2.RELEASEを使用しています。

Htmlの

<link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}"/> 

application.properties

# --- CONFIGURAÇÃO TYMELEAF --- 
spring.thymeleaf.suffix=.html 
spring.thymeleaf.mode=HTML5 
spring.thymeleaf.cache=false 
spring.thymeleaf.content-type=text/html 
spring.thymeleaf.encoding=UTF-8 
spring.thymeleaf.prefix=classpath:/templates/ 
spring.thymeleaf.check-template-location=true 
spring.thymeleaf.enabled=true 

WebMvcConfigurerAdapter

@Override 
    public void addResourceHandlers(ResourceHandlerRegistry registry) { 
      registry.addResourceHandler("/resources/**") 
        .addResourceLocations("/resources/") 
        .addResourceLocations("/static/") 
        .addResourceLocations("/static/**") 
        .addResourceLocations("/resources/static/") 
        .addResourceLocations("/resources/static/**") 
        .addResourceLocations("/") 
        .addResourceLocations("/**"); 
    } 

フォルダ

inserir a descrição da imagem aqui

UPDATE

私が推奨されているようでしたし、すべての設定を削除しました。今回はページが開きますので、スターターページは読み込まれません。

インデックス

<div class="content-wrapper" th:replace="/starter :: content"> 

</div> 

スターター

<div class="content-wrapper" th:frament="content"> 
     <!-- Content Header (Page header) --> 
     <section class="content-header"> 
      <h1> 
       Esse é o Prototipo do layout 
      </h1> 
      <ol class="breadcrumb"> 
       <li><a href="#"><i class="fa fa-dashboard"></i> Level</a></li> 
       <li class="active">Here</li> 
      </ol> 
     </section> 

     <!-- Main content --> 
     <section class="content"> 

      <h1>Oi eu sou goku!!</h1> 

     </section> 
     <!-- /.content --> 
    </div> 

enter image description here

+1

spring-boot-starter-thymeleafの依存関係に付属するデフォルト設定は、このシナリオで必要なものです。そのjarを追加し、Java Configとapplication.propertiesの両方からカスタム設定を削除してみてください。 –

+0

しかし、接頭辞、接尾辞、コンテキストなどを設定する必要はありません...? –

+0

spring-boot-starter-thymeleafの依存関係を使用すると、.htmlはすでにあなたのために事前設定されています。そして、spring-boot-starter-webは自動的にsrc/main/resources/{public、static、またはresources}/** –

答えて

0

<link rel="stylesheet" href="./bootstrap/css/bootstrap.min.css"/> 

あなたが目を使用する必要はありません、これを試してみてください:ここのhref。

+0

私はすでにこれを試してもうまくいかなかった –

関連する問題

 関連する問題