본문 바로가기
비전공자 IT 이야기/Java

Spring Boot + Thymeleaf + Layout 적용 안되는 현상 2022

by 제이 로그 2022. 5. 6.

thymeleaf 관련 depedency 추가 시 종속성을 없앴더니 해결!

아.. 문제 해결 하는데 몇 시간이나 날린 건지.. ㅜㅜ 흐엉..

 

수정 이전

implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:2.6.7'
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:3.1.0'

 

해결!

implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect'

 

그 외 원인이 될 수 있는 부분 참고할 점

 

1. Spring Boot 2.6.0부터 @Bean 추가 필요 없어짐. 버전에 따라 Bean 추가 빠뜨렸는지 확인 필요

https://ultraq.github.io/thymeleaf-layout-dialect/migrating-to-2.0/

Spring Boot 2.6.0 includes support for Thymeleaf Layout Dialect 3, and so this extra configuration is not necessary from that version on.

@Bean
public LayoutDialect layoutDialect() {
  return new LayoutDialect();
}

 

2. layout:decorator 삭제됨. layout:decorate로 변경 필요

https://ultraq.github.io/thymeleaf-layout-dialect/migrating-to-3.0/

Deprecated decorator processor has been deleted

This was deprecated back in 2.0 (thymeleaf-layout-dialect/issues/95) in favour of decorate as the naming was misleading, and has now been deleted.

댓글