【发布时间】:2019-10-07 14:36:41
【问题描述】:
我有一个包含一个父模块和三个子模块的 Maven 多模块项目。 该应用程序使用弹簧启动。在其中一个子模块中,我有 SpringBootApplication:
@SpringBootApplication
@EnableConfigurationProperties({AppProperties.class})
public class MainSpringBootApplication {
public static void main(String[] args) {
SpringApplication.run(MainSpringBootApplication.class, args);
}
}
应用程序属性在同一个模块中:
@Data
@ConfigurationProperties(prefix = "asdf")
public class AppProperties {
...
}
在该模块的 pom.xml 中有一个 spring-boot-configuration-processor 的依赖项:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
现在的问题是,当我在父项目上运行 mvn install 时,target/classes/META-INF/spring-configuration-metadata.json 未创建此子模块中的文件。当我将该子模块的 pom 修改为直接继承自:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
直接在子模块上做mvn install,生成target/classes/META-INF/spring-configuration-metadata.json文件。
你有什么提示吗?
【问题讨论】:
标签: maven spring-boot configuration