Using @PropertySources we can load properties mentioned in an external file. These properties are loaded into Environment. We can use Environment to access properties loaded from an external file. I found this use-case to use Environment a very useful.
I think that a correct use of environment is to check when diagnosing. If we receive unexpected values on properties. Then we can discover what is happening.
Hi Kaushik, The series is amazing. Thank you. I have a question, how do I take the the DB connection parameters as a rest API input from the user and connect to a that database , ideally that refreshes the DB connection at every API request without having to restart the spring application? Can I make use of the properties configuration somehow? How to do that along with spring data JPA repo?
i think, we should like (or dislike) the video if we watch it. there are 32K views and only 600+ + 27 comments and responses. We should learn to appreciate the efforts. Also it will serve as a feedback as well...
Kaushik , have an query ....how to communicate two services in micro service and if one service is not responding what is the behavior for other one...these two serveries are dependent each other.
You could write a script in your server which monitors your service, and if your service fails it would trigger you a email or some kind of notification. That would help.
Have you checked out the Level 1 course in this series? I cover microservice communication in depth. To answer your question, the way it works is using service discovery, and possibly running multiple instances of each service so that if one goes down, the request can be routed to another instance.
@@Java.Brains Thanks a lot Kaushik, i have a chilly question ...instead of eureka server/client (for service discovery) what other options we have ...for using service discovery ( zookeeper, consul) if i am wrong correct me , and how to connect docker with microservices.
Absolutely! Eureka isn’t the only solution. You can do any implementation that does the service discovery pattern. Learn the pattern in this video - ua-cam.com/video/GboiMJm6WlA/v-deo.html
Kaushik, thanks for wonderful teaching. one question, if we combine all the profiles together and deploy the jar, let's say in dev, won't the dev server will have prod values as well , won't that be an issue?
Hi Kaushik sir, please add few courses to learn algorithms and DS. Your teaching skills are awesome.
Try GeeksforGeeks, they have amazing content - let him focus on java only. He is our go to JAVA GOD !!
you are improving so many techies lives, God Bless you sir.
Using @PropertySources we can load properties mentioned in an external file. These properties are loaded into Environment. We can use Environment to access properties loaded from an external file. I found this use-case to use Environment a very useful.
best indian teacher on youtube
I think that a correct use of environment is to check when diagnosing. If we receive unexpected values on properties. Then we can discover what is happening.
Best teacher on Internet
this is pure gold....
@Java Brains: Please add more content on spring boot microservices like level 4 level 5 etc...
Thank you for more specific information
You are Awesome Bro You are A Hero You ROCK THE WORLD BRO YOU ARE SUPER AND THE BEST
Why are you so smart? Thaaanks a lot,
you can use Environment in order to validate if input profile is one of the valid allowed profiles.
Thanks for providing ad free
Hi Kaushik, The series is amazing. Thank you. I have a question, how do I take the the DB connection parameters as a rest API input from the user and connect to a that database , ideally that refreshes the DB connection at every API request without having to restart the spring application? Can I make use of the properties configuration somehow? How to do that along with spring data JPA repo?
Hi Gaurav. I was having the same question. Can you let me know if you found a way to do it?
i think, we should like (or dislike) the video if we watch it.
there are 32K views and only 600+ + 27 comments and responses. We should learn to appreciate the efforts.
Also it will serve as a feedback as well...
Hey Kaushik , how you get to know these Hidden gems of Spring Boot like Environment class :-), Please suggest
Hi Sir Is Environment Object auto registered as bean in spring IOC container?
Thanks you.
So is injecting a property vs using Environment.getProperty effectively the same thing or am I missing something?
Kaushik , have an query ....how to communicate two services in micro service and if one service is not responding what is the behavior for other one...these two serveries are dependent each other.
You could write a script in your server which monitors your service, and if your service fails it would trigger you a email or some kind of notification. That would help.
Have you checked out the Level 1 course in this series? I cover microservice communication in depth. To answer your question, the way it works is using service discovery, and possibly running multiple instances of each service so that if one goes down, the request can be routed to another instance.
@@Java.Brains Thanks a lot Kaushik, i have a chilly question ...instead of eureka server/client (for service discovery) what other options we have ...for using service discovery ( zookeeper, consul) if i am wrong correct me , and how to connect docker with microservices.
Absolutely! Eureka isn’t the only solution. You can do any implementation that does the service discovery pattern. Learn the pattern in this video -
ua-cam.com/video/GboiMJm6WlA/v-deo.html
Good to know. Thank you 👍
Not able to find spring cloud config server related video
Kaushik, Is the Environment Controller exists in the spring inbuilt framerwork itself? Or do we need to have any dependency war?
No dependencies needed
👌
Kaushik, thanks for wonderful teaching. one question, if we combine all the profiles together and deploy the jar, let's say in dev, won't the dev server will have prod values as well , won't that be an issue?
Title: Using environment object.
Conclusion: You should not be using environment object.
Well, i thought i went crazy... So we did understand the same thing... ☺