In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Xiaobian to share with you the SpringBoot dynamic configuration Profile environment what are the ways, I believe most people do not know how, so share this article for everyone's reference, I hope you read this article after a great harvest, let's go to understand it!
The following example is an example of dynamically configured port numbers by modifying development and production environments:
Development environment port number is 8081
Production environment port number is 8082
Springboot configuration
Springboot has two configurations: properties and yaml or yml.
properties configuration
1. Configure the environment in application.properties.
Create two application-xx.properties
An application-dev.properties #development environment
An application-pro.properties #production environment
Modify in application.properties.
spring.profiles.active=pro #Switch to production
spring.profiles.active=dev #Switch to development environment
directory structure
2. Modify the environment configuration file by running the jar package
java -jar package file path--spring.profile.active=dev #Switch development environment
java -jar package file path--spring.profile.active =pro #Switch production environment
yaml mode configuration
yaml configuration is simpler than properties: a yaml file can replace the above three properties files; divide the environment by '---' three bars
#---These three bars are equivalent to creating multiple properties files---server: port: 8081spring: profiles: dev #specified environment name--server: port: 8082 spring: profiles: pro #specified environment name--- spring: profiles: active: pro #Configure Environment---
The above is "SpringBoot dynamic configuration Profile environment what are the ways" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.