I've created multi-module project:
root
libModule
appModule
, has libModule
in dependencies appModule
pom has dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
also it contains own @ConfigurationProperties
class:
@ConfigurationProperties(prefix = "service.test")
@Component
@Data
public class Conf {
String prop;
}
compiling this module produces next correct spring-configuration-metadata.json
file:
{
"groups": [
{
"name": "service.test",
"type": "org.test.app.Conf",
"sourceType": "org.test.app.Conf"
}
],
"properties": [
{
"name": "service.test.prop",
"type": "java.lang.String",
"sourceType": "org.test.app.Conf"
}
],
"hints": []
}
and my Idea IDE successfully highlight me this properties in application.yml
but also i have additional @ConfigurationProperties
class in my libModule
:
@ConfigurationProperties(prefix = "service.a")
@Setter
@Getter
public class ServiceAProperties {
String url;
}
i tried to include this class into appModule
with next code:
@SpringBootApplication
@ConfigurationPropertiesScan(basePackageClasses = {
ServiceAProperties.class
})
public class Application {
public static void main(String[] args) {
SpringApplication.run(ConfigServerApplication.class, args);
}
}
and tried different ways to include it to json but it doesn't appear there. only own module Conf
class is used
how can i include configuration properties from other module to generate proper json including both modules' properties
if some additional info is needed please ask
Ok. Answer to my question is - i have to generate json for libModule separately. works as it should work this way
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.