portlet 使用spring jdbcTemplate


<?xml version="1.0" encoding="UTF-8"?>
<beans
    
xmlns="http://www.springframework.org/schema/beans"
    xmlns:aop
="http://www.springframework.org/schema/aop"
    xmlns:context
="http://www.springframework.org/schema/context"
    xmlns:tx
="http://www.springframework.org/schema/tx"
    xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation
="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
    
    
<!-- 配置使用注解 -->
    
<context:annotation-config />
    
<!-- -->
    
<bean id="liferayDataSource" class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
        
<property name="targetDataSource">
            
<bean class="com.liferay.portal.kernel.util.InfrastructureUtil" factory-method="getDataSource" />
        
</property>
    
</bean>
    
    
<bean id="jdbcTemplate"  class="org.springframework.jdbc.core.JdbcTemplate"> 
        
<property name="dataSource"><ref bean="liferayDataSource"/></property> 
    
</bean> 

    
     
<bean id="computerEntryService" class="cn.net.comsys.portlet.ShowNew.service.impl.ComputerEntryServiceImpl"/>
</beans>
原文地址:https://www.cnblogs.com/jifeng/p/2115739.html