找到你要的答案

Q:Mule-DB configuration using spring-bean

Q:使用弹簧豆的骡子DB配置

I need a way to configure MySQL DB in Mule using Spring-Bean. I tried exploring on internet but there is no solution for me. I'm a newbie in mule. Any help would be appreciated.

Thanks

我需要一种方式来使用Spring bean骡配置MySQL数据库。我尝试在互联网上探索,但没有解决办法。我是一个新手在骡子。任何帮助将不胜感激。

谢谢

answer1: 回答1:

if you want to use a Spring bean, define a DataSource and supply it with Mysql Dirver and details something like:

<spring:bean id="dataSource"
            class="org.enhydra.jdbc.standard.StandardDataSource" destroy-method="shutdown">
            <spring:property name="driverName" value="com.mysql.jdbc.Driver" />
            <spring:property name="url" value="${db.url}" />
            <spring:property name="user" value="${db.user}" />
            <spring:property name="password" value="${db.password}" />
        </spring:bean>

And reference it form your db:config:

<db:generic-config name="dbConfig" dataSource-ref="dataSource" />

如果你想使用一个弹簧豆,定义一个数据源,它供给MySQL驱动程序和细节之类的:

<spring:bean id="dataSource"
            class="org.enhydra.jdbc.standard.StandardDataSource" destroy-method="shutdown">
            <spring:property name="driverName" value="com.mysql.jdbc.Driver" />
            <spring:property name="url" value="${db.url}" />
            <spring:property name="user" value="${db.user}" />
            <spring:property name="password" value="${db.password}" />
        </spring:bean>

和参考它形成您的DB:配置:

<db:generic-config name="dbConfig" dataSource-ref="dataSource" />
java  mule