【发布时间】:2015-11-03 14:13:45
【问题描述】:
我正在为 Maven 多模块项目中的 application.properties 设置而苦苦挣扎。 我有结构
--parent
----core-api
----infrastructure (infrastructure.properties)
----command
----web (application.properties)
我为 appliaction.properties 使用了不同的名称,因为我想将它们全部加载到目标模块中。
@PropertySource(value = { "classpath:application.properties","classpath:infrastructure.properties" })
到我的 web 模块中的 Application.class。但是当我从我的父项目运行命令 mvn spring-boot:run 时,我得到了异常:
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.github.bilak.axonframework.poc.Application]; nested exception is java.io.FileNotFoundException: class path resource [infrastructure.properties] cannot be opened because it does not exist
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:180)
我的项目可以找到here
- 如何在使用 maven 插件时让它工作?有没有办法在 java 中设置它并使用 maven 运行?
- 这与 maven 更相关,但是我可以从 web 模块运行 mvn spring-boot:run 而不将依赖模块安装到本地存储库吗?
提前致谢
【问题讨论】:
标签: java maven spring-boot