如何解决如何在 MUlesoft 中使用自定义数据源配置数据库
我需要使用我自定义的数据源(基于 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 举报,一经查实,本站将立刻删除。