日期:2014-05-19  浏览次数:20772 次

ssh spring 依赖注入时 提示错误 请大家帮看一下
这是spring的配置文件
XML code

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



com.test.service.UserInfoServiceImpl类内容
Java code

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;
    }
    
    
}


麻烦大家帮我看一下 这个错误是什么原因导致的

------解决方案--------------------
你的配置文件中没有UserInfoDao呀,把该文件关闭,然后重新打开问题也许就没了,编译一下看看是否仍然报错。其实显示红叉没什么,只要能运行、不出错就OK。你试试运行是否报错,如果出错,请把异常信息贴出来
------解决方案--------------------
XML code
 <bean id="userinfoservice"  class="com.test.service.UserInfoServiceImpl">
        [color=#FF6600]<property name="useri