编程语言
首页 > 编程语言> > java-Mule无法使用Spring查找属性文件

java-Mule无法使用Spring查找属性文件

作者:互联网

我有一个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文件夹中,并且我已经复制并粘贴了文件名,因此我知道这是相同的.

我正在从Mule Studio(3.5.0)作为Mule应用程序运行项目.

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

解决方法:

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

默认情况下,app下的文件不会复制到导致FileNotFoundException的类中

标签:mule,properties-file,spring,java
来源: https://codeday.me/bug/20191122/2061350.html