[Spring] Component Scan๊ณผ Function์ ์ฌ์ฉํ ๋น ๋ฑ๋ก ๋ฐฉ๋ฒ [Spring] Component Scan๊ณผ Function์ ์ฌ์ฉํ ๋น ๋ฑ๋ก ๋ฐฉ๋ฒ 1. @ComponentScan @ComponentScan ์ ๋ ธํ ์ด์ ์ spring 3.1๋ถํฐ ๋์ ๋์ผ๋ฉฐ ์ค์ ๋ ์์ ์ง์ ๋ถํฐ ์ปดํฌ๋ํธ ํด๋์ค๋ฅผ scanningํ์ฌ ๋น์ผ๋ก ๋ฑ๋กํด์ฃผ๋ ์ญํ ์ ํ๋ค. ์ปดํฌ๋ํธ ํด๋์ค๋ ๋ค์ ์ ๋ ธํ ์ด์ ์ด ๋ถ์ ํด๋์ค๋ฅผ ์๋ฏธํ๋ค. @Component @Repository @Service @Controller @Configuration @ComponentScan์ ๊ฐ์ฅ ์ค์ํ ๋ ๊ฐ์ง ์์ฑ์ component๋ฅผ scanํ ์์ ์ง์ ์ ์ค์ ํ๋ ์์ฑ๊ณผ scanํ component ์ค ๋น์ผ๋ก ๋ฑ๋กํ์ง ์์ ํด๋์ค๋ฅผ ์ ์ธํ๋ ํํฐ ์์ฑ์ด๋ค. 1) Scan ์์ ์ง์ ์ค์ - basePackages()์.. 2020. 3. 2. ์ด์ 1 ๋ค์