无法解析匹配的构造函数

时间:2014-03-21 05:46:34

标签: java spring hibernate

您好我有以下错误...一个类不是附加修复类并调用它... app.context在哪里问候,并将感谢您的支持

public class LocationServiceImpl implements ILocationServiceImpl{

            private  LocationDAOImpl locationDAOImpl;

        @Override
        public List<String> listaIDstate() throws DataAccessException {

            return locationDAOImpl.listaIDstate();
        }

        @Override
        public List<String> listastate() throws DataAccessException {

            return locationDAOImpl.listastate();
        }

        @Override
        public List<String> listaIDmunicipaly() throws DataAccessException {

            return locationDAOImpl.listaIDmunicipaly();
        }

        @Override
        public List<String> Idparroquias(String parish_id, String locationname)
                throws DataAccessException {

            return locationDAOImpl.Idparroquias(parish_id, locationname);
        }

        @Override
        public List<String> listaMunicipiosBYparentLocation(String parentLocatio)
                throws DataAccessException {

            return locationDAOImpl.listaMunicipiosBYparentLocation(parentLocatio);
        }

        @Override
        public List<String> listaParroquiasBYparentLocation(String list)
                throws DataAccessException {

            return locationDAOImpl.listaParroquiasBYparentLocation(list);
        }

        @Override
        public List<String> listaMunicipiosBYlocationID(String id)
                throws DataAccessException {

            return locationDAOImpl.listaMunicipiosBYlocationID(id);
        }

        @Override
        public List<String> listaIDmunicipioBYnamemunicipio(String namemunicipio)
                throws DataAccessException {

            return locationDAOImpl.listaIDmunicipioBYnamemunicipio(namemunicipio);
        }


        public LocationDAOImpl getLocationDAOImpl() {
            return locationDAOImpl;
        }

        public void setLocationDAOImpl(LocationDAOImpl locationDAOImpl) {
            this.locationDAOImpl = locationDAOImpl;
        }

    }
<?xml version="1.0"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context" 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.2.xsd
        http://www.springframework.org/schema/tx 
        http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.2.xsd">

    <context:annotation-config />
    <context:component-scan base-package="pp.qqqq" />

    <bean id="propertyConfigurer"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
        p:location="/WEB-INF/jdbc.properties" />

    <bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource"
        p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.databaseurl}"
        p:username="${jdbc.username}" p:password="${jdbc.password}" />

    <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="packagesToScan">
            <list>
                <value>pp.qqqq.model.entity</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${jdbc.dialect}</prop>
                <prop key="hibernate.show_sql">true</prop>
            </props>
        </property>
    </bean>


    <tx:annotation-driven transaction-manager="transactionManager" />


    <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>

    <bean id="locationServiceImpl" class="pp.qqqq.service.LocationServiceImpl">
        <constructor-arg ref="transactionManager" />
    </bean>

</beans>

1 个答案:

答案 0 :(得分:5)

您的LocationServiceImpl班级没有接受TransactionManager的构造函数,但是您在此处尝试使用的是

<bean id="locationServiceImpl" class="pp.qqqq.service.LocationServiceImpl">
    <constructor-arg ref="transactionManager" />
</bean>

摆脱constructor-arg。我甚至不知道你的LocationServiceImpl课程会发生什么。