-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion: Set a default value for NacosConfigProperties#serverAddr e.g. 127.0.0.1:8848 #3314
Comments
Good idea! I think we should set default value in |
Yes, it can be solved like this. But i'm curious if there will be any problems if setting the default value directly. |
@i will solve it@ |
According to the official documentation, we should add default address support: https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#config-data-import |
According to the official documentation, we should add default address support: https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#config-data-import
|
….import enabled.
Fix #3314, set default nacos server address when spring.config.import enabled.
….import enabled.
…g.import` enabled. (alibaba#3508) * fix alibaba#3314, set default nacos server address when config.import enabled.
… enabled. (#3645) Co-authored-by: Ken Liu <[email protected]>
Spring Cloud Alibaba Version
2021.0.1.0
Which Component
Nacos Config
Describe what problem you have encountered
When using the following configuration,application failed to start due to an exception:
com.alibaba.nacos.api.exception.NacosException: endpoint is blank
.Through debugging, I found that
NacosConfigDataLocationResolver
has loaded properties intoNacosConfigProperties
before Spring instantiated the bean. Therefore, if
spring.cloud.nacos
is not configured, the property namedserverAddr
inNacosConfigProperties
will be null.So why not set a default value e.g.127.0.0.1:8848 for
serverAddr
as the methodoverrideFromEnv
ofNacosConfigProperties
did. Is there any other consideration? I'll glad to make a pr for this if possible.Here is the yaml configuration:
Here is the pom :
Here is the exception stack trace:
Describe what information you have read
I have read the reference doc of Nacos
The text was updated successfully, but these errors were encountered: