当前位置: 首页 > 工具软件 > Paoding-Rose > 使用案例 >

paoding-rose-jade多数据源配置

阎咏思
2023-12-01

官网文档没有相关的说明,所以费了些劲,但是确实很简单,发出来,希望能帮助到有需要的人


    <bean id="jade.dataSource.cn.bestmk.dao1"
          class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
        <property name="url"
                  value="jdbc:mysql://localhost:3306/db1?useSSL=true&amp;useUnicode=true&amp;character_set_server=utf8mb4"/>
        <property name="username" value="bestmk"/>
        <property name="password" value="bestmk.cn"/>
    </bean>
            <bean id="jade.dataSource.cn.bestmk.dao1"
          class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
        <property name="url"
                  value="jdbc:mysql://localhost:3306/db2?useSSL=true&amp;useUnicode=true&amp;character_set_server=utf8mb4"/>
        <property name="username" value="bestmk"/>
        <property name="password" value="bestmk.cn"/>
    </bean>

如上配置代码,配置多个数据源只需要将不同数据源的dao放在不同的package目录中,例如cn.bestmk.dao1cn.bestmk.dao2

 类似资料: