日期:2014-05-19 浏览次数:20772 次
<?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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"> </property> <property name="url" value="jdbc:thin:@localhost:1521/orcl"> </property> <property name="username" value="orcl"></property> <property name="password" value="orcl"></property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.DerbyDialect </prop> </props> </property> <property name="mappingResources"> <list> <value>com/test/vo/UserInfo.hbm.xml</value></list> </property></bean> <bean id="userinfodaoimpl" class="com.test.dao.UserInfoDaoImpl"> <property name="sessionFactory"> <ref bean="sessionFactory" /> </property> </bean> <bean id="userinfoservice" class="com.test.service.UserInfoServiceImpl"> [color=#FF6600]<property name="userinfodaoimpl"> //这样提示红叉Invalid property name 'UserInfoDao' - not JavaBean compliant [/color] <ref bean="userinfodaoimpl"/> </property> </bean> </beans>
package com.test.service; import java.util.List; import com.test.dao.UserInfoDaoImpl; import com.test.vo.UserInfoVO; public class UserInfoServiceImpl implements UserInfoService{ private UserInfoDaoImpl userinfodaoimpl; public UserInfoDaoImpl getUserinfodaoimpl() { return userinfodaoimpl; } public void setUserinfodaoimpl(UserInfoDaoImpl userinfodaoimpl) { this.userinfodaoimpl = userinfodaoimpl; } @Override public boolean Login(UserInfoVO uiVO) { // TODO Auto-generated method stub List list = userinfodaoimpl.findByUserName(uiVO); if(list!=null&&list.size()>0) return true; return false; } }
<bean id="userinfoservice" class="com.test.service.UserInfoServiceImpl"> [color=#FF6600]<property name="useri