Posts
Q&A
EntityGraph
1๋ฒ์... MemberRepository.java๋ JpaRepository๋ฅผ ํ์ฅํฉ๋๋ค (์์๋ฐ์ต๋๋ค)๊ทธ๋ ๊ฒ ๊ทธ ๋ถ๋ชจ์ธ PagingAndSortingRepository, CrudRepository ๋ณด์๋ฉด ๋ ๊ฒ๊ฐ์ต๋๋ค.. ์ฟผ๋ฆฌ ๋ฉ์๋ ๊ธฐ๋ฅ ๋ค์ด๊ฐ๊ธฐ ์ง์ ์ ๊ฐ์์ ๋์ต๋๋ค
- Likes
- 0
- Comments
- 2
- Viewcount
- 484
Q&A
๊ฐ์ฌ๋ ํ์ฌ ๋ฑ๋กํ๋ ๋ถ๋ถ์์ ์ค๋ฅ๊ฐ ๋๋๋ฐ ์ด์ ๋ฅผ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
ํน์ hello.itemservice.domain.item.ItemItem์ ํ๋ ์ค์ deliveryCode๋ฅผ String ํ์ ์ด ์๋ ๋ค๋ฅธ ํ์ ์ผ๋ก ์ ์ํด๋ ๊ฒ์ด ์๋๊น ์ถ์ต๋๋ค. private ItemType itemType; // ์ํ ์ข ๋ฅprivate DeliveryCode deliveryCode; // ๋ฐฐ์ก๋ฐฉ์ ์ด๋ ๊ฒ ์์ฑํด๋์ จ๋์..>? ๊ทธ๋ ๋ค๋ฉด ์๋์ฒ๋ผ ๋ฐ๊ฟ์ฃผ์๋ฉด ๋ ๊ฒ ๊ฐ์ต๋๋ค. private ItemType itemType; // ์ํ ์ข ๋ฅprivate String deliveryCode; // ๋ฐฐ์ก๋ฐฉ์
- Likes
- 0
- Comments
- 2
- Viewcount
- 1.4K
Q&A
ํผ์ ํตํด ๋ฐ์ ๋ฐ์ดํฐ๋ฅผ, ์ง์ ๋ง๋ Model์ ๋งคํํ๋ ๋ฐฉ๋ฒ
๋ต ๋งจ์์ ์ํ๋๊ณผ, OMG๋์ ์ฝ๋๋ฅผ ๋ณด๊ตฌ@ModelAttribute๊ฐ ์ปฌ๋ ์ ํ๋๋ฅผ ๊ฐ์ง๋ ์ปค์คํ ๊ฐ์ฒด(์ค์ฒฉ๋)๋ฅผ ๋ฐ์ ์ ์๊ฒ ์์ ํ ์ ์์์ต๋๋ค JPA๊ฐ์ ์ง์ง ๋ฃ๊ณ ์ถ์ด์ก์ต๋๋ค ใ ใ ๊ณ ๋ง์ต๋๋ค!!
- Likes
- 0
- Comments
- 3
- Viewcount
- 1.2K
Q&A
๊ถ๊ธํ์ ์ด ์์ด์ ์ง๋ฌธ๋๋ฆฝ๋๋ค.
- AppConfig(*์ง์ ๋ง๋ ๋น ์ค์ ํ์ผ)๋ ์๋ฐ ์ฝ๋๋ฅผ ์ด์ฉํ์ฌ ์ง์ ๋น์ ๋ฑ๋กํ๋ ๋ฐฉ์์ด๋ผ์ public class AppConfig์์๋ @Configurationํ๋๋ง ๋ถ์ต๋๋ค - AutoAppConfig(*Spring์ '๋น ์๋๋ฑ๋ก' ๊ธฐ๋ฅ์ ์ฌ์ฉํ ๋น ์ค์ ํ์ผ)๋ ์ปดํฌ๋ํธ ์ค์บ์ด๋ผ๋ ์คํ๋ง์ ๊ธฐ๋ฅ์ ์ด์ฉํ์ฌ ๋น์ ์๋ ๋ฑ๋กํ๋ ๋ฐฉ์์ด๋ผ์ @Configuration์ธ์ @ComponentScan์ด๋ผ๋ ์ด๋ ธํ ์ด์ ์ด ์ถ๊ฐ๋ก ๋ถ์ต๋๋ค @ComponentScan์ ํ์ธํ ์คํ๋ง ์ปจํ ์ด๋๋ ํด๋น ํ์ผ(AutoAppConfig)์ ํจํค์ง(hello.core)๋ฅผ ํฌํจํ ํ์ ํจํค์ง๋ฅผ ๋ชจ๋ ์ค์บํ์ฌ @Component ์ ๋ ธํ ์ด์ ์ด ๋ฌ๋ฆฐ ํด๋์ค๋ค์ ์ฐพ์ ์๋์ผ๋ก ๋น์ ๋ฑ๋กํฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ ๊ฐ ํด๋์ค๋ค(MemoryMemberRepository, RateDiscountPolicy, MemberServiceImpl, OrderServiceImpl)์ ์์ฑ์์ ๋ฌ๋ฆฐ @Autowired ์ด๋ ธํ ์ด์ ์ ๋ณด๊ณ , ์คํ๋ง ์ปจํ ์ด๋๋ ์๋ ๋ฑ๋กํ ๋น๋ค์ Type ๋งค์นญ์ ํตํด ์์กด๊ด๊ณ๋ฅผ ์๋์ฃผ์ (์์ฑ์ ์ฃผ์ ) ํฉ๋๋ค. ๊ฐ์ ์ด๋ฐ์ ๊น์ํ ๊ฐ์ฌ๋์ ๋ง์์ ๋ค์ ํ ๋ฒ ๋ค์ด๋ณด์๋ฉด ์ดํด๋ ๊ฒ ๊ฐ์ต๋๋ค. "์ค์ต์ ์ํด์ AppConfig๋ฅผ ๋จ๊ฒจ๋๊ณ , AutoAppConfig ๋ฅผ ์์ฑํ๊ฒ ์ต๋๋ค.๋์ ์, ์ง๊ธ๊น์ง ์ฌ์ฉํด์๋ AppConfig ๋น ์ค์ ๋ด์ฉ์ AutoAppConfig๋ด๋ถ์์ @ComponentScan์ excludeFilters ์ต์ ์ ํตํด ์ ์ธํ๋๋ก ํ๊ฒ ์ต๋๋ค" ๋ผ๊ณ ํ์ จ๋ ๊ฒ ๊ฐ์ต๋๋ค. [์ปดํฌ๋ํธ ์ค์บ๊ณผ ์์กด๊ด๊ณ ์๋์ฃผ์ ์์ํ๊ธฐ] ๊ฐ์ ์ ๋ชฉ์ ์ ์๊ฐํด๋ณด์๋ฉด! ๊ธ๋ฐฉ ๋ฐฉํฅ ์ก์ผ์ค ์ ์์ผ์ค ๊ฒ ๊ฐ์ต๋๋ค.
- Likes
- 1
- Comments
- 1
- Viewcount
- 270
Q&A
์ ๋ฌ ์ง๋ฌธ์ด ์์ต๋๋ค.
๋น id๊ฐ disCountPolicy์ธ๋ฐ orderService bean์ constructor-arg๋ discountPolicy๋ฅผ ์ฐธ์กฐํ๋ ๊ฒ ๊ฐ์ต๋๋ค
- Likes
- 0
- Comments
- 1
- Viewcount
- 754




