java - Mule 没有使用 Spring 找到属性文件

标签 java spring mule properties-file

我有一个 Mule 流,我希望通过 Spring .properties 文件进行配置。我已经阅读了有关如何执行此操作的 Mule 文档,并且我很确定我做对了,但是我得到:

Could not load properties; nested exception is java.io.FileNotFoundException: 
class path resource [agt-commission.properties] cannot be opened because 
it does not exist

我的 Mule 流 XML 文件开始于:

<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" 
xmlns="http://www.mulesoft.org/schema/mule/core" 
xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" 
xmlns:http="http://www.mulesoft.org/schema/mule/http" 
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" 
xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper" 
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" 
xmlns:spring="http://www.springframework.org/schema/beans" 
xmlns:core="http://www.mulesoft.org/schema/mule/core"
xmlns:context="http://www.springframework.org/schema/context" 
version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/xml 
http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/http 
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/file 
http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/ee/jdbc 
http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
http://www.mulesoft.org/schema/mule/ee/data-mapper 
http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core 
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ee/tracking 
http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<spring:beans>
    <context:property-placeholder location="classpath:agt-commission.properties"/>
</spring:beans>

我的属性文件位于文档指定的 src/main/app 文件夹中,我已经复制并粘贴了文件名,所以我知道这是一样的。

Project structure

我正在将 Mule Studio (3.5.0) 中的项目作为 Mule 应用程序运行。

为什么Spring找不到属性文件?

最佳答案

将您的 agt-commission.properties 文件存储在 src/main/resources 而不是 src/main/app 中。

默认情况下,app 下的文件不会被复制到 classes,这会导致 FileNotFoundException

关于java - Mule 没有使用 Spring 找到属性文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19360220/

相关文章:

java - 计算特定时区中两个 ZonedDateTime 对象之间的天数?

java - 如何使用不相交的集合来实现迷宫?

java - 配置 Hibernate mySQL 连接时出错 - 连接被拒绝

mule - 在 Mule 4 (DW2.0) 中比较子集数组和主数组

java - Mule3.2 重负载下 GC 频率过高

java - Hibernate 使用 apache commons 日志记录和 slf4j - 为什么需要 2 个日志记录抽象层?

java - 如何使用java执行t-sql脚本?

spring - 如何在 spring 中的 requestparam 中给出默认日期值

java - 将数据从 hibernate 层提取到另一层的最佳方法是什么?

jms - 关于 Mule JMS 队列配置的建议