:::: 개발 ::::/└ JSP & SPRING

applicationContext.xml 주석..

nayha 2013. 6. 25. 01:28

<?xml version="1.0" encoding="UTF-8"?>

<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"

xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd

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

http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd

http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd

http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd

http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd

http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"

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

xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee"

xmlns:lang="http://www.springframework.org/schema/lang" xmlns:p="http://www.springframework.org/schema/p"

xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util">

<!-- IOC 컨테이너 즉 WAC에 빈으로 등록할때  읽어서 Bean 으로 등록 시킨다 -->

<context:property-placeholder location="classpath*:*.properties" />

<!--  @ 애노테이션은 단지 '빈으로 등록할 수 있는 클래스 라고 표시 실제로 등록해주는 건 component-scan -->

<context:component-scan base-package="sample">

<!--  filter 기능을 이용해서 @controller  빈은 등록하지 않도록 처리 관리 포인트가 아님 --><!--  웹 관련 빈 제외하고 등록 -->

<context:exclude-filter expression="org.springframework.stereotype.Controller" type="annotation" />

</context:component-scan>


<!-- jdbc 네임스페이스 이용 내장형 데이타베이스 설정  애플리케이션 구동될 때 실행할 SQL 지정-->

<jdbc:embedded-database id="dataSource" type="HSQL">

<jdbc:script location="classpath:/script/member_table.sql"/>

</jdbc:embedded-database>


<!--  @Transactional  애노테이션 사용 트랜젝션 경계/특성 사용

   사용 예)

@Transactional

public class MemberServiceImpl implements MemberService {}  

-->

<tx:annotation-driven />


<!-- 

네임스페이스 context,jdbc,tx 스프링 버전이 올라갈수록 새로운것 추가  

예전에는 아래처럼 모두 일일이 bean 으로 등록 후 사용

-->


<!-- iBatis -->

<!-- 

DataSourceTransactionManager 타입의 빈을 transactionManager Id로 등록 

그리고 dataSource 프로퍼티에 dataSource 빈 주입 p 네임 스페이스는 <property name="dataSource" ref="dataSource" /> 를 단축해준다

transactionManager 빈은 스프링에서 JDBC API 를 사용하여 트랜잭션을 처리할 때 사용하는 빈

-->

<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" p:dataSource-ref="dataSource" />

<!--  Dao 구현할 때 사용한 아이바티스 핵심 클래스인 SqlMapClient 를 빈으로 등록 그 빈을 좀더 쉽게 사용할 수있도록s qlMapClientTemplate  빈 등록 -->

<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">

<property name="dataSource" ref="dataSource" />

<property name="configLocation" value="classpath:/SqlMapConfig.xml" />

</bean>


<bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate">

<constructor-arg name="sqlMapClient" ref="sqlMapClient" />

</bean>

</beans>


책 참고하면서 정리 해봄 키키

반응형