Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- github
- 자바
- error
- 리눅스
- git
- java
- SQL
- Javascript
- Linux
- analytics4
- isNotEmpty
- spring
- Python
- 호이스팅
- IntelliJ
- 티스토리챌린지
- iBatis
- DBMS
- oracle
- mysql
- pandas
- zset
- 명령어
- docker
- mssql
- Kibana
- 오블완
- datagrip
- 404error
- PostgreSQL
Archives
- Today
- Total
hanker
Spring boot - thymeleaf layout 사용 시 설정 (layout 적용 안될 때) 본문
반응형
Spring boot에서 분명히 thymeleaf 의존성을 설정해 주고 layout을 사용했는데 layout 적용이 안된다.
아래 글에서 해결 방법을 알아보자.
dependency 설정
1. 최초 프로젝트 셋팅할때에 설정하거나, pom.xml 또는 gradle에 추가해 준다.

<!-- pom.xml -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- build.gradle -->
implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
- 최초 설정 시 이렇게만 추가하고 layout을 사용해 보면 layout이 적용이 안되는데, layout을 사용하기 위해서는 추가 의존성 주입을 해줘야 한다.
2. 추가 의존성 주입
<!-- pom.xml -->
<dependency>
<groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId>
</dependency>
<!-- build.gradle -->
implementation("nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect")
- Spring Boot 프로젝트에서는 이 의존성만 추가하면 자동으로 설정되고, 별도의 설정 클래스는 없다.
- Thymeleaf Layout Dialect를 추가하게 되면 layout:decorate 및 layout:fragment와 같은 레이아웃 관련 속성을 제공한다.
반응형
'SPRING' 카테고리의 다른 글
Redis - Spring Boot + Redis를 사용하여 실시간 검색어 순위 만들기 (3) 화면에 데이터 넘겨주기 (0) | 2025.04.08 |
---|---|
Spring boot - 스프링 부트 프로젝트 jar파일 생성 방법 (0) | 2025.04.07 |
iBatis - isEmpty, isNotEmpty / isNull, isNotNull 뭘 써야 할까? (빈 값 / null 체크) (0) | 2025.03.18 |
iBatis - isEmpty / isNotEmpty 사용 방법 (null or 빈 값 체크) (0) | 2025.03.17 |
iBatis - isEqual / isNotEqual (문자열 비교) (0) | 2025.03.12 |