DDD START! ์ฌ์ถ๊ฐํ์ธ ๋๋ฉ์ธ ์ฃผ๋ ๊ฐ๋ฐ ์์ํ๊ธฐ ์ฑ ์ ์์ค ์ฝ๋๋ https://github.com/madvirus/ddd-start2 ๋ฆฌํฌ์งํ ๋ฆฌ์ ํ์ธ ๊ฐ๋ฅํฉ๋๋ค.
์๋ ํ๋ก๊ทธ๋จ์ ์ค๋นํ๋ค.
- JDK 1.8
- ๋ฉ์ด๋ธ
- MySQL
git์ ์๋ค๋ฉด ์๋ ๋ช ๋ น์ด๋ก ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ํด๋ก ํ๋ค.
git clone https://github.com/madvirus/ddd-start.git
git์ ๋ชจ๋ฅธ๋ค๋ฉด ์ฐ์ธก ์๋จ์ Download ZIP์ ํด๋ฆญํด์ ์ฝ๋๋ฅผ ๋ค์ด๋ก๋ ๋ฐ๊ณ ์์ถ์ ํผ๋ค.
- src/sql/ddl.sql ํ์ผ์ ์ด์ฉํด์ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ํ
์ด๋ธ ์์ฑ
- shop ๋ฐ์ดํฐ๋ฒ ์ด์ค ์์ฑ
- shopuser ์ฌ์ฉ์ ์์ฑ
- ๊ด๋ จ ํ ์ด๋ธ ์์ฑ
- src/sql/init.sql ํ์ผ๋ก ์์ ์คํ์ ํ์ํ ๋ฐ์ดํฐ ์ด๊ธฐํ
docker-compose upOrderSummary_ ์ ๊ฐ์ด ์ด๋ฆ์ '_'๊ฐ ํฌํจ๋ JPA ๋ฉํ ๋ชจ๋ธ ํด๋์ค๋ฅผ ์์ฑํ๋ ค๋ฉด ๋ค์ ์ค ํ ๋ฐฉ๋ฒ์ ์ฌ์ฉํ๋ค.
- mvn compile ๋ช ๋ น์ด๋ก ์์ฑ
- mvn generate-sources ๋ช ๋ น์ด๋ก ์์ฑ
ํ์ฌ pom.xml ํ์ผ์ mvn compile ๋ช ๋ น์ด๋ฅผ ์คํํ๋ ๊ณผ์ ์์ JPA ๋ชจ๋ธ ํด๋์ค๋ฅผ ์์ฑํ๋ค. mvn compile ๋ช ๋ น์ด๋ฅผ ์คํํ๋ฉด ๋ค์ ํด๋์ ๋ฉํ๋ชจ๋ธ ํด๋์ค๊ฐ ์์ฑ๋๋ค.
- target/generate-soruces/annotations
generate-sources ๋ช ๋ น์ด๋ก ์คํํ๋ ค๋ฉด pom.xml ํ์ผ์ ๋ค์๊ณผ ๊ฐ์ด maven-process-plugin ์ค์ ์ ์ถ๊ฐํ๋ค.
<!-- ๊ธฐ์กด maven-compiler-plugin ์ฃผ์ ์ฒ๋ฆฌ
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArguments>
<processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
</compilerArguments>
</configuration>
</plugin>
-->
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.2.4</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<processors>
<processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
</processors>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${hibernate.version}</version>
</dependency>
</dependencies>
</plugin>
pom.xml ์ค์ ์ ๋ณ๊ฒฝํ์ผ๋ฉด ๋ค์ ๋ช ๋ น์ด๋ฅผ ์คํํ๋ค.
$ mvn generate-sources
์ด ๋ช ๋ น์ด๋ฅผ ์คํํ๋ฉด target/generate-sources/apt ํด๋์ ๋ฉํ๋ชจ๋ธ ํด๋์ค๊ฐ ์์ฑ๋๋ค.
ํ๋ก์ ํธ ํด๋์์ ๋ค์ ๋ช ๋ น์ด๋ก ์์ ๋ฅผ ์คํํ๋ค.
$ mvn spring-boot:run
http://localhost:8080์ ์ ์ํ๋ฉด ๊ฒฐ๊ณผ ํ๋ฉด์ ๋ณผ ์ ์๋ค.