<context : annotation-config>
์ <context : component-scan>
์ ์ฐจ์ด์
<context : annotation-config>
- ์ด๋ฏธ ๋ฑ๋ก๋ bean์ ๋ํด์๋ง Annotation์ ํ์ฑํ ํ๋ค.
- ๋ฐ๋ผ์ ์ ํ๊ทธ๋ฅผ ์ฌ์ฉํ๋๋ผ๋ xml์ bean์ ๋ฐ๋์ ์ ์ธํด์ผ ํ๋ค.
@Autowired
์ @Qualifier
๋ ๊ฐ์ง๋ง ํด๊ฒฐํ๋ค.
<context : component-scan>
- bean์ ๋ฑ๋ก์ฌ๋ถ์ ๊ด๊ณ์๋ค. ์คํ๋ง์ด ์์์ bean์ค์บ์ ํตํด Annotation์ ํด์ํ๊ณ ํ์ฑํํ๋ค.
@Autowired
์ @Qualifier
๋ฟ๋ง ์๋๋ผ @Service
, @Component
, @Controller
, @Repository
๋ฑ ๋ชจ๋ ํด๋์ค๋ฅผ ์ค์บํ๊ณ bean์ ์์ฑํ๋ค.
- ๋ค๋ง base-package๋ฅผ ํตํด ์คํ๋ง์ด ์ค์บํ ํจํค์ง ์์น๋ฅผ ์ง์ ํด๋ฌ์ผ ํ๋ค.
<context : component-scan base-package="com.sample"/>