Coding market
Springboot - mariaDB - JPA 로 프로젝트 시작하기
시간절약연구소
2020. 11. 11. 13:01
IntelliJ를 통해 프로젝트 생성
SpringInitializer로 생성
SQL에서 Spring Data JPA / Mysql Driver 선택
log4j도 클릭클릭이면 좋을텐데,
수동으로 maven 설정을 해주어야 원활히 진행이 된다.
<!-- https://mvnrepository.com/artifact/org.bgee.log4jdbc-log4j2/log4jdbc-log4j2-jdbc4.1 -->
<dependency>
<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
<version>1.16</version>
</dependency>
application.properties
spring.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy
spring.datasource.url=jdbc:log4jdbc:mysql://localhost:3306/TestDB?autoReconnect=true&useSSL=false&characterEncoding=UTF-8
spring.datasource.username=testuser
spring.datasource.password=testpassword
logging.level.org.ms=info
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.show-sql=true
SpringBoot 2.3.5를 사용하였는데, build 쪽에 또 에러가 있어서 plugins를 pluginManagement로 감싸주었다.
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</pluginManagement>
</build>
계속 프로젝트 환경을 복사해서 쓰다가,
오랫만에 처음부터 생성하다 막힌 부분을 복기해 본다.