SpringBoot 2.X 정리
  • README
  • 1. SpringBoot 처음 사용할 때 + Lombok 설명
  • 2. Spring Data JPA
  • 3. Spring Data JPA 를 이용한 쿼리 연습
  • 4. JPA 연관관계 처리
  • 5. Thymeleaf 사용법
  • 6. Spring MVC 를 이용한 게시판 구현연습
  • 7. Spring Security 4 JDBC 를 이용한 로그인 인증방법
  • 8. Maven -> Gradle 변경작업
  • 9. React 구성하기
  • 10. SpringSecurity 인증 후 로그인 객체는 어떻게?
  • 11. SpringBoot에서 Amazon SES 서비스 사용하기
  • 12. SpringBoot에서 ElasticBeanStalk ebextensions 파일 만들기
  • 오류 상황과 대처법
    • 1. Querydsl
    • 2. MYSQL 오류 대처법
    • 3.Ajax CSRF 대처법
    • 4. Heroku 배포하기
    • 5. 프로젝트 이름 변경
    • 6. Gradle 오류 대처법
    • 7. React 오류 대처법
    • 8. Tymeleaf LocalDateTime
    • 9. JpaAuditing을 통한 시간 동기화
    • 10. AWS RDS timezone과 charset 변경
Powered by GitBook
On this page
  • 1. thymeleaf 추가 Dependency
  • 2. AppApplication.class 에 추가하기
  • 3. thymeleaf 구문

Was this helpful?

  1. 오류 상황과 대처법

8. Tymeleaf LocalDateTime

Java 8에서 TimeStamp보다 LocalDateTime을 쓰라고 권장하고 있다.

이에 따라 수정한 과정을 설명하고 OneToMany에서 수정시간 고치는 방법을 기술한다.

1. thymeleaf 추가 Dependency

java8 thymeleaf에서 LocalDateTime 형식을 #date를 써서 가져오려고 하면 Error 가 발생한다. 이를 해결하기 위한 방법이 #temporals를 통해 가져오는데 이를 설정하기 위해 다음과 같은 Dependency가 필요하다.

<dependency>
    <groupId>org.thymeleaf.extras</groupId>
    <artifactId>thymeleaf-extras-java8time</artifactId>
    <version>3.0.1.RELEASE</version>
</dependency>

2. AppApplication.class 에 추가하기

아래의 Bean을 넣어주어야 작동을 한다.

 @Bean
    public Java8TimeDialect java8TimeDialect() {
        return new Java8TimeDialect();
    }

3. thymeleaf 구문

예시) 처럼 #temporals를 기존 #dates 처럼 쓰면 된다.

<tr th:class="${iterStat.last}? 'border-bottom'">
    <th>출석시간</th>
    <td class="small">[[${#temporals.format(user.regdate)}]]</td>
</tr>
Previous7. React 오류 대처법Next9. JpaAuditing을 통한 시간 동기화

Last updated 5 years ago

Was this helpful?