환경
1. Java 17
2. Mysql 8.0.32
3. JPA
프로젝트 폴더 구성
- domain
- post
- controller
- service
- dto
- repository
- entitiy
- global
- exception
- handler
API 명세
기능 | method | url | request | response |
게시글 작성 | POST | /post | { “title”: “title”, “writer”:writer”, “password”: “password”, “content”:”content”} | {”title” :”title”, “writer”: “writer”, “content”:”content”, ”creatdAt”, “createdAt”} |
게시글 전체 조회 | GET | /post | [ {”title” :”title”, “writer”: “writer”, “content”:”content”, ”creatdAt”, “createdAt”}, … ] | |
게시글 단건 조회 | GET | /post/{id} | id | {”title” :”title”, “writer”: “writer”, “content”:”content”, ”creatdAt”, “createdAt”} |
게시글 업데이트 | PUT | /post/{id} | id, { “title”: “title”, “writer”:writer”, “password”: “password”, “content”:”content”} | {”title” :”title”, “writer”: “writer”, “content”:”content”, ”creatdAt”, “createdAt”} |
게시글 삭제 | DELETE | /post/{id} | id | {”Task” : “Delete” , “msg” : “성공”} |
이슈
프로그램 실행 중 DB관련 에러가 발생했다. 에러 확인 후 검색을 통해 해결책을 찾았다.
❗ Caused by: org.hibernate.HibernateException: Unable to determine Dialect without JDBC metadata (please set 'javax.persistence.jdbc.url', 'hibernate.connection.url', or 'hibernate.dialect')
설정에 Hibernate에 대한 설정중 1개가 빠져있는 걸 발견했다. application.properties에 추가함으로 해결했다.
✅ spring.jpa.database-platform= org.hibernate.dialect.MySQLDialect
Git Repository
GitHub - ironprayer/post-backend
Contribute to ironprayer/post-backend development by creating an account on GitHub.
github.com
생각
언제나 그렇지만 코드를 따라 쳐보는 것과 실제로 내가 해보는 것은 차이가 있다는 걸 느낀다. 그리고 환경은 왜 항상 문제가 되는지 똑같이 하는 것 같은데도 뭔가 하나씩 빠져서 안 되는 경우가 있다. 크든 작든 프로젝트할 때는 이런 것을 주의하며 진행을 해야겠다.
'개발일지 > TIL' 카테고리의 다른 글
[230630] @Bean과 @Component 차이? (0) | 2023.06.30 |
---|---|
[230629] NullPointerException를 Status Code 400으로 내보내기 (0) | 2023.06.29 |
[230627] 네트워크와 Java Spring 기본 개념 이해하기 (5) (0) | 2023.06.27 |
[230626] 네트워크와 Java Spring 기본 개념 이해하기 (4) (0) | 2023.06.26 |
[230625] 네트워크와 Java Spring 기본 개념 이해하기 (3) (0) | 2023.06.25 |