`gradle dependencies`์—๋Š” api ์„ ์–ธ๊ณผ implementation ์„ ์–ธ์ด ์กด์žฌํ•œ๋‹ค.

ํŠนํžˆ ๋ฉ€ํ‹ฐ๋ชจ๋“ˆ ๊ตฌ์กฐ์ธ ํ”„๋กœ์ ํŠธ์˜ ๊ฒฝ์šฐ ๋‘ ๊ฐ€์ง€๋ฅผ ํ•จ๊ป˜ ์“ฐ๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ๊ธฐ ๋•Œ๋ฌธ์— ์ •๋ฆฌ๋ฅผ ํ•ด๋‘๋ ค๊ณ  ํ•œ๋‹ค!


๐Ÿ˜ api, implementation

dependencies {
	api 'org.springframework.boot:spring-boot-starter-data-jpa'
	implementation 'org.springframework.boot:spring-boot-starter-security'
}

 

api ์„ ์–ธ์„ ์‚ฌ์šฉํ•˜๋ฉด ์„ ์–ธ๋œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” ํ•ด๋‹น ๋ชจ๋“ˆ์„ ์˜์กดํ•˜๋Š” ๋ชจ๋“ˆ์˜ ์ปดํŒŒ์ผ, ๋Ÿฐํƒ€์ž„์˜ ํด๋ž˜์ŠคํŒจ์Šค์— ๋ชจ๋‘ ํฌํ•จ๋œ๋‹ค.

โ€ป ์˜ˆ์‹œ์˜ spring-boot-starter-data-jpa๋Š” api ์„ ์–ธ์ด๊ธฐ ๋•Œ๋ฌธ์—, ์ด ๋ชจ๋“ˆ์„ ์˜์กดํ•˜๋Š” ๋‹ค๋ฅธ ๋ชจ๋“ˆ๋“ค๋„ ํ•ด๋‹น ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค.

ํ•˜์ง€๋งŒ api ์„ ์–ธ์„ ๋‚จ์šฉํ•˜๊ฒŒ ๋˜๋ฉด ๋ชจ๋“ˆ๊ฐ„ ๊ฒฐํ•ฉ์ด ์ฆ๊ฐ€ํ•˜๊ฒŒ ๋˜๊ณ , ๋ณ€๊ฒฝ ์ „ํŒŒ๊ฐ€ ์ปค์ง„๋‹ค.

 

implementation ์„ ์–ธ์€ ํ˜„์žฌ ๋ชจ๋“ˆ ๋‚ด์—์„œ๋งŒ ์ปดํŒŒ์ผ, ๋Ÿฐํƒ€์ž„์— ์‚ฌ์šฉ๋˜๊ณ  ์™ธ๋ถ€์—๋Š” ๊ณต๊ฐœ๋˜์ง€ ์•Š๋Š”๋‹ค.

โ€ป ์˜ˆ์‹œ์˜ spring-boot-starter-security๋Š” ์ด ๋ชจ๋“ˆ์„ ์˜์กดํ•˜๋Š” ๋‹ค๋ฅธ ๋ชจ๋“ˆ๋“ค์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๊ณ , ๊ฐ๊ฐ ์„ ์–ธ์„ ๋‹ค์‹œ ํ•ด์ค˜์•ผ ํ•œ๋‹ค.


๐Ÿšฉ ๋ชจ๋“ˆ ์„ ์–ธํ•˜๊ธฐ

`core`๋ชจ๋“ˆ๊ณผ `service`๋ชจ๋“ˆ์ด ์žˆ๊ณ , `service`๋ชจ๋“ˆ์—์„œ `core`๋ชจ๋“ˆ์„ ๊ฐ€์ ธ๋‹ค ์“ฐ๋ ค๊ณ  ํ•œ๋‹ค.

// core
plugins {
	id 'java-library'
}
dependencies {
	api 'org.springframework.boot:spring-boot-starter-data-jpa'
	implementation 'org.springframework.boot:spring-boot-starter-security'
}

// service
dependencies {
	implementation project(":core")
	implementation 'org.springframework.boot:spring-boot-starter-security'
}

 

core ๋ชจ๋“ˆ์—์„œ๋Š” `java-library` ํ”Œ๋Ÿฌ๊ทธ์ธ๋„ ์„ ์–ธ์„ ํ•ด์ค˜์•ผ ํ•œ๋‹ค.

์ดํ›„ service ๋ชจ๋“ˆ์—์„œ `implementation project`๋ฅผ ํ†ตํ•ด core์— ์žˆ๋Š” api ์„ ์–ธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋“ค์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ๋‹ค.

 

`spring-boot-starter-security`๋Š” core์—์„œ implementation์œผ๋กœ ์„ ์–ธ๋˜์—ˆ๊ธฐ ๋•Œ๋ฌธ์—

service ๋ชจ๋“ˆ์—์„œ ์‚ฌ์šฉํ•˜๋ ค๋ฉด core ๋ชจ๋“ˆ์—์„œ api ์„ ์–ธ์œผ๋กœ ๋ณ€๊ฒฝํ•˜๊ฑฐ๋‚˜, service ๋ชจ๋“ˆ์—์„œ ์žฌ์„ ์–ธ ํ•ด์•ผ ํ•œ๋‹ค.

+ Recent posts