Skip to content

madvirus/ddd-start

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

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์„ ํด๋ฆญํ•ด์„œ ์ฝ”๋“œ๋ฅผ ๋‹ค์šด๋กœ๋“œ ๋ฐ›๊ณ  ์••์ถ•์„ ํ‘ผ๋‹ค.

MySQL DB ์ƒ์„ฑ ๋ฐ ๋ฐ์ดํ„ฐ ์ดˆ๊ธฐํ™”

  • src/sql/ddl.sql ํŒŒ์ผ์„ ์ด์šฉํ•ด์„œ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ํ…Œ์ด๋ธ” ์ƒ์„ฑ
    • shop ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ƒ์„ฑ
    • shopuser ์‚ฌ์šฉ์ž ์ƒ์„ฑ
    • ๊ด€๋ จ ํ…Œ์ด๋ธ” ์ƒ์„ฑ
  • src/sql/init.sql ํŒŒ์ผ๋กœ ์˜ˆ์ œ ์‹คํ–‰์— ํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ ์ดˆ๊ธฐํ™”

docker-compose ์‚ฌ์šฉ์‹œ

docker-compose up

JPA ๋ฉ”ํƒ€๋ชจ๋ธ ์ƒ์„ฑ

OrderSummary_ ์™€ ๊ฐ™์ด ์ด๋ฆ„์— '_'๊ฐ€ ํฌํ•จ๋œ JPA ๋ฉ”ํƒ€ ๋ชจ๋ธ ํด๋ž˜์Šค๋ฅผ ์ƒ์„ฑํ•˜๋ ค๋ฉด ๋‹ค์Œ ์ค‘ ํ•œ ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•œ๋‹ค.

  • mvn compile ๋ช…๋ น์–ด๋กœ ์ƒ์„ฑ
  • mvn generate-sources ๋ช…๋ น์–ด๋กœ ์ƒ์„ฑ

mvn compile ๋ช…๋ น์–ด๋กœ ์ƒ์„ฑํ•˜๊ธฐ

ํ˜„์žฌ pom.xml ํŒŒ์ผ์€ mvn compile ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜๋Š” ๊ณผ์ •์—์„œ JPA ๋ชจ๋ธ ํด๋ž˜์Šค๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. mvn compile ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜๋ฉด ๋‹ค์Œ ํด๋”์— ๋ฉ”ํƒ€๋ชจ๋ธ ํด๋ž˜์Šค๊ฐ€ ์ƒ์„ฑ๋œ๋‹ค.

  • target/generate-soruces/annotations

mvn generate-sources ๋ช…๋ น์–ด๋กœ ์ƒ์„ฑํ•˜๊ธฐ

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์— ์ ‘์†ํ•˜๋ฉด ๊ฒฐ๊ณผ ํ™”๋ฉด์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages