问题描述
我需要使用我自定义的数据源(基于 Spring)来配置数据库连接器。使用自定义 bean 将数据源配置为 DB 连接器时,出现无法将 javax.sql.Datasource 设置为 org.mule.extension.db.internal.domain.data source.DataSourceConnetionSettings.dataSourceRef 的错误。当我没有配置我的数据库连接器并使用 java invoke 引用数据源时,能够获取数据源对象。如何在运行时将此数据源传递给我的数据库连接器?
参考了以下但没有帮助。
https://help.mulesoft.com/s/article/Spring-based-datasources
有人可以帮我解决以下知识库中的最后一点吗?
https://help.mulesoft.com/s/article/How-to-configure-connector-with-dynamic-parameters
<db:config name="Database_Config">
<db:data-source-connection dataSourceRef="myDbConnetor" />
</db:config>
我的 beans.xml 如下所示:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-4.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.1.xsd">
<context:annotation-config />
<context:component-scan base-package="com.test.datasource.*" />
<bean id="myDbConnetor" class="com.test.datasource.MyCustomDataSource"/>
</beans>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)