December 2020: After Spring Boot 2.4.0/Spring Cloud 2020.0.0-M5 you need to include the spring-cloud-starter-bootstrap dependency and create a bootstrap.yml with the spring application name, spring cloud config uri and the management endpoints web exposure include property there
Thanks a lot Kaushik. There are materials and tutorials everywhere but the depth and details of understanding the concepts that I get here are simply amazing.
I think restart microservice is better choice. If we use accuator and @RefreshScope, it have 2 drawbacks: (1) accuator open some hookup API which might lead to security concern. (2) @RefreshScope impact performance a lot. All instances that use the config bean need to refresh ALL of its dependencies, not just the config bean.
Hey kaushik.... Because of you so many things are easy to learn.... Many many thanks to you make a wonderful video and make a easy to work in It industry.. 🙏🙏🙏🙏🙏
Strange..... @9:54 I see "config.client.version". but the key "my.greeting" is not showing up. If I delete my spring-boot.config.yml and just use the default everything works. But If I have specific microservice config file.... things don't get udated. Anyone experiencing the same problem?
Hi Koushik, As you mentioned in the video could you please help us with the git tutorial which covers most of the use cases, especially reverting a merge request, solving merge conflict, and switching over branches without committing(branch specific or unmerged changes).
How would you refresh properties in a Microservice based environment? Like when there are X amount of servers running - and possible them being behind a LoadBalancer
Hi Koushik, Thanks for the informative video. I am watching microservices end to end. I have two questions. 1. In case of dynamic configure, We need to refresh actuator, It means if multiple instances are running with a different port, we have to refresh all of those? 2. In case of having YML files named as microservices, how to implement environments based configuration. It is like -environment?
@javabrains Hey Kaushik, if the config values are used at multiple places, say many service classes, As per the video, do we need to add @RefreshScope in all the places ? Request you to help us in that usecase
Is there a good way to automate sending the POST request after making changes to the config server? Perhaps through Jenkins or something of that nature.
@@stas4985 yes, but what if I have dozens of microservices than need to get the updated values? I don't wanna be sitting there and sending those POST requests to each and every of them.
When there all multiple microservices belong to same group and you call actuator/refresh POST call, it could only hit one of the instance and refresh. What about all other instances ?
Hi Koushik, Content is priceless. I have following two questions. 1. What should be the name of yml-file for the specific profile (not only for the specific microservice, but also profile)? 2. Do we have any workaround for refreshing 100's of micro-services in a go once the application.yml on git repo is updated? Thanks for sharing this amazing content with us.
Hi Kaushik, Nice video series. It was really helpful. I have couple of questions - 1. Is it a good practice to rely on Version control for config management as I have read almost everywhere that pushing credentials to git is a bad practice/security issue. I know i can make the repo private but is it still a good solution ? 2. Say we have DB properties defined in spring cloud config server. Admin updates the DB properties and at the same time a DB operation is running on the micro service side. How do we ensure that the change of DB properties does not affect the ongoing operation ? 3. Doesn't spring cloud config server create a bottleneck ? If the server is down, won't the other micro services be affected ?
Hi Dev Here are answers to your questions from my experience. I am not sure if it 100% correct, but hoping it helps. 1. No, it is not a good practice to store credentials on git repo even if it is private. You should use some vault to store passwords, e.g. Spring Cloud Vault, AWS Secret Manager 2. As per the Kaushik's video, you need to hit the actuator endpoint for the config properties to get refreshed in the microservice. Also, if you are running any DB operation on the microservice, you should business logic in a way that if your transaction doesn't get committed , it should rollback. 3. Yes it may do depending on the situation. Suppose server is running and you started 2 microservices, so these microservices will fetch and cache all the configs. Now the server goes down so those microservices won't be affected, but if now you are starting up a 3rd microservice, it won't be able to fetch config from server. So instead that 3rd microservice will fetch configs from its JAR, if it is present.
Hi , I have a doubt on that @RefershScope. As you say , in our application perspective we are having n number of controller and we are using so many value from the property files. At that if we update the changes in cloud config server, we need to add the @RefershScope in each and every controller. If that is the case then , it will not be nice as we are going to add in 100's of controller if we are having it. Is there any other alternative , like if we want to use it for a entire application, configure it in a place and let all the get uploaded?
question: in case i have multiple micro services instances for my service, then how do you call /refresh, because if we have 5 instances then though you call /refresh it calls only one instance. any idea whats the solution for this use case??
I am not able to get it to work. When I run the actuator refresh endpoint, it returns me with an empty array - [] in response. Using the latest version of Springboot - v3.2.3 with spring cloud version - 2023.0.0
Kaushik, your videos are awesome, much thanks. For my project, I noticed that dynamic updates only work for my microservice with respect to properties defined in the config server application.yml and not for propeties defined in the microservice specific yml file. I wonder if this is a known issue or perhaps there's something not configured correctly in my setup.
Hi Koushik, Very nicely explained . i like all your videos and that helps a lot to grab concept. Great work you are doing. I have one question . In microservice architecture when to use application.yml and when to use bootstrap.yml and which properties goes in which file ...
Hi Kaushik, I am searching for the following two things. Let me know if you can help with this. 1. Lazy initialization of spring security configuation. I'm using OAuth + OpenId. The issuer URI is loaded in DB at some time via CRUD by admin in the same spring boot app. Then only I need to initialize the spring security configure(). 2. Also I want to know how reload the spring security configuration at runtime when the Issuer URI changed at db.
hey I tried everything shown in the tutorial but my bean is not refreshed , besides when i do a post on /actuator/refresh i get in empty [] response wondering what could be the issue
Hello when I add the Config Client dependency in my microservice project it refuses to start returning the following error: 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. I need help
Hello Kaushik , thanks for nice tutorial. I have one question. how we can handle the scenario if our git repo goes down for some time. Looking forward to your answer Thank you
@@subbunittala2012 can you share any example using cloud bus + rabbitmq/kafka ? I have tried this, however I am using local git and when I invoke /monitor endpoint on config server from postman to mimiic a webhoook, I see `RefreshListener : Received remote refresh request. 2022-04-28 20:12:39.145 INFO 90782 --- [nio-8888-exec-9] o.s.cloud.bus.event.RefreshListener : Keys refreshed []` :(
Hi Koushik, Whenever I tries giving a call actuator/refresh it gives me HTTP Status 404 error. Even though all the endpoints are enable. What's the cause of this?
i am facing issue with database configuration if apply refresh scope. for me even both database URL and r2bc configs, message are changing in refresh scope , i am getting only updated message but my service still pointing to the old Database not the Updated one. how can we achieve that one dynamic db connection.
Is it normal when I edited the spring-boot-config.yml without committing, but the config server output is displaying my edited config. If it is, then what's the use of git repo?
actuator/refresh returns updated value from application.properties file but it is not refreshing the values from microservice specific file. I am using Spring Cloud version 2021.0.4 Please suggest.
I have found the solution: I just renamed the application.yml file to bootstrap.yml (inside the client spring boot project) and it started working. Actuator started fetching the updated value from the microservice specific file.
Hi, can we have ribbon load balancing servers list dynamically from git ? Let say we have 3 instances initially, based on the load we want to increase it to 5. Can we do this with this approach on the fly ? If we can, then which URL we need to hit to refresh as there are three instances are running. Please guide me on this.
I am getting the error "This application has no explicit mapping for /error, so you are seeing this as a fallback" after adding @RefreshScope to the Greeting Controller. When I remove @RefreshScope, I can access the link localhost:8080/greeting normally
Kaushik, I have an query regarding dynamic config....as per video we need to do 3 steps . 1. actuator dependency added in pom.xml 2. add annotation @RefreshScope in resource bean class 3. test in post man as localhost:8080/actuator/refresh via post method then will refresh the client code. Here my query is if i have 50 microservices and updated config file ...as per above steps we need to test 50 times in the post man call after the refresh or test in the 50 microservice clients or ...please could suggest / clarify me on this. Thanks.
if we have more than one instance of the same microservice, do we need manually refresh each and every service or do we have any other best alternative to do so ?
Not sure this is a production ready mechanism. Requiring a tool to post a request to your application isn’t ideal. I guess you could add an auto refresh class which posts every 10 minutes to config application
@Uday Kumar Bommala Do you have any working example for this? I have tried this, however I am using local git and when I invoke /monitor endpoint on config server from postman, I see `RefreshListener : Received remote refresh request. 2022-04-28 20:12:39.145 INFO 90782 --- [nio-8888-exec-9] o.s.cloud.bus.event.RefreshListener : Keys refreshed []`
December 2020: After Spring Boot 2.4.0/Spring Cloud 2020.0.0-M5 you need to include the spring-cloud-starter-bootstrap dependency and create a bootstrap.yml with the spring application name, spring cloud config uri and the management endpoints web exposure include property there
No need, remove dependency 'spring-cloud-starter-bootstrap', and replace 'spring.cloud.config.uri' with 'spring.config.import'.
@@aaronasuncion4815 When I do that I get java.lang.IllegalStateException: Unable to load config data from 'localhost:8888'
Thanks man!
Now i can mention i know microservices in my resume😂 Great Thanks Kaushik.
@ninuxy Huh I don't really give my resume to the dumb who doesn't know what is "Sarcasm".
same here ;)
@@easwargaming7903 @ninuxy Ohhhhhhhhhhhh
Thanks a lot Kaushik. There are materials and tutorials everywhere but the depth and details of understanding the concepts that I get here are simply amazing.
I think restart microservice is better choice. If we use accuator and @RefreshScope, it have 2 drawbacks: (1) accuator open some hookup API which might lead to security concern. (2) @RefreshScope impact performance a lot. All instances that use the config bean need to refresh ALL of its dependencies, not just the config bean.
Hey kaushik.... Because of you so many things are easy to learn.... Many many thanks to you make a wonderful video and make a easy to work in It industry.. 🙏🙏🙏🙏🙏
Simply superbly revealed...😃
This is really convoluted. Thank god for good old JMX MBeans.
God explanation looks simple and easy to understand recommended to everyone to check this out
Strange..... @9:54 I see "config.client.version". but the key "my.greeting" is not showing up. If I delete my spring-boot.config.yml and just use the default everything works. But If I have specific microservice config file.... things don't get udated. Anyone experiencing the same problem?
Yes same problem
Yes even I'm facing the same problem
Really it's very useful, spring cloud configuration,thanks to provide this kind of knowledge 🙏🙏
Thanks Kousik it is really helping me simple and best.
The refresh scope is not working with microservice.yml file. It worked with application.yml
Hey you're right. I ran into the same problem. Were you able to make it work with microservice.yml
Hi Koushik, As you mentioned in the video could you please help us with the git tutorial which covers most of the use cases, especially reverting a merge request, solving merge conflict, and switching over branches without committing(branch specific or unmerged changes).
Great videos, what is the best practice to automate refresh without using rest calls?
You are Awesome Bro You are A Hero You ROCK THE WORLD BRO YOU ARE SUPER AND THE BEST
Hi Koushik I am going to watch this end to end
How would you refresh properties in a Microservice based environment? Like when there are X amount of servers running - and possible them being behind a LoadBalancer
hi kaushik i am eagrly waiting for API GateWay ,kindly upload asap
Thanks so much for this tutorial.
Hi Koushik, Thanks for the informative video.
I am watching microservices end to end.
I have two questions.
1. In case of dynamic configure, We need to refresh actuator, It means if multiple instances are running with a different port, we have to refresh all of those?
2. In case of having YML files named as microservices, how to implement environments based configuration. It is like -environment?
@Uday Kumar Bommala Thank you for sharing!
Hi, Have you find out the solution of this refresh api ...how can we do it one go or can we make it push end point instead of pull end point
@javabrains Hey Kaushik, if the config values are used at multiple places, say many service classes,
As per the video, do we need to add @RefreshScope in all the places ? Request you to help us in that usecase
Is there a good way to automate sending the POST request after making changes to the config server? Perhaps through Jenkins or something of that nature.
it's easy enough to write it yourself
@@stas4985 yes, but what if I have dozens of microservices than need to get the updated values? I don't wanna be sitting there and sending those POST requests to each and every of them.
is there security control over who can call the refresh end point?
When there all multiple microservices belong to same group and you call actuator/refresh POST call, it could only hit one of the instance and refresh. What about all other instances ?
Can you please explain how to refresh all pods in a service?
Hi Koushik,
Content is priceless. I have following two questions.
1. What should be the name of yml-file for the specific profile (not only for the specific microservice, but also profile)?
2. Do we have any workaround for refreshing 100's of micro-services in a go once the application.yml on git repo is updated?
Thanks for sharing this amazing content with us.
I have the same question
Hi Kaushik,
Nice video series. It was really helpful. I have couple of questions -
1. Is it a good practice to rely on Version control for config management as I have read almost everywhere that pushing credentials to git is a bad practice/security issue. I know i can make the repo private but is it still a good solution ?
2. Say we have DB properties defined in spring cloud config server. Admin updates the DB properties and at the same time a DB operation is running on the micro service side. How do we ensure that the change of DB properties does not affect the ongoing operation ?
3. Doesn't spring cloud config server create a bottleneck ? If the server is down, won't the other micro services be affected ?
Hi Dev
Here are answers to your questions from my experience. I am not sure if it 100% correct, but hoping it helps.
1. No, it is not a good practice to store credentials on git repo even if it is private. You should use some vault to store passwords, e.g. Spring Cloud Vault, AWS Secret Manager
2. As per the Kaushik's video, you need to hit the actuator endpoint for the config properties to get refreshed in the microservice. Also, if you are running any DB operation on the microservice, you should business logic in a way that if your transaction doesn't get committed , it should rollback.
3. Yes it may do depending on the situation. Suppose server is running and you started 2 microservices, so these microservices will fetch and cache all the configs. Now the server goes down so those microservices won't be affected, but if now you are starting up a 3rd microservice, it won't be able to fetch config from server. So instead that 3rd microservice will fetch configs from its JAR, if it is present.
Hi , I have a doubt on that @RefershScope. As you say , in our application perspective we are having n number of controller and we are using so many value from the property files. At that if we update the changes in cloud config server, we need to add the @RefershScope in each and every controller. If that is the case then , it will not be nice as we are going to add in 100's of controller if we are having it. Is there any other alternative , like if we want to use it for a entire application, configure it in a place and let all the get uploaded?
question: in case i have multiple micro services instances for my service, then how do you call /refresh, because if we have 5 instances then though you call /refresh it calls only one instance.
any idea whats the solution for this use case??
OMG this is so awesome. No polling
I am not able to get it to work. When I run the actuator refresh endpoint, it returns me with an empty array - [] in response. Using the latest version of Springboot - v3.2.3 with spring cloud version - 2023.0.0
And what should be the name of yml-file for the specific profile (not only for the specific microservice, but also profile)?
applicationname-dev.yml
Amazing course !!
Please add a slide to automate dynamic refresh also as it is not advisable to call the post method to refresh manually.
Thanks a lot! It was really helpful!
don't forget to add management.endpoints.web.exposure.include=* in application.properties
Good one. Thanks 💝💝
Kaushik, your videos are awesome, much thanks. For my project, I noticed that dynamic updates only work for my microservice with respect to properties defined in the config server application.yml and not for propeties defined in the microservice specific yml file. I wonder if this is a known issue or perhaps there's something not configured correctly in my setup.
Hi Koushik, Very nicely explained . i like all your videos and that helps a lot to grab concept. Great work you are doing.
I have one question . In microservice architecture when to use application.yml and when to use bootstrap.yml and which properties goes in which file ...
Nice vid, good work, thanks.
Hi Kaushik,
I am searching for the following two things. Let me know if you can help with this.
1. Lazy initialization of spring security configuation. I'm using OAuth + OpenId. The issuer URI is loaded in DB at some time via CRUD by admin in the same spring boot app. Then only I need to initialize the spring security configure().
2. Also I want to know how reload the spring security configuration at runtime when the Issuer URI changed at db.
hey I tried everything shown in the tutorial but my bean is not refreshed , besides when i do a post on /actuator/refresh i get in empty [] response wondering what could be the issue
Hi. Is it possible to make auto-refresh properties for Spring Cloud clients in a multi-pod environment?
What is the best practice for not so simple properties configuration? e.g. properties for thread pool size etc.
Hello when I add the Config Client dependency in my microservice project it refuses to start returning the following error:
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.
I need help
@JavaBrains how does the refresh work with versioning. For example wanting to refresh app properties 1.0 to 2.0
Hello Kaushik , thanks for nice tutorial. I have one question. how we can handle the scenario if our git repo goes down for some time. Looking forward to your answer
Thank you
This doesn't work if you are running multiple instance.
Please use spring cloud bus
@@subbunittala2012 can you share any example using cloud bus + rabbitmq/kafka ? I have tried this, however I am using local git and when I invoke /monitor endpoint on config server from postman to mimiic a webhoook, I see `RefreshListener : Received remote refresh request.
2022-04-28 20:12:39.145 INFO 90782 --- [nio-8888-exec-9] o.s.cloud.bus.event.RefreshListener : Keys refreshed []` :(
Hi Koushik,
Whenever I tries giving a call actuator/refresh it gives me HTTP Status 404 error. Even though all the endpoints are enable. What's the cause of this?
bro have you got the solution
same here.. Did u get the solution yet?
Hello , how to refresh the client using a Kafka and create a webhook from git to Kafka
I updated my resume to I have 3 years exp in microservices
i am facing issue with database configuration if apply refresh scope. for me even both database URL and r2bc configs, message are changing in refresh scope , i am getting only updated message but my service still pointing to the old Database not the Updated one.
how can we achieve that one dynamic db connection.
Did you figured it out?
Hi.. I had a question..
Are we going to add @RefreshScope on top of all beans to take latest prop file values?
How value will be reflected if we have multiple client instances
Is it normal when I edited the spring-boot-config.yml without committing, but the config server output is displaying my edited config. If it is, then what's the use of git repo?
actuator/refresh returns updated value from application.properties file but it is not refreshing the values from microservice specific file. I am using Spring Cloud version 2021.0.4 Please suggest.
I have found the solution: I just renamed the application.yml file to bootstrap.yml (inside the client spring boot project) and it started working. Actuator started fetching the updated value from the microservice specific file.
@@Sukhbir_Ghangas Thank you! That worked!
Hi, can we have ribbon load balancing servers list dynamically from git ? Let say we have 3 instances initially, based on the load we want to increase it to 5. Can we do this with this approach on the fly ? If we can, then which URL we need to hit to refresh as there are three instances are running. Please guide me on this.
Thank you so much
I am getting the error "This application has no explicit mapping for /error, so you are seeing this as a fallback" after adding @RefreshScope to the Greeting Controller. When I remove @RefreshScope, I can access the link localhost:8080/greeting normally
check you have this in your yaml or properties file --> management.endpoints.web.exposure.include=*
Facing the same issue.
Can we use this method for Spring Boot deployed on kubernetes? I mean can configmaps be reloaded using this method?
nice
Thanks 👍
Kaushik, I have an query regarding dynamic config....as per video we need to do 3 steps . 1. actuator dependency added in pom.xml 2. add annotation @RefreshScope in resource bean class 3. test in post man as localhost:8080/actuator/refresh via post method then will refresh the client code. Here my query is if i have 50 microservices and updated config file ...as per above steps we need to test 50 times in the post man call after the refresh or test in the 50 microservice clients or ...please could suggest / clarify me on this. Thanks.
Hi, Have you find out the solution for this? Can we make it push endpoint instead of pull endpoint?
Hi Koushik Kindly help to share Git repo link
if we have more than one instance of the same microservice, do we need manually refresh each and every service or do we have any other best alternative to do so ?
Hi, have you find out the solution of this.?
Can I use this with CommandLineRunner?
Is this similar to spring cloud Bus
Hi sir,can we use this technique for monolithic application in springboot.
Bathula Nagendra yes you can use.
@@satyendrasingh9658 if you don't mind please help me to do that.i tried but unable to do.
Not sure this is a production ready mechanism. Requiring a tool to post a request to your application isn’t ideal. I guess you could add an auto refresh class which posts every 10 minutes to config application
What is the advantage of join sport from subscription ?
@Uday Kumar Bommala Do you have any working example for this? I have tried this, however I am using local git and when I invoke /monitor endpoint on config server from postman, I see `RefreshListener : Received remote refresh request.
2022-04-28 20:12:39.145 INFO 90782 --- [nio-8888-exec-9] o.s.cloud.bus.event.RefreshListener : Keys refreshed []`
@@shraddhachitalia8391 Hi, have you find out the solution for this? Like how can we get rid off calling/refresh api every time
👍👍👍
where is code of this tutorial in git
Not working
10:27