Dynamic config with spring Boot - Microservice configuration with Spring Boot [13]

Поділитися
Вставка
  • Опубліковано 6 лис 2024

КОМЕНТАРІ • 109

  • @easwargaming7903
    @easwargaming7903 4 роки тому +24

    Now i can mention i know microservices in my resume😂 Great Thanks Kaushik.

    • @easwargaming7903
      @easwargaming7903 4 роки тому +19

      @ninuxy Huh I don't really give my resume to the dumb who doesn't know what is "Sarcasm".

    • @kaushalmzp
      @kaushalmzp 4 роки тому

      same here ;)

    • @jonsnow9246
      @jonsnow9246 4 роки тому +1

      @@easwargaming7903 @ninuxy Ohhhhhhhhhhhh

  • @maurov2104
    @maurov2104 3 роки тому +14

    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

    • @aaronasuncion4815
      @aaronasuncion4815 3 роки тому +3

      No need, remove dependency 'spring-cloud-starter-bootstrap', and replace 'spring.cloud.config.uri' with 'spring.config.import'.

    • @tonegrail650
      @tonegrail650 2 роки тому

      @@aaronasuncion4815 When I do that I get java.lang.IllegalStateException: Unable to load config data from 'localhost:8888'

    • @uvinweththasinghe9232
      @uvinweththasinghe9232 Рік тому

      Thanks man!

  • @gauravmam
    @gauravmam 4 роки тому +1

    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.

  • @royalvivek9224
    @royalvivek9224 4 роки тому +1

    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.. 🙏🙏🙏🙏🙏

  • @nautilus2024
    @nautilus2024 2 роки тому +2

    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.

  • @yevgeny3985
    @yevgeny3985 4 місяці тому

    Great videos, what is the best practice to automate refresh without using rest calls?

  • @udit9337
    @udit9337 4 роки тому

    God explanation looks simple and easy to understand recommended to everyone to check this out

  • @pavanmodi7265
    @pavanmodi7265 3 роки тому

    Really it's very useful, spring cloud configuration,thanks to provide this kind of knowledge 🙏🙏

  • @PrasannaLakshmi74
    @PrasannaLakshmi74 4 роки тому +4

    Simply superbly revealed...😃

  • @anshulsatish
    @anshulsatish 4 роки тому +4

    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).

  • @SunilVerma-gr7yv
    @SunilVerma-gr7yv 4 роки тому +1

    Thanks Kousik it is really helping me simple and best.

  • @mirogula
    @mirogula 4 роки тому

    This is really convoluted. Thank god for good old JMX MBeans.

  • @mohdfurkan2062
    @mohdfurkan2062 4 роки тому +3

    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?

    • @hidayatrzayev6603
      @hidayatrzayev6603 3 роки тому

      @Uday Kumar Bommala Thank you for sharing!

    • @akshaygupta2863
      @akshaygupta2863 2 роки тому

      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

  • @StyleTrick
    @StyleTrick 4 роки тому +7

    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
      @stas4985 3 роки тому

      it's easy enough to write it yourself

    • @hidayatrzayev6603
      @hidayatrzayev6603 3 роки тому +3

      @@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.

  • @AleksandarT10
    @AleksandarT10 2 роки тому +1

    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

  • @ohhhgggeeezzz
    @ohhhgggeeezzz 3 роки тому +3

    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?

    • @somusekhar6796
      @somusekhar6796 3 роки тому

      Yes same problem

    • @BaburaoBDarvesh
      @BaburaoBDarvesh 2 роки тому

      Yes even I'm facing the same problem

    • @Harithakoritala
      @Harithakoritala Місяць тому

      I got the same issue while using springboot3.*. Then realized, i have used bootstrap dependency & yaml file in client config application which are legacy ones and not needed at all. To make the properties load from config server before the ApplicationContext initialized we use bootstrap with legacy version but now we can just use spring:config : import: "optional:configserver" it will work. I just added this to my application.yml in client config application and removed the bootstrap.yml& dependency.

  • @anudeeppamu
    @anudeeppamu 8 місяців тому

    @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

  • @elangopadmanabhan9920
    @elangopadmanabhan9920 3 роки тому +2

    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?

  • @atulsharma8596
    @atulsharma8596 4 роки тому +2

    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.

  • @mohammedshabbirahmed976
    @mohammedshabbirahmed976 3 роки тому

    You are Awesome Bro You are A Hero You ROCK THE WORLD BRO YOU ARE SUPER AND THE BEST

  • @SanthoshkumarNagulanchi
    @SanthoshkumarNagulanchi Рік тому

    Can you please explain how to refresh all pods in a service?

  • @Aapla_Institute
    @Aapla_Institute 4 роки тому +2

    hi kaushik i am eagrly waiting for API GateWay ,kindly upload asap

  • @chandrasekharreddyp
    @chandrasekharreddyp 2 роки тому +1

    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??

  • @rossxie9809
    @rossxie9809 3 роки тому +1

    is there security control over who can call the refresh end point?

  • @elephant742
    @elephant742 4 роки тому +4

    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 ?

    • @diwaygrover
      @diwaygrover 4 роки тому +2

      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.

  • @shraddhachitalia8391
    @shraddhachitalia8391 2 роки тому

    Amazing course !!

  • @sajip7064
    @sajip7064 4 роки тому

    Please add a slide to automate dynamic refresh also as it is not advisable to call the post method to refresh manually.

  • @nadalnguyen4951
    @nadalnguyen4951 4 роки тому +1

    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.

  • @ekaterinagalkina7303
    @ekaterinagalkina7303 4 роки тому +4

    And what should be the name of yml-file for the specific profile (not only for the specific microservice, but also profile)?

  • @basavaraj2065
    @basavaraj2065 Рік тому

    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 ?

  • @BilalIssa
    @BilalIssa 3 роки тому

    What is the best practice for not so simple properties configuration? e.g. properties for thread pool size etc.

  • @OlegPetrow-ze6ft
    @OlegPetrow-ze6ft 2 роки тому

    Thanks a lot! It was really helpful!

  • @it_qasqyr5865
    @it_qasqyr5865 Рік тому

    Hi. Is it possible to make auto-refresh properties for Spring Cloud clients in a multi-pod environment?

  • @vinodmehta5860
    @vinodmehta5860 3 роки тому

    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

  • @antorodrigo2084
    @antorodrigo2084 3 роки тому

    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.

  • @romantsyupryk3009
    @romantsyupryk3009 4 роки тому +1

    Thanks so much for this tutorial.

  • @tomknud
    @tomknud 2 роки тому

    Nice vid, good work, thanks.

  • @sameerpande7567
    @sameerpande7567 3 роки тому +2

    The refresh scope is not working with microservice.yml file. It worked with application.yml

    • @Asinha1010
      @Asinha1010 3 роки тому

      Hey you're right. I ran into the same problem. Were you able to make it work with microservice.yml

    • @Harithakoritala
      @Harithakoritala Місяць тому

      For me it didn't work if i use different names for my client service application name and corresponding yaml file name in config-server application. When i made it same it worked along with case sensitive.

  • @bernardamofah4524
    @bernardamofah4524 3 роки тому

    @JavaBrains how does the refresh work with versioning. For example wanting to refresh app properties 1.0 to 2.0

  • @jagadishtembhe1806
    @jagadishtembhe1806 4 роки тому

    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 ...

  • @HimanshuSingh_92
    @HimanshuSingh_92 3 роки тому

    Hi.. I had a question..
    Are we going to add @RefreshScope on top of all beans to take latest prop file values?

  • @AnimeshPaul23
    @AnimeshPaul23 7 місяців тому

    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

  • @abhishekramkumar8875
    @abhishekramkumar8875 3 роки тому

    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

  • @satyamramawat
    @satyamramawat 3 роки тому +2

    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?

    • @Empower-YouTube
      @Empower-YouTube 2 роки тому

      bro have you got the solution

    • @vishnushinde281
      @vishnushinde281 Рік тому

      same here.. Did u get the solution yet?

    • @Harithakoritala
      @Harithakoritala Місяць тому

      Are you sure the error is 404? I got 405 method when i am trying hit /actuator/refresh from browser because its a post request so it wont work, i realized and did through postman it worked. If you are getting 404 means whatever the URL you are trying for is not found. I have used spring boot 3.* version and actuator version is 3.3.4, added the these props to my yml file. "management: endpoints:web:exposure:include: "*", management:endpoint: refresh:enabled: true ". Make sure localhost:8080/actuator when you hit this you must see refresh endpoint in list. Hope it helps..

  • @isidme
    @isidme 4 роки тому

    OMG this is so awesome. No polling

  • @thilinakalummoragoda8597
    @thilinakalummoragoda8597 4 роки тому +1

    Good one. Thanks 💝💝

  • @alphaamadoubalde2822
    @alphaamadoubalde2822 2 роки тому

    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

  • @tapajyotigiri
    @tapajyotigiri 3 роки тому

    Hello , how to refresh the client using a Kafka and create a webhook from git to Kafka

  • @rakshithsirigeri1903
    @rakshithsirigeri1903 3 роки тому

    Can we use this method for Spring Boot deployed on kubernetes? I mean can configmaps be reloaded using this method?

  • @tanumoymajumdar874
    @tanumoymajumdar874 3 роки тому

    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.

  • @akshay-md4fy
    @akshay-md4fy 3 роки тому

    How value will be reflected if we have multiple client instances

  • @vishalpoddar
    @vishalpoddar Рік тому

    don't forget to add management.endpoints.web.exposure.include=* in application.properties

  • @dowlathbashag65
    @dowlathbashag65 4 роки тому

    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.

    • @akshaygupta2863
      @akshaygupta2863 2 роки тому

      Hi, Have you find out the solution for this? Can we make it push endpoint instead of pull endpoint?

  • @SreehariGogula
    @SreehariGogula 9 місяців тому

    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.

  • @Azyro777
    @Azyro777 3 роки тому

    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?

  • @Sukhbir_Ghangas
    @Sukhbir_Ghangas 2 роки тому

    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.

    • @Sukhbir_Ghangas
      @Sukhbir_Ghangas 2 роки тому +1

      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.

    • @tonegrail650
      @tonegrail650 2 роки тому

      @@Sukhbir_Ghangas Thank you! That worked!

  • @kusumarajuprasanth5736
    @kusumarajuprasanth5736 4 роки тому

    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 ?

    • @akshaygupta2863
      @akshaygupta2863 2 роки тому

      Hi, have you find out the solution of this.?

  • @buichitai6072
    @buichitai6072 4 роки тому +1

    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

    • @RanjithKumar-qj9mn
      @RanjithKumar-qj9mn 4 роки тому

      check you have this in your yaml or properties file --> management.endpoints.web.exposure.include=*

    • @vasusharma1884
      @vasusharma1884 3 роки тому

      Facing the same issue.

  • @mohanbabu9181
    @mohanbabu9181 4 роки тому +1

    I updated my resume to I have 3 years exp in microservices

  • @bathulanagendra4621
    @bathulanagendra4621 4 роки тому

    Hi sir,can we use this technique for monolithic application in springboot.

    • @satyendrasingh9658
      @satyendrasingh9658 4 роки тому

      Bathula Nagendra yes you can use.

    • @bathulanagendra4621
      @bathulanagendra4621 4 роки тому

      @@satyendrasingh9658 if you don't mind please help me to do that.i tried but unable to do.

  • @hyperborean72
    @hyperborean72 4 роки тому

    Thank you so much

  • @ikomangmahendra
    @ikomangmahendra 3 роки тому

    Thanks 👍

  • @godwinsamuel9821
    @godwinsamuel9821 4 роки тому +1

    This doesn't work if you are running multiple instance.

    • @subbunittala2012
      @subbunittala2012 3 роки тому

      Please use spring cloud bus

    • @shraddhachitalia8391
      @shraddhachitalia8391 2 роки тому

      @@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 []` :(

  • @USONOFAV
    @USONOFAV 4 роки тому

    Can I use this with CommandLineRunner?

  • @prasadpardeshi587
    @prasadpardeshi587 4 роки тому

    Hi Koushik Kindly help to share Git repo link

  • @ravichandar6975
    @ravichandar6975 4 роки тому

    Is this similar to spring cloud Bus

  • @jackbourner7965
    @jackbourner7965 4 роки тому

    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

    • @sudheepkrishnanm7663
      @sudheepkrishnanm7663 4 роки тому

      What is the advantage of join sport from subscription ?

    • @shraddhachitalia8391
      @shraddhachitalia8391 2 роки тому

      @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 []`

    • @akshaygupta2863
      @akshaygupta2863 2 роки тому +1

      @@shraddhachitalia8391 Hi, have you find out the solution for this? Like how can we get rid off calling/refresh api every time

  • @magicman3657
    @magicman3657 8 місяців тому

    nice

  • @AjayKumar-fd9mv
    @AjayKumar-fd9mv 4 роки тому

    👍👍👍

  • @atmiksoni5859
    @atmiksoni5859 4 роки тому

    where is code of this tutorial in git

  • @Пилимвидео-с8в
    @Пилимвидео-с8в Рік тому

    Not working

  • @computewitharjun
    @computewitharjun Рік тому

    10:27