My config server is running on localhost:8888 but when i try to fetch configs from my config server ,its shows this error
Config data location 'configserver:http://localhost:8888/' does not exist
Action:
Check that the value 'configserver:http://localhost:8888/' at class path resource
[application.properties] - 2:22 is correct, or prefix it with 'optional:'
my other microservice has this application.properties
spring.application.name=limits-service
spring.config.import=configserver:http://localhost:8888/
spring.profiles.active=dev
This worked for me after removing text configserver from
spring.config.import properties
Before
spring.config.import=configserver:http://localhost:8888/
After
spring.config.import=http://localhost:8888/
Related
In my project, Spring Boot by default writes logs into logs.log. I need to set the logs location. I've added into my configuration yaml this config:
logging:
file: logs-directory/logs-file.log
After that, Spring Boot logs into default file "logs.log" and the same content into defined "logs-directory/logs-file.log" file. How to switch off default location?
Spring Boot upgrade to 2.5.2 resolved my problem.
Current log configuration in the application.yaml:
logging:
level:
root: info
org.springframework.web: error
org.hibernate: error
file:
name: logs/example-app.log
I have an internal application.yml that specifies common properties and the profile:
spring.profiles.active: dev
spring.config.location: 'C:\externalConf\'
spring.application.name: myAppName
myproperty: aprop
Then I put my application-dev.yml in C:\externalConf\ but it seems it is not read.
Where is the problem?
You should pass config folder location like this:
spring.config.location=file:///C:externalConf/
I am using spring boot config. My configurations are located in one folder in git.
The folder structure is as follows
application.yml
registry.yml
I have the following property defined in application.yml
registry:
server:
port:${REGISTRY_PORT:8761}
host:${REGISTRY_HOST:localhost}
and than i have the following property defined in registry.yml
server:
port: ${registry.server.port}
I get the following exception during spring boot start up. I feel registy.yml file is loaded first. Any way i can make application.yml file loaded first.
java.lang.IllegalArgumentException: Could not resolve placeholder 'registry.server.port' in value "${registry.server.port}"
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:172) ~[spring-core-5.1.0.RELEASE.jar:5.1.0.RELEASE]
at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[spring-core-5.1.0.RELEASE.jar:5.1.0.RELEASE]
at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:237) ~[spring-core-5.1.0.RELEASE.jar:5.1.0.RELEASE]
at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:211) ~[spring-core-5.1.0.RELEASE.jar:5.1.0.RELEASE]
I have use springboot to creat a project.
when I make yml file at src/main/resources/config or src/main/resources , I cant set :
spring:
profiles:
include:
- 'scheduling'
- 'yml'
in application.yml to appoint file file path,
and use #Value("${importance_info.message.notice}") to get the appointed value from
src/main/resources/config/application-scheduling.yml
but if I create yml not in the src/main/resources/config or src/main/resources, I can't get appointted value from it.
when I use #PropertySource(value = {"classpath:config/sub/sub-scheduling.yml"}), still can't get appointted.
Please tell me , how to make config or code to get appointed value from yml file in that file.
My config file on remote git repo:
myapp-uat.properties:
portal.db.userName=allen
portal.db.password=allen1235
I could load this file on client side, and I want save these properties by call /env, but get portal.db.password=***.
I wonder if I could get real value (portal.db.password=allen1235) by adding some properties in client config file or some other methods. Hope for your help.
The below is the default sanitized keywords for /env endpoint.
endpoints:
env:
keys-to-sanitize: password,secret,key,token,.*credentials.*,vcap_services
You can override the below property without password by defining below in your application.yml/properties.
endpoints:
env:
keys-to-sanitize: secret,key,token,.*credentials.*,vcap_services