2016-09-06 10 views
3

私はSpring BootとThymeleafで例を実行しようとしています。私はエラーを取得する:Spring BootとThymeleaf Neko HTMLエラー

There was an unexpected error (type=Internal Server Error, status=500). Cannot perform conversion to XML from legacy HTML: The nekoHTML library is not in classpath. nekoHTML 1.9.15 or newer is required for processing templates in "LEGACYHTML5" mode

は、これらは私の依存関係です:

<dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-jersey</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-security</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-thymeleaf</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.thymeleaf.extras</groupId> 
     <artifactId>thymeleaf-extras-springsecurity4</artifactId> 
     <version>2.1.2.RELEASE</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-web</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-test</artifactId> 
     <scope>test</scope> 
    </dependency> 

これは私のアプリケーションのプロパティです:

spring.thymeleaf.cache=false 
spring.thymeleaf.suffix=.html 
spring.thymeleaf.mode=LEGACYHTML5 
spring.thymeleaf.encoding=UTF-8 
spring.thymeleaf.content-type=text/html 

私は猫HTMLの依存関係のエラーが消える追加します。しかし、それは私の現在の依存関係を介して含める必要があります。何が問題なの?

答えて

5

Mavenのために、シンプルなこの依存関係を追加します。

MVNの依存関係:ツリー-Dincludes = net.sourceforge.nekohtml:nekohtml

結果は何も

春-boot-ようですthymeleafは、nekohtmlライブラリを含まない。 Gradleのために


、あなたはhttps://mvnrepository.com/artifact/net.sourceforge.nekohtml/nekohtmlにしたいバージョンを見つけ、Gradleのを見つけることができるこのようなスクリプトが含まれています

compile group: 'net.sourceforge.nekohtml', name: 'nekohtml', version: '1.9.22' 
+1

にこれを追加右。 Springブートはnekohtml依存関係を管理します(バージョンなしでその依存関係を追加することができます)が、thymeleafスターターはデフォルトでそれを持ってこない。 –

+1

私のために驚いています:) Neko HTMLはThymeleafの必須アイテムですが、spring-boot-thymeleafには含まれていませんでした。私は何かが恋しいと思った。ありがとう! – kamaci

+0

たとえば、HTML5モードを使用する場合、Nekoライブラリはまったく必要ありません。プロジェクトがそれを必要とする場合にのみ含まれるオプションの依存関係としてはるかに優れています。 –

0

あなたがいるあなたpom.xml

<!-- https://mvnrepository.com/artifact/net.sourceforge.nekohtml/nekohtml --> 
<dependency> 
    <groupId>net.sourceforge.nekohtml</groupId> 
    <artifactId>nekohtml</artifactId> 
    <version>1.9.22</version> 
</dependency> 
+0

あなたの答えは完全にOPの質問に答えるわけではありません。 「これを追加」を伝えることに加えて、それを追加する理由と、それが手元の問題を解決するかどうかを説明する必要があります。 – ZF007

関連する問題