티스토리 뷰

Dev/Spring

[Spring] Spring Tips...etc

마이스토리 2016. 5. 9. 17:42

>> <context:annotation-config/> 가 하는 내용


<beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:p="http://www.springframework.org/schema/p"
      xmlns:context="http://www.springframework.org/schema/context"
      xsi:schemaLocation="
                                   http://www.springframework.org/schema/beans
                                   http://www.springframework.org/schema/beans/spring-beans.xsd
                                   http://www.springframework.org/schema/context
                                   http://www.springframework.org/schema/context/spring-context.xsd">
      <context:annotation-config/>

</bean>

<context:annotation-config>태그로 등록되는 BeanPostProcessor

RequiredAnnotationBeanPostProcessor : @Required 어노테이션 처리

AutowiredAnnotationBeanPostProcessor : @Autowired 어노테이션 처리

CommonAnnotationBeanPostProcessor : @Resource, @PostConstruct,@PreDestroy 어노테이션 처리

ConfigurationClassBeanPostProcessor : @Configuration 어노테이션 처리



>> Junit Spring 테스트를 위한 설정


pom.xml dependency추가

<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

   <version>4.12</version>

</dependency>

       

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-test</artifactId>

<version>${spring.maven.artifact.version}</version>

</dependency>


@RunWith(SpringJUnit4ClassRunner.class)

@ContextConfiguration(locations={

"file:src/main/webapp/WEB-INF/config/egovframework/springmvc/dispatcher-servlet.xml",

"classpath:egovframework/spring/*.xml"

})

@WebAppConfiguration

public class CarTest {


@Test

public void test() {

fail("Not yet implemented");

}


}


댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31