私の現在のスプリング ブート プロジェクトでは、次の html コードを含むビューが 1 つあります。
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right" sec:authorize="isAuthenticated()">
...
</ul>
<ul class="nav navbar-nav navbar-right" sec:authorize="isAnonymous()">
...
</ul>
</div>
sec:authorizeしかし、アプリケーションを実行すると、両方の部分が表示されているため、タグが評価されていないようです。
application.properties ファイルで thymeleaf を次のように構成します。
# THYMELEAF (ThymeleafAutoConfiguration)
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.content-type=text/html
spring.thymeleaf.cache=false
私の thymeleaf 構成クラスは次のように実装されています。
@Configuration
public class Thymeleaf {
@Bean
public SpringTemplateEngine templateEngine() {
SpringTemplateEngine engine = new SpringTemplateEngine();
final Set<IDialect> dialects = new HashSet<IDialect>();
dialects.add( new SpringSecurityDialect() );
engine.setDialects( dialects );
return engine;
}
}
誰でも私がここで欠けているものを指摘できますか?