Netbeans7.4+Weblogic11g+Spring3.2.4操作JdbcTemplate

4149 ワード

ステップ1:Weblgic 11 g管理インタフェース:http://localhost:7001/consoleでデータソースを作成し、私が作成したjndiの名前は:sjsstjndi
 
ステップ2:springの以下のパッケージをインポートする必要があります:JdbcTemplateを使用してspring-jdbc/txをインポートする必要があります..この二つのかばん.
Netbeans7.4+Weblogic11g+Spring3.2.4操作JdbcTemplate
 
ステップ3:アプリケーションContext.xmlファイル
<?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:p="http://www.springframework.org/schema/p" 

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

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

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

    xsi:schemaLocation="http://www.springframework.org/schema/beans  

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

            http://www.springframework.org/schema/tx 

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

            http://www.springframework.org/schema/aop 

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

            http://www.springframework.org/schema/jee

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

            http://www.springframework.org/schema/context 

            http://www.springframework.org/schema/context/spring-context-3.0.xsd"> 

    

    <!--      ,  Weblogic             -->

    <jee:jndi-lookup id="wst" jndi-name="sjsstjndi"/>

    

    

    <bean id="jdbcTmpl" class="org.springframework.jdbc.core.JdbcTemplate">

          <property name="dataSource">

              <ref bean="wst" />

          </property>

    </bean>     

    

</beans>