One, background
Spring boot starter configuration items provided by the official, when we use the IDE configuration generally have automatically prompt, as shown in the following figure
and our own custom configuration did not, on the development of very unfriendly easily configured wrong, that this is how to achieve it?
Second, the principle of prompt
IDE is a configuration metadata information automatically by reading the tips, and the metadata in the directory META-INF
in spring-configuration-metadata.json
oradditional-spring-configuration-metadata.json
Third, to achieve automatic tips
In my own development starter in this custom configuration file, for example, if you manually create their own metadata, then the workload is relatively large, the use of IDEA
the words are automatically generated function
3.1. Introducing dependent spring-boot-configuration-processor
In the zlt-swagger2-spring-boot-starter
Add the following jar package project
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
3.2. Modify the configuration IDEA
Search Annotation Processor
and setEnable annotation processing
3.3. Rebuild the project
The project will be generated automatically recompile spring-configuration-metadata.json
files
Fourth, the test
swagger configure a custom has been automatically suggests
References
https://docs.spring.io/spring-boot/docs/current/reference/html/configuration-metadata.html
Recommended Reading