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

Example Analysis of Spring boot Integrated nacos configuration Center

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly shows you the "Spring boot integrated nacos configuration center example analysis", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and study the "Spring boot integrated nacos configuration center example analysis" this article.

Pom.xml org.springframework.boot spring-boot-starter-parent 2.3.1.RELEASE com.alibaba.boot nacos-discovery-spring-boot-starter 0.2.7 nacos easy-nacos_dev.yaml configuration nacos: discovery: server-addr: localhost:8848spring: application: namex: easy-nacos2NacosServiceDiscoveryApplication.java@SpringBootApplication@EnableNacosDiscovery@EnableNacosConfig (globalProperties = @ NacosProperties (serverAddr= "127.0.0.1 localhost:8848spring 8848")) / / @ NacosPropertySource (dataId = "easy-nacos_dev") GroupId = "easy", autoRefreshed = true) / / data ID Automatically refresh public class NacosServiceDiscoveryApplication {public static void main (String [] args) {System.out.println ("Hello World!") SpringApplication.run (NacosServiceDiscoveryApplication.class, args) } ConfigController.java@Controller@RequestMapping ("config") @ NacosPropertySource (dataId = "easy-nacos_dev", groupId = "easy", autoRefreshed = true) / / data ID, automatically refresh public class ConfigController {/ / if you write spring.application.namex, you can't read / / autoRefreshed Refresh @ NacosValue (value = "${namex:def}", autoRefreshed = true) private String name Public String getName () {return name;} public void setName (String name) {this.name = name;}.... The above is all the contents of the article "sample Analysis of Spring boot Integrated nacos configuration Center". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, 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

Internet Technology

Wechat

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

12
Report