Yudiel
Yudiel

Reputation: 59

Could not resolve matching constructor

Hi I have the following error ... up a class is not as attached to fix the class and call it ... app.context where greetings and would appreciate your support

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>

Upvotes: 0

Views: 5392

Answers (1)

Sotirios Delimanolis
Sotirios Delimanolis

Reputation: 279990

Your LocationServiceImpl class does not have a constructor that accepts a TransactionManager but that's what you're trying to use here

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

Get rid of the constructor-arg. I don't even see where that would go in your LocationServiceImpl class.

Upvotes: 5

Related Questions