In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about how to realize IDE automatic prompt through custom configuration in Spring Boot. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
I. background
The official spring boot starter configuration items are usually prompted automatically when we configure them with IDE, as shown in the following figure.
However, we do not have our own custom configuration, and it is very unfriendly to developers and easy to type the wrong configuration, so how is this achieved?
Second, prompt principle
IDE is prompted automatically by reading the metadata of the configuration information, while the metadata is in the spring-configuration-metadata.json or additional-spring-configuration-metadata.json in the directory META-INF
Third, realize automatic prompt
Take the custom configuration file in starter developed by myself as an example. If you create these metadata manually, you will have a lot of work, and if you use IDEA, you can generate them automatically.
3.1. Introduce dependency spring-boot-configuration-processor
Add the following jar package to the zlt-swagger2-spring-boot-starter project
Org.springframework.boot spring-boot-configuration-processor true3.2. Modify IDEA configuration
Search for Annotation Processor and set Enable annotation processing
3.3. Recompile the project
The spring-configuration-metadata.json file is automatically generated when the project is recompiled
IV. Testing
Custom swagger configuration can be prompted automatically.
After reading the above, do you have any further understanding of how to realize IDE automatic prompt through custom configuration in Spring Boot? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.