개발자 구겹이

[springboot]웹 구동 시 setting - default-web-mapping-root! 본문

java/springboot

[springboot]웹 구동 시 setting - default-web-mapping-root!

@layers9 2024. 5. 28. 20:39

 

 

스프링부트에서 프로젝트를 run할 때 : 웹 구동할 때

 

웹에 출력될 페이지의 default mapping ~ root path를 설정할 때는 

 

프로젝트 내의 ♧application.properties 파일에서 설정 사항을 추가해주자

 

 

 

application.properties

spring.thymeleaf.prefix = classpath:templates/thymeleaf/

    □ 본래 기본 출력되는 루트는 /static/index.html이다

    □ templates폴더 하위에 thymeleaf 폴더를 수동으로 생성해주자

 

spring.thymeleaf.check-template-location = true

spring.thymeleaf.suffix = .html

spring.thymeleaf.mode = HTML

spring.thymeleaf.cache = false

 

 

/templates/thymeleaf/thymeleaf-test.html

 

 

th:text 는 타임리프의 하나의 속성

그 안의 값은 공백을 허용하지 않는다

본래 태그 내의 텍스트보다 우선 출력한다

     <html xmlns:th="http://www.thymeleaf.org"> 

 

 

 

 

 

 

오늘도 개발의 반이라는 환경설정과 싸우는 중에 눈이 멀어버렸다_240528