Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring MVC 3 Hibernate 4多数据库配置_Hibernate_Spring Mvc_Connection_Multiple Databases - Fatal编程技术网

Spring MVC 3 Hibernate 4多数据库配置

Spring MVC 3 Hibernate 4多数据库配置,hibernate,spring-mvc,connection,multiple-databases,Hibernate,Spring Mvc,Connection,Multiple Databases,我必须在我的应用程序中管理多个数据库我的配置文件应用程序是 <?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:mvc="http://www.springframework.org/schema/mvc" xmlns

我必须在我的应用程序中管理多个数据库我的配置文件应用程序是

<?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:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">

    <!-- Scans the classpath of this application for @Components to deploy as beans -->
    <context:component-scan base-package="fr.tessa.jee.webmanager" />

    <!-- Configures the @Controller programming model -->
    <mvc:annotation-driven />

    <!-- misc -->
    <bean id="viewResolver"
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="viewClass"
        value="org.springframework.web.servlet.view.JstlView" />
        <property name="suffix" value=".jsp" />
    </bean>

    <!-- Configure the multipart resolver -->
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <!-- one of the properties available; the maximum file size in bytes -->
        <property name="maxUploadSize" value="1000000" />
    </bean>

    <!-- Configures Hibernate - Database Config -->
    <import resource="dbconfig/db-config.xml" /> 
    <import resource="dbconfig/validationdb-config.xml" />

</beans>

我的“db config.xml”是


com.mysql.jdbc.Driver
jdbc:mysql://127.0.0.1/teodijon
根

我发现了问题,问题在于我的事务方法在我的服务中,我必须像这样指定事务管理器的id

@Transactional(readOnly = true, value="teoTransactionManager")
public List<Client> getClientList() {
    return clientDAO.getClients();
}
@Transactional(readOnly=true,value=“teoTransactionManager”)
公共列表getClientList(){
返回clientDAO.getClients();
}

当我在begin中时,我只输入了@Transactional(readOnly=true)

我发现了问题,问题在我的事务方法中。在我的服务中,我必须像这样指定事务管理器的id

@Transactional(readOnly = true, value="teoTransactionManager")
public List<Client> getClientList() {
    return clientDAO.getClients();
}
@Transactional(readOnly=true,value=“teoTransactionManager”)
公共列表getClientList(){
返回clientDAO.getClients();
}
当我在begin时,我只输入了@Transactional(readOnly=true)

<import resource="dbconfig/validationdb-config.xml" />
<import resource="dbconfig/db-config.xml" /> 
@Transactional(readOnly = true, value="teoTransactionManager")
public List<Client> getClientList() {
    return clientDAO.getClients();
}