Home > Back-end >  Nacos reading configuration information as a service consumer
Nacos reading configuration information as a service consumer

Time:11-21

This is my pom
 
<? The XML version="1.0" encoding="utf-8"?>
XMLNS: xsi="http://www.w3.org/2001/XMLSchema-instance"
Xsi: schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" & gt;

Spring - the cloud - nacos
Org. Example
1.0 - SNAPSHOT

4.0.0 & lt;/modelVersion>

The load - balancing


2.1.1. RELEASE




Org. Springframework. Cloud
Spring - the cloud - starter - openfeign



Org. Example
Nacos - common
1.0 - SNAPSHOT



Com. Alibaba. Cloud
Spring - the cloud - starter - alibaba - nacos - discovery



Com. Alibaba. Cloud
Spring - the cloud - starter - alibaba - nacos - config






Org. Springframework. Boot
Spring - the boot - maven - plugin




The SRC/main/resources
True

Application. Yml
The bootstrap. Yml
Application - ${spring. Profiles. The active}. Yml
The bootstrap - ${spring. Profiles. The active}. Yml







Dev

True


Dev



Prod

False


Prod



Uat

False


Uat





The bootstrap. Yml
 
Spring:
Cloud:
Nacos:
Config:
Server - addr: 123.123.123.123:111
File - the extension: yaml
Discovery:
Server - addr: 123.123.123.123:111

To register to the service, the service list can see the service
Want to use @ value reading configuration information, error can't find the key - Could not resolve placeholder 'test' in the value "${test}
"I am sure that the key is correct
  • Related