Open nickwongwong opened 3 years ago
在spring cloud 下边 需要注意配置文件的加载顺序
bootstrap.properties > application.properties > application-dev(prod).properties
你可以把application.properties改名为bootstrap.properties再尝试一下
我的配置放在 bootstrap.properties 里会报类似的异常
我的环境是: spring-boot-starter-parent:2.4.2 spring-cloud-dependencies:2020.0.0 spring-cloud-alibaba-dependencies:2021.1
我的配置放在 bootstrap.properties 里会报类似的异常
我的环境是: spring-boot-starter-parent:2.4.2 spring-cloud-dependencies:2020.0.0 spring-cloud-alibaba-dependencies:2021.1
@mj19910923 你当前环境的版本,延用老版本加载方式(bootstrap.properties
) 需要增加以下依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
我的配置放在 bootstrap.properties 里会报类似的异常 我的环境是: spring-boot-starter-parent:2.4.2 spring-cloud-dependencies:2020.0.0 spring-cloud-alibaba-dependencies:2021.1
@mj19910923 你当前环境的版本,延用老版本加载方式(
bootstrap.properties
) 需要增加以下依赖<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-bootstrap</artifactId> </dependency>
加上此依赖问题还是存在,复现demo链接
我的配置放在 bootstrap.properties 里会报类似的异常 我的环境是: spring-boot-starter-parent:2.4.2 spring-cloud-dependencies:2020.0.0 spring-cloud-alibaba-dependencies:2021.1
@mj19910923 你当前环境的版本,延用老版本加载方式(
bootstrap.properties
) 需要增加以下依赖<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-bootstrap</artifactId> </dependency>
加上此依赖问题还是存在,复现demo链接
问题已解决,感谢大佬🙇🏼🙇🏼🙇🏼
我的配置放在 bootstrap.properties 里会报类似的异常 我的环境是: spring-boot-starter-parent:2.4.2 spring-cloud-dependencies:2020.0.0 spring-cloud-alibaba-dependencies:2021.1
@mj19910923 你当前环境的版本,延用老版本加载方式(
bootstrap.properties
) 需要增加以下依赖<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-bootstrap</artifactId> </dependency>
感谢,一阵见血
我们鼓励使用英文,如果不能直接使用,可以使用翻译软件,您仍旧可以保留中文原文。 We recommend using English. If you are non-native English speaker, you can use the translation software.
Which Component Nacos Discovery 1.4.1 dubbo Spring Cloud Alibaba 2.2.2 & 2.2.4 & 2.2.5
Describe the bug I follow the official demo, only different with more maven modules. Nacos cannot find
serviceName
and start failing, with settingspring.application.name
. After settingspring.cloud.nacos.discovery.service
, it run well.debug info: In the
NacosDiscoveryProperties.java
code, theservice
field is incorrectly set(null). I guess the high probability of the bug is caused by the startup sequence of Nacos.ERROR:namingService subscribe failed
java.lang.IllegalArgumentException: Param 'serviceName' is illegal, serviceName is blank
To Reproduce project structure in maven pom.xml
application.properties
error detail:
Expected behavior Nacos will automatically configure
spring.cloud.nacos.discovery.service
fromspring.application.name
Screenshots
Additional context MacOS 、Java8