1

I've created multi-module project:

  • (pom) root
    • (jar) libModule
    • (jar) 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

E.Monogarov
  • 460
  • 8
  • 17

1 Answers1

1

Ok. Answer to my question is - i have to generate json for libModule separately. works as it should work this way

E.Monogarov
  • 460
  • 8
  • 17