특별한 일상

[SPRING] 스프링 MyBatis 오라클 네임스페이스(Spring Mybatis Oracle Namespaces) 본문

IT•개발 끄적/Spring

[SPRING] 스프링 MyBatis 오라클 네임스페이스(Spring Mybatis Oracle Namespaces)

소다맛사탕 2021. 6. 23. 21:05
반응형

안녕하세요. 소다맛사탕 입니다.

지난 포스팅 '[SPRING] 스프링 MyBatis 오라클 JDBC 설정...'에서 언급했던 root-context.xml 파일에 해당 <bean> 클래스를 사용하기 위한 <beans> 선언법에 대해 알아보겠습니다.

 

프로젝트의 pom.xml 파일에 DBCP관련 <depencency> 설정을 제대로 하였으면,

root-context.xml 파일에 다음과 같이 tx, aop, context, mybayis-spring, bean과 같은 네임스페이스를 지정할 수 있게 됩니다.

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mybatis-spring="http://mybatis.org/schema/mybatis-spring"
    xsi:schemaLocation="http://mybatis.org/schema/mybatis-spring
    http://mybatis.org/schema/mybatis-spring-1.2.xsd
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-4.1.xsd">
    
    <bean>
        ...
    </bean>    
</beans>

 

그럼 이런 <beans> 클래스 네임스페이스는 어디서 지정하나...

 

root-context.xml namespace 지정

root-context.xml 파일 클릭하면 하단Namespaces라 적혀있는 부분이 있는데.

mybatis-spring을 체크하고 저장하면 됩니다.

 

※ pom.xml에 추가된 <dependency>에 따라서 지정할 수 있는 Namepaces가 정해지기 때문에 프로젝트에 맞게 사용하려는 라이브러리를 잘 추가 해주세요. 

 

참고로 root-context.xml <beans> 클래스를 Namespaces를 이용하여 지정하고 싶은데

저런 Namespaces가 안보인다 하면...

root-context.xml 우클릭 > Open With > Spring Config Editor 를 지정

root-context.xml Spring Config Editor

 

Comments