I have a requirement to store and consume configurations via PostgreSQL DB.I have entered following queries to the DB
CREATE TABLE xlabs.properties ( application varchar(200) DEFAULT NULL, profile varchar(200) DEFAULT NULL, label varchar(200) DEFAULT NULL, prop_key varchar(500) DEFAULT NULL, value varchar(500) DEFAULT NULL, id SERIAL PRIMARY KEY);INSERT INTO xlabs.properties (application, profile, label, prop_key, value) VALUES ('config-server','development','latest','ssn','([0-9]{9})');
So, After running config server and hit on http://localhost:8090/config-server/development/latest
will return this response.
{"name":"config-server","profiles":["development"],"label":"latest","version":null,"state":null,"propertySources":[{"name":"config-server-development","source":{"ssn":"([0-9]{9})"}}]}
But the problem is when I try to consume above ssn property through cloud config client with following configurations, in bootstrap.properties
spring.cloud.config.uri=http://localhost:8090spring.profiles.active=developmentmanagement.endpoints.web.exposure.include=*spring.application.name=config-serverspring.cloud.config.label=latest
and
@RestController@RefreshScopepublic class ConfigController { @Value("${ssn}") private String name; @GetMapping("/message") public String returnConfig(){ return this.name; }}
So, When I run the project it gives run time error
Could not resolve placeholder 'ssn' in value "${ssn}"
Please help on this.