当前位置:网站首页>Client error: invalid param endpoint is blank
Client error: invalid param endpoint is blank
2022-07-25 14:55:00 【zulj131】
Question presentation :

scene :
In the current project , Want to pass nacos As configuration center , Get nacos Configuration stored in , So I added the following dependencies
<dependencies>
<!-- Here is groupId = com.alibaba.cloud Of nacos rely on -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- Here is groupId = com.alibaba.boot Of nacos rely on -->
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>nacos-config-spring-boot-starter</artifactId>
<version>0.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>2.2.7.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
First , I don't care why alibaba Developers need to put nacos Divide into groupId = com.alibaba.cloud and groupId = com.alibaba.boot Two kinds of dependence .
Although I used it first groupId = com.alibaba.cloud Dependence , And already application.yml Configuration of the nacos Service address of .
server:
servlet:
context-path: /mdc-mvc-demo
port: 8081
spring:
application:
name: mdc-mvc-demo
cloud:
nacos:
config:
enable: true # Use whether to configure automatic update
server-addr: 127.0.0.1:8848
group: DEFAULT_GROUP # Group , The default is DEFAULT_GROUP
file-extension: yaml # Configure the data format of the content , The default is properties
But I refer to the example of online tutorial , The use of @NacosPropertySource Annotations need to be used groupId = com.alibaba.boot Dependence .
It's changed pom.xml after , I started happily , As a result, the startup failed , Threw the error shown above .
The analysis reason :
First , What is certain is that , Is due to @NacosPropertySource The problems caused .
At first, there was really no clue , So I began to find the reason from the log printed above , I noticed a log :
22:12:29.077 [main] WARN NacosPropertySourceBuilder -Ignore the empty nacos configuration and get it based on dataId[mdc-mvc-demo] & group[DEFAULT_GROUP]
Why do you remind me nacos The configuration of is empty ? And mine dataId Is set to mdc-mvc-demo.yaml, It locks the print dataId[mdc-mvc-demo] Based on spring.application.name Set the default value of .
@Data
@Component
@NacosPropertySource(dataId = "mdc-mvc-demo.yaml", autoRefreshed = true)
public class NacosAnotherProperties {
@NacosValue(value = "${project.name}", autoRefreshed = true)
private String name;
@NacosValue(value = "${project.org}", autoRefreshed = true)
private String org;
}
therefore , I guess , Is due to groupId = com.alibaba.cloud and groupId = com.alibaba.boot The two dependencies do not use the same set of configurations ,groupId = com.alibaba.boot This set of dependent configurations is com.alibaba.boot.nacos.config.properties.NacosConfigProperties
therefore , I tried to add configuration :
server:
servlet:
context-path: /mdc-mvc-demo
port: 8081
spring:
application:
name: mdc-mvc-demo
# cloud:
# nacos:
# config:
# enable: true # Use whether to configure automatic update
# server-addr: 127.0.0.1:8848
# group: DEFAULT_GROUP # Group , The default is DEFAULT_GROUP
# file-extension: yaml # Configure the data format of the content , The default is properties
# prefix: Not configured. The default is spring.application.name
nacos:
config:
server-addr: 127.0.0.1:8848
Then try ,@NacosPropertySource Can't parse yaml Type of configuration , This is changed into properties
@Data
@Component
@NacosPropertySource(dataId = "mdc-mvc-demo", autoRefreshed = true)
public class NacosAnotherProperties {
@NacosValue(value = "${project.name}", autoRefreshed = true)
private String name;
@NacosValue(value = "${project.org}", autoRefreshed = true)
private String org;
}
After restart , There is no further prompt endpoint is blank 's report is wrong , And you can also read nacos Configuration of
solve the problem
therefore , The solution to the problem is :
If you use groupId = com.alibaba.boot This dependent function , You should use nacos.config To configure nacos
边栏推荐
- 河源市区推出消防安全主题奶茶 助推夏季火灾防控
- 41 picture background synthesis - colorful navigation map
- awk从入门到入土(24)提取指令网卡的ip
- 基于浏览器的分屏阅读
- The solution to the problem that the progress bar of ros2 installation connext RMW is stuck at 13%
- 转载----如何阅读代码?
- Jqgrid select all cancel single line click cancel event
- Browser based split screen reading
- Gameframework making games (I)
- "Ask every day" briefly talk about JMM / talk about your understanding of JMM
猜你喜欢

阿里云技术专家邓青琳:云上跨可用区容灾和异地多活最佳实践

27 选择器的分类

D2. picking carrots (hard version) (one question per day)

Development of uni app offline ID card identification plug-in based on paddleocr

06. Neural network like

冈萨雷斯 数字图像处理 第一章绪论

Filters get the data in data; Filters use data in data

I2C device driver hierarchy

基于浏览器的分屏阅读

43 盒子模型
随机推荐
39 simple version of millet sidebar exercise
43 box model
[nuxt 3] (XI) transmission & module
Browser based split screen reading
BIO、NIO、AIO示例
"How to use" decorator mode
没错,请求DNS服务器还可以使用UDP协议
GameFramework制作游戏(一)
Idea error failed to determine a suitable driver class
Thymeleaf controls whether display is displayed through style
Gameframework making games (II) making UI interface
"Ask every day" what is volatile
43 盒子模型
45padding不会撑开盒子的情况
006 operator introduction
物理量与单位符号的书写标准
41 picture background synthesis - colorful navigation map
Gonzalez Digital Image Processing Chapter 1 Introduction
MySQL 45 talks about | 06 global locks and table locks: Why are there so many obstacles to adding a field to a table?
Paddlenlp's UIE relationship extraction model [executive relationship extraction as an example]