Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the pit of automatic translation of springboot configuration files

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article Xiaobian for you to introduce in detail "springboot configuration file automatic translation of the pit how to solve", the content is detailed, the steps are clear, the details are handled properly, I hope this "springboot configuration file automatic translation of the pit how to solve" article can help you solve doubts, the following follow the editor's ideas slowly in-depth, together to learn new knowledge.

Automatic escape of no fields that load yml configuration files

When the project is online, it is found that a field has been escaped, as shown in the following figure:

I should have compared the no field with the data, but it was found that the data after the comparison was all null,debug. I found that this field automatically became "false" after loading the yml file. I found this problem for the first time, and it was very convenient to modify it. Replacing the no in the yml file with 'no' can not be transformed into "false. I would like to remind you that a small error leads to a temporary adjustment. No, no, no. no, no, no.

Pit for automatic translation of springboot profile

Problems encountered when using the SpringBoot configuration file, setting batchEmail.task.switch to ON when using yaml as the configuration file

# batch scheduled email sending configuration batchEmail: task: size: 1000 switch: ON

Then the value is obtained by @ Value in the JAVA code

@ Value ("${batchEmail.task.switch}") private String batchEmailTaskSwitch

Will get the Boolean value of automatic translation.

After testing, if you want to get the string "ON", you have to modify the configuration file as follows

# batch scheduled email sending configuration batchEmail: task: size: 1000 switch: "ON"

After adding double quotation marks to ON, the value is normal.

After reading this, the article "how to solve the pit of automatic translation of springboot configuration files" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself to understand it. If you want to know more about related articles, welcome to follow the industry information channel.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report