반응형 Thymeleaf2 springboot thymeleaf properties 값 가져오기 springboot thymeleaf properties 값 가져오기 Springboot project에서 properties 파일이나 yml 파일에 설정된 값을 thymeleaf에서 가져오는 방법을 알아보겠습니다. 우선 환경설정 파일에 저장된 값을 가져올 때는 아래와 같이 사용합니다. ${@environment.getProperty('properties.key')} 그리고 환경 변수 값을 가져오기 위해선 아래의 taglib을 추가하셔야 합니다. 예를들어 카카오지도의 키를 properties active에 따라 다르게 하기 위해선 아래와 같이 설정합니다. thymeleaf에서 사용하기 application.yml spring: profiles: active: dev . . . spring: config:.. Programing/JavaScript 2022. 9. 28. Thymeleaf layout 적용 방법 Thymeleaf layout 적용 방법 Spec springboot 2.6.7 thymeleaf 3.0.15 Apache tiles와 같은 기능을 해주는 Thymeleaf layout을 적용하는 방법을 알아보겠습니다. layout은 별도의 설정파일 없이 .html 코드만 수정하면 적용이 가능하기 때문에 tiles 에 비해 적용이 쉽습니다. Dependency 추가 (gradle) implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation group: 'nz.net.ultraq.thymeleaf', name: 'thymeleaf-layout-dialect' layout을 사용하기 위해서는 thymeleaf-l.. Programing/JavaScript 2022. 5. 19. 이전 1 다음 💲 추천 글 반응형