-
-
Notifications
You must be signed in to change notification settings - Fork 589
Duplicate GroupConfigs in SpringDocConfigProperties #2518
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
For my usecase I want to access the springdoc specific application.properties at Runtime. I thought it is a smart idea to reuse springdoc's exsiting SpringDocConfigProperties class which can be autowired. Using this class I have type safety and avoid re-reading all the springdoc properties from appliation.properties again.
However, SpringDocConfigProperties.getGroupConfigs() returns twice the size of the actual configured amount of groups (e.g. in my example I configured 4 groups, but 8 are returned). Each group gets duplicated.
To Reproduce
Steps to reproduce the behavior:
- Spring boot 3.2.3
- springdoc-openapi-starter-webmvc-ui:2.3.0
application.properties:springdoc.group-configs[0].group=Group0 springdoc.group-configs[0].packages-to-scan=com.my-package springdoc.group-configs[1].group=Group1 springdoc.group-configs[1].packages-to-scan=com.my-package springdoc.group-configs[2].group=Group2 springdoc.group-configs[2].packages-to-scan=com.my-package springdoc.group-configs[3].group=Group3 springdoc.group-configs[3].packages-to-scan=com.my-package
Application.java:@EnableScheduling @SpringBootApplication public class Application { @Autowired private SpringDocConfigProperties springDocConfigProperties; public static void main(String[] args) { SpringApplication.run(Application.class, args); } @PostConstruct @Scheduled(fixedRate = 1000) public void printSize() { System.out.println(springDocConfigProperties.getGroupConfigs().stream().map(GroupConfig::getGroup).toList()); } }
Expected behavior
- Should print
[Group0, Group1, Group2, Group3]every 1000ms - Actually it prints the expected text only once. Afterwards it starts printing
[Group0, Group1, Group2, Group3, Group0, Group1, Group2, Group3] - Apparently, at some point after the start, all GroupConfigs get duplicated
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working