본문 바로가기

SPRING

[Spring] Annotation 어노테이션 설정

728x90

- 자바 APP

-> xml

-> @(annotation)

 

 

- 서블릿 설정

1) beans 추가

<beans xmlns:context="http://www.springframework.org/schema/context"

 xsi:schemaLocation="http://www.springframework.org/schema/context
                             https://www.springframework.org/schema/context/spring-context.xsd">

 

2) 어노테이션을 사용하였다면

서블릿.xml에 <context:annotation-config />를 올려주고 <property ~ />는 삭제해준다.

 

-> <context:annotation-config />  -> 어노테이션 사용하기위함(context:component-scan사용하면 쓸 필요 없다)

-> <context:component-scan base-package="패키지명"/>

 

728x90