Awesome Explanation .... In my company we are using the same technology. These videos helping me lot to understand the microservices cloud concept....!! Thanks
if you getting whitelabel error after configuring to git then I know that I'm posting this answer very very late. But, still posting it so that other folks can find this helpful. Now a days, default branch name of GitHub is "main", but Spring Cloud Config still looks for "master" as a label name. So, if you want to change the default behavior, you can always change the label name look up using below property in application.yml or application.properties: spring.cloud.config.server.git.default-label=main This worked very well for me. I'm using Spring Boot 2.3.6.RELEASE
Really thank. I thought it was too difficult but u make it clear. I have doubts about if I have multiple rest control then all the urls should added in the git repository?
Somehow refresh scope not refreshing properly.. whenever I chnages the provider url.. and chnaged same in properties file and when I add/chnaged something for the shake of devtools refreshing then only it is working .
Thank you for all the videos. You have made multiple videos around spring cloud, how to connect all these videos and do a project so that we are confident as a production ready developer. Kindly help if there is a overall video or course.
Sir i am facing problem with @refreshscope while setting the datasource. When i am adding @refreshscope in both class and method then after changing the profile from git repo it is changing the one database like if currently i am in devservice database then it is changing to prodservice but again when i am hitting the refresh endpoint it is not changing to devservice. I have also tried the spring bus but nothing is working. I think the problem is i am adding @Refreshscope at wrong place. But if i am removing the @Rscope annotation from method then i am getting an exception that my project is not connected with any database so for that i have moved datasource to the main method and autowired the class in which i am reading the properties using @Value both this is also not working but when i am adding @Rscope on datasource bean then it is changing the db connection for one environment as i said earlier. Please respond sir
Followed same code as yours..getting exception while starting insurance-client app...error is .. lang.illegalArguementException: could not resolve placeholder 'insurance.provider.url' in value "${insurance.provider.url}" .... Can you please help.
Hi sir, Thanks for the video. I have some doubts like, 1. Can we fetch property file from any other branch rather than master branch. 2. If we save a file in git and name it as "application.properties" or "our config service project name.properties" , it is fetching data from both for default profile. How to differentiate between them?
when i run insurance-client i got this error please solve if is possible?? No spring.config.import property has been defined Action: Add a spring.config.import=configserver: property to your configuration. If configuration is not required add spring.config.import=optional:configserver: instead. To disable this check, set spring.cloud.config.enabled=false or spring.cloud.config.import-check.enabled=false.
@Basant - I am getting below error. Please suggest how to resolve - Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'insurance.provider.url' in value "${insurance.provider.url}" at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
Hi getting exception when I am hitting the url like java.lang.IllegalArgumentException: Not enough variable values available to expand 'insurence.provider.url' please hlep me ASAP
upload more video in micro service with the interview prospective and explaining the code before Theory concept and suppose we not manage the approach these way then what we have alternate solution also discuss bcz when i learn the micro then lot of third party are there so please tell his name like eureka manage the load balancing but again ribbon also there managing the load balancing so confusion will came
Awesome example. Ek doubt tha. In client you just declare String url with @Value(${insurance.provide.url}), ab this is read from config server. But how does it know that for "/getPlan" URI i have to hit this URL that i get from config server. What happens when you write a new URI in client same Controller class. Say "/secondApi", what happens in that case ?
No if you observe in yml file we are giving the link of git that's how it search application.yml and properties and map that value to property place holder
Nice explaination. I have one question. Could you please help to elaborate the differences between Netflix Eureka and Spring Cloud Config? This would help us understand the which should be used when?
Vivek very simple Both are having different purposes Spring cloud eureka is used to register your microservice where spring cloud config used to centralize common configuration accross all the microservice
Eureka is service discovery and Spring Cloud Config globally managing the configuration for multiple micro service with externalization, consistency and real time.
@@Javatechie Ok so can you put eureka configuration code in config server instead of inside the microservice instance? Suppose there is like 11 instances for a microservice and we changed the gateway server ip address, then we would have to make changes in each of those instances. So can Euraka pick up the gateway server's ip address from the configuration server via github repository?
Even if we add @refreshScope annotation ,we need to hit post with /actuator/refresh then only will take the changes from,is it's right na sir, please reply this
Guys if anyone working in 2.4 version please add below setup in the config client application application.properties file. spring.config.Import=optional:configserver:localhost:9898(give your config server port) Management.endpoints.web.exposure.include=*
Please, explain how to use a Private GitHub Repository. No client wants a Public Repository with Configurations. Even if they are encrypted. Please, help us with the Certificates recommended solution.
Once you commit in GIT, Your Config-Server will start providing the updated properties... @RefreshScope will make the variables as refreshable but unless you CALL THE ACTUATOR/REFRESH end-point they won't update in run-time. If you want that to happen try implementing ApplicationListeners in your @Configuration files.
@@Javatechie HI, I am also getting the same exception while using the placeholder....below is the stackTrace Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2021-01-16 20:26:49.480 ERROR 14880 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'insuranceClientApplication': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'insurance.provider.url' in value "${insurance.provider.url}" at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405) ~[spring-beans-5.3.3.jar:5.3.3] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1415) ~[spring-beans-5.3.3.jar:5.3.3] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:608) ~[spring-beans-5.3.3.jar:5.3.3] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) ~[spring-beans-5.3.3.jar:5.3.3] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.3.jar:5.3.3] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.3.jar:5.3.3] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.3.jar:5.3.3] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.3.jar:5.3.3] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.3.jar:5.3.3] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:923) ~[spring-context-5.3.3.jar:5.3.3] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:588) ~[spring-context-5.3.3.jar:5.3.3] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.2.jar:2.4.2] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.2.jar:2.4.2] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.2.jar:2.4.2] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.2.jar:2.4.2] at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.2.jar:2.4.2] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311) ~[spring-boot-2.4.2.jar:2.4.2] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300) ~[spring-boot-2.4.2.jar:2.4.2] at com.dheeresh.insuranceclient.InsuranceClientApplication.main(InsuranceClientApplication.java:25) ~[classes/:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.4.2.jar:2.4.2] Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'insurance.provider.url' in value "${insurance.provider.url}" at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178) ~[spring-core-5.3.3.jar:5.3.3] at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[spring-core-5.3.3.jar:5.3.3] at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:239) ~[spring-core-5.3.3.jar:5.3.3] at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) ~[spring-core-5.3.3.jar:5.3.3] at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-5.3.3.jar:5.3.3] at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:936) ~[spring-beans-5.3.3.jar:5.3.3] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1321) ~[spring-beans-5.3.3.jar:5.3.3] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.3.jar:5.3.3] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.3.3.jar:5.3.3] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.3.jar:5.3.3] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.3.jar:5.3.3] ... 23 common frames omitted
How without giving the username and password of Github account, the springboot application is able to communicate to application.properties which is inside Github?
@@Javatechie we can run in kubernetes right as they run in a container.In that case how can we manage because if we hit refresh it reach only one pod as service object of kubernetes load balances the request.
@Value("${insurance.provider.url}") private String url; I have got a confusion. How could we get the value in client Project which is available at config Server Project.
@@Javatechie insurance-client project getting the url using (@Value("${insurance.provider.url}") private String url; ) . How it got the url value. How this value made available to insurance client. This value would be available to insurance-config-server project only since git was configured in that project.
@@Javatechie I am only running this service.in the sts its showing application started. But when I check the actuator/default it is showing 404 and health is down. in application.properties i have include all the endpoints(*)
Please checkout my microservice playlist config server example , I used latest spring boot version Please follow the same , I believe it's issue with spring version
If we are using spring cloud config then spring will read properties from git right? 1. Here my question is whether we will get same git repository Properties file data in Enviroment variable or we will get our project application.properties data in Enviroment variable.? Or both? 2 .In your application you have used @value annotation, if we will use Enviroment it will work or not?
Hi sir I have worked on this feature I am not getting updated value from properties until unless I refresh actuator but you are not doing any actuator refresh some stackoverflow answers also suggest to do actuator refresh Please have a look once and please let me know the reason.github.com/PradeepKumarHE/spring-cloufd-config-profjects
Due to your micro services video and all material like Kafka, Stream cloud and all , I got the job in MNC... THanks A lot Man. God Bless you
Glad to hear this Ravi . Congratulations 🎈 and rock on
@@Javatechie Thanks Sir
Awesome Explanation .... In my company we are using the same technology. These videos helping me lot to understand the microservices cloud concept....!! Thanks
Hey, you have added all the info in your blog as well that's damn nice of you!!!!!
Great explanation it's easy to understand things, thanks for your efforts
if you getting whitelabel error after configuring to git then I know that I'm posting this answer very very late. But, still posting it so that other folks can find this helpful. Now a days, default branch name of GitHub is "main", but Spring Cloud Config still looks for "master" as a label name. So, if you want to change the default behavior, you can always change the label name look up using below property in application.yml or application.properties:
spring.cloud.config.server.git.default-label=main
This worked very well for me. I'm using Spring Boot 2.3.6.RELEASE
Excellent video. Thanks for sharing knowledge.
Great explanation 🎉🎉🎉
such an awesome explanation, thanks a lot sir.
Really thank. I thought it was too difficult but u make it clear. I have doubts about if I have multiple rest control then all the urls should added in the git repository?
Somehow refresh scope not refreshing properly.. whenever I chnages the provider url.. and chnaged same in properties file and when I add/chnaged something for the shake of devtools refreshing then only it is working .
as usual awesome explanation thanks Basant
Thank you its very useful to me . please keep up ur work!
best explained in simple terms.
Great explanation sir 👍
Thank you for all the videos. You have made multiple videos around spring cloud, how to connect all these videos and do a project so that we are confident as a production ready developer. Kindly help if there is a overall video or course.
Sir i am facing problem with @refreshscope while setting the datasource. When i am adding @refreshscope in both class and method then after changing the profile from git repo it is changing the one database like if currently i am in devservice database then it is changing to prodservice but again when i am hitting the refresh endpoint it is not changing to devservice. I have also tried the spring bus but nothing is working. I think the problem is i am adding @Refreshscope at wrong place. But if i am removing the @Rscope annotation from method then i am getting an exception that my project is not connected with any database so for that i have moved datasource to the main method and autowired the class in which i am reading the properties using @Value both this is also not working but when i am adding @Rscope on datasource bean then it is changing the db connection for one environment as i said earlier. Please respond sir
Followed same code as yours..getting exception while starting insurance-client app...error is .. lang.illegalArguementException: could not resolve placeholder 'insurance.provider.url' in value "${insurance.provider.url}" .... Can you please help.
Specify branch as main in application.yml file .just google its key
Use main instead of master
Hi sir, Thanks for the video. I have some doubts like,
1. Can we fetch property file from any other branch rather than master branch.
2. If we save a file in git and name it as "application.properties" or "our config service project name.properties" , it is fetching data from both for default profile. How to differentiate between them?
1. Yes we can
2. Didn't get you properly
How to differentiate between multiple property files for different environments?
Please checkout my microservice playlist I explained there how can we keep file specific to environment
If possible please make more videos on microservices cloud using NOSQL database
Arshad sure I will try to do
Is cup service is alternative to config server to retrieve the properties?
when i run insurance-client i got this error please solve if is possible??
No spring.config.import property has been defined
Action:
Add a spring.config.import=configserver: property to your configuration.
If configuration is not required add spring.config.import=optional:configserver: instead.
To disable this check, set spring.cloud.config.enabled=false or
spring.cloud.config.import-check.enabled=false.
@Basant - I am getting below error. Please suggest how to resolve -
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'insurance.provider.url' in value "${insurance.provider.url}"
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
Did you provide your config server url in configuration file
@@Javatechie - Yes, i provided GIT uri like below -
spring.cloud.config.server.git.uri=github.com/ADARSH2690/insurance-config-server
No am talking about in client application did you point to config server
Spring,config.server.url=localhost:port number
@@AdarshSingh-go5ht did it solved?
Hi sir
I have one query could you please clarify me.
What is cup service and why using cup service and how it bind with react application.
Hi getting exception when I am hitting the url like java.lang.IllegalArgumentException: Not enough variable values available to expand 'insurence.provider.url' please hlep me ASAP
Please check the key , it is case sensitive
@@Javatechie i was also getting same error
upload more video in micro service with the interview prospective and explaining the code before Theory concept and suppose we not manage the approach these way then what we have alternate solution also discuss bcz when i learn the micro then lot of third party are there so please tell his name like eureka manage the load balancing but again ribbon also there managing the load balancing so confusion will came
Hi pratap ,Thanks for your suggestion going forward I will follow it ...
Awesome example.
Ek doubt tha.
In client you just declare String url with @Value(${insurance.provide.url}),
ab this is read from config server.
But how does it know that for "/getPlan" URI i have to hit this URL that i get from config server.
What happens when you write a new URI in client same Controller class. Say "/secondApi", what happens in that case ?
No if you observe in yml file we are giving the link of git that's how it search application.yml and properties and map that value to property place holder
@@Javatechie Thanks
Nice explaination. I have one question.
Could you please help to elaborate the differences between Netflix Eureka and Spring Cloud Config? This would help us understand the which should be used when?
Vivek very simple
Both are having different purposes
Spring cloud eureka is used to register your microservice where spring cloud config used to centralize common configuration accross all the microservice
Eureka is service discovery and Spring Cloud Config globally managing the configuration for multiple micro service with externalization, consistency and real time.
@@Javatechie Ok so can you put eureka configuration code in config server instead of inside the microservice instance? Suppose there is like 11 instances for a microservice and we changed the gateway server ip address, then we would have to make changes in each of those instances. So can Euraka pick up the gateway server's ip address from the configuration server via github repository?
nice explanation,thanks a lot
Even if we add @refreshScope annotation ,we need to hit post with /actuator/refresh then only will take the changes from,is it's right na sir, please reply this
Yes exactly .you are correct
A small doubt why you have added @Lazy in Client service?
Guys if anyone working in 2.4 version please add below setup in the config client application application.properties file.
spring.config.Import=optional:configserver:localhost:9898(give your config server port)
Management.endpoints.web.exposure.include=*
Please, explain how to use a Private GitHub Repository. No client wants a Public Repository with Configurations. Even if they are encrypted. Please, help us with the Certificates recommended solution.
we must learn github to learn this microservices...??????pls reply
Yes basic required ! GitHub is dead easy buddy please checkout my GitHub playlist
RefreshScope is not working. Everytime i do a change in provider i need to restart client application.Otherwise its giving 404 not found
Could you please try cloud consul centralize configuration approach ,
Even I faced same issue many times
Same problem I am facing...
Am not sure , can you please check out my microservice tutorial where I implement cloud config server it is working as expected same I shown in video.
Once you commit in GIT, Your Config-Server will start providing the updated properties... @RefreshScope will make the variables as refreshable but unless you CALL THE ACTUATOR/REFRESH end-point they won't update in run-time. If you want that to happen try implementing ApplicationListeners in your @Configuration files.
It works everything but last part automatically picking as soon as commit to repo is not working sir I added refresh scope in my controller why sir
I have got an illegal argument exception for value placeholder wat to do?
Please share complete error stack
@@Javatechie HI, I am also getting the same exception while using the placeholder....below is the stackTrace
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-01-16 20:26:49.480 ERROR 14880 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'insuranceClientApplication': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'insurance.provider.url' in value "${insurance.provider.url}"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1415) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:608) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:923) ~[spring-context-5.3.3.jar:5.3.3]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:588) ~[spring-context-5.3.3.jar:5.3.3]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.2.jar:2.4.2]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.2.jar:2.4.2]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.2.jar:2.4.2]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.2.jar:2.4.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.2.jar:2.4.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311) ~[spring-boot-2.4.2.jar:2.4.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300) ~[spring-boot-2.4.2.jar:2.4.2]
at com.dheeresh.insuranceclient.InsuranceClientApplication.main(InsuranceClientApplication.java:25) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.4.2.jar:2.4.2]
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'insurance.provider.url' in value "${insurance.provider.url}"
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178) ~[spring-core-5.3.3.jar:5.3.3]
at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[spring-core-5.3.3.jar:5.3.3]
at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:239) ~[spring-core-5.3.3.jar:5.3.3]
at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) ~[spring-core-5.3.3.jar:5.3.3]
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:936) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1321) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.3.jar:5.3.3]
... 23 common frames omitted
In @Value annotation try to add default value and then check whether it is fetching value or not
@@Javatechie Yes, it is fetching the default value, but in that case, i would not be able to test the @refreshscope....M i correct sir?
Yes you can't with default value
Must the file name in the git repository be application.properties?
are other names acceptable?
Yes you can take it any name .but it's recommend to use application.properties
Thank you for your quick response
I got useful knowledge..
Sir,
I wants to clone remote repository into local using spring cloud config server. Please let me know the solution
How without giving the username and password of Github account, the springboot application is able to communicate to application.properties which is inside Github?
because he made github access public, if u make it private than u have to add username and pwd in application.properties file
@@shubhamchoudhari8090 thanks buddy 👍👍
@@shubhamchoudhari8090not so simple
You are awesome,
We are having multiple instances of same client app with same port how can we implement this.
With same port we can't run multiple instances
@@Javatechie we can run in kubernetes right as they run in a container.In that case how can we manage because if we hit refresh it reach only one pod as service object of kubernetes load balances the request.
@Value("${insurance.provider.url}")
private String url; I have got a confusion. How could we get the value in client Project which is available at config Server Project.
Didn't get you client project means you are talking about any UI client?
@@Javatechie insurance-client project getting the url using (@Value("${insurance.provider.url}")
private String url; ) . How it got the url value. How this value made available to insurance client. This value would be available to insurance-config-server project only since git was configured in that project.
My actuator/default always show 404. If I check with health it is showing down. please help with this sir
Can you please check is any service is down ?
Also verify did you enable all endpoints in your application.properties or application.ymk
@@Javatechie I am only running this service.in the sts its showing application started. But when I check the actuator/default it is showing 404 and health is down.
in application.properties i have include all the endpoints(*)
Please checkout my microservice playlist config server example , I used latest spring boot version
Please follow the same , I believe it's issue with spring version
@@jayashrim4329 facing the same issue
@@sunilroshan8375 please check your branch in github. and try add your branch name in application.yml , It work for me. Please try it also
Sir when i change the url it need client app restart otherwise it is not woking
Did you annotated @RefreshScope
@@Javatechie yes sir @ResfeshScope over the class and also @Lazy on top of RestTemplate
Could you please confirm whether Enviroment variable will work at Config server application.properties or not?
Didn't get your question could you please repeat it with clarity
If we are using spring cloud config then spring will read properties from git right?
1. Here my question is whether we will get same git repository Properties file data in Enviroment variable or we will get our project application.properties data in Enviroment variable.? Or both?
2 .In your application you have used @value annotation, if we will use Enviroment it will work or not?
It should be in your application.properties
Why you need Environment.getProperties() spring is smart enough to load it from your application.yml file or properties file .
Please tag your issue 🙏
Can we do the same for gitlab
am using spring 3.x,it is not working
propertySources is coming empty for me. please help
Can you add log Statement and check
@@Javatechie Hi
I fixed it. Cloud version and Springboot Version weren't compatible
Can we do it in one application?
do vides more microservices
Awesome video
Awesome
not hit insurance provider to insurance service
nice
Nice bro
Simple great.
Hi sir I have worked on this feature I am not getting updated value from properties until unless I refresh actuator but you are not doing any actuator refresh some stackoverflow answers also suggest to do actuator refresh Please have a look once and please let me know the reason.github.com/PradeepKumarHE/spring-cloufd-config-profjects
No it won't auto refresh in latest version for that you need to use cloud bus