在SpringCloud工程中,可以使用@RefreshScope+@Value实现配置文件内容变更后的动态刷新。 在SpringBoot工程中,可以使用@NacosValue来实现配置文件内容变更后的动态刷新。 引入依赖: <dependency> <groupId>com.alibaba.boot</groupId> <artifactId>nacos-config-spring-boot-starter</artifactId> <version>0.2.12</version> </dependency> 配置文件增加配置: nacos: config: server-addr: 127.0.0.1:8848 bootstrap: enable: true log: enable: true data-id: order-service type: yaml auto-refresh: true @NacosValue的例子: package com.morris.order.controller; import...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile