Spring profiles explained - Microservice configuration with Spring Boot [08]

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ต.ค. 2024

ความคิดเห็น • 100

  • @diboracle123
    @diboracle123 4 ปีที่แล้ว +90

    I personally like your tutorials. Could you also start a tutorial of any cloud (Aws/Azure/GCP) after micro service. It would be really helpful if you could do so.

  • @shrabontipal6699
    @shrabontipal6699 4 ปีที่แล้ว +4

    I am an IT professional but your videos makes me travel back to my college days where I was blessed with some excellent professors. Thanks to you , the way you explain gives me opportunity to feel like I am in the same classroom and you are one of those excellent professors. I personally like your explanation because answer all WHY questions. We know WHAT to use where but you emphasise more on WHY should we use that.

  • @aswarthanarayanareddyb176
    @aswarthanarayanareddyb176 4 ปีที่แล้ว +8

    this is why I'm, again and again, fall in love with java brains, Thank you java brains for enhancing my skills of 'spring profiles'. this is very helpful for me in development. I'm waiting for the actual microservice series.

  • @amplipeter
    @amplipeter 4 ปีที่แล้ว +12

    I searched half the web how it works..(and naming convention in profile!) Java Brains explains and I get it at once!

  • @vinodhkumarummaneni9627
    @vinodhkumarummaneni9627 4 ปีที่แล้ว +25

    If this video is spring bean, it goes to @Profile("Awesome Explanation") ❤

  • @harshverm776
    @harshverm776 ปีที่แล้ว

    I never want disappointed by the Explanation of Sir.
    Thanks for your videos !!!
    You are always the Best.

  • @SatyaUpendra
    @SatyaUpendra 4 ปีที่แล้ว +1

    I watched this course in most rated paid online learning platform. That is no where near to your explnation. Koushik Your are The Man.

  • @Blueflamey
    @Blueflamey ปีที่แล้ว

    This is a very good explanation of what @Profile is. Thanks!

  • @yashpalgandhi4108
    @yashpalgandhi4108 4 ปีที่แล้ว +2

    Nice explanation as always! Please start another series for deploying micro services

  • @pablon3115
    @pablon3115 4 ปีที่แล้ว +2

    Amazing. Perfect mix between theory and practice. Thanks!

  • @krimarokadiya2611
    @krimarokadiya2611 3 ปีที่แล้ว

    Very helpful tutorial for learning profile in spring boot , I like the way that sir explain with real time examples in coding.

  • @VivekYadav-hx3hp
    @VivekYadav-hx3hp 2 ปีที่แล้ว

    Really liked your tutorials. I was confused that how exactly the profiles are being choosed. You explain it quite nice👌

  • @JeevanSunkersett
    @JeevanSunkersett 2 ปีที่แล้ว

    Thank you. Your tutorials are just too good.
    In this particular context of spring profiles, I would like to add
    I needed to start my application with TWO profiles active...
    My React front end was facing CORS issue when accessing my spring boot backend
    - so had a special bean with a @Profile("corsSecurity")
    and to have TWO profiles (dev and prod) had this in my default application.properties
    spring.profiles.group.dev=dev,corsSecurity
    spring.profiles.group.prod=prod,corsSecurity
    and started my application with either
    java -jar --spring.profiles.active=dev or --spring.profiles.active=prod

  • @harshadholkar
    @harshadholkar 4 ปีที่แล้ว +1

    Trust me this guy is a genius

  • @kaushikmitra28
    @kaushikmitra28 3 ปีที่แล้ว +3

    Note - This method will work till spring boot 2.3. Starting from 2.4 there can be one single application.properties file separated by #--- for env specific values using spring.config.activate.on-profile= at the start followed by the env specific values

  • @GuitarreroDaniel
    @GuitarreroDaniel 4 ปีที่แล้ว +1

    Hey man, this was amazing. Before this video I was wondering how I was gonna set up profiles in maven! It's such a relief that this could be done via jar.
    Thank you very much!

  • @Creeper-dc9oz
    @Creeper-dc9oz ปีที่แล้ว

    Thankyou. Clear, informative and to the point. Spring profiles...done

  • @hyperborean72
    @hyperborean72 4 ปีที่แล้ว +1

    You are doing a fantastic job Sir

  • @rajmiglani4159
    @rajmiglani4159 4 ปีที่แล้ว

    In this era of netflix and stuff, I am glad to binge watch these 😎

  • @kumarchandresh0
    @kumarchandresh0 4 ปีที่แล้ว +3

    Happy Republic Day Koushik.!

  • @sauravsrivastava9019
    @sauravsrivastava9019 3 ปีที่แล้ว

    Very useful I like the way you explain...Thanks

  • @marekdarek7299
    @marekdarek7299 2 ปีที่แล้ว

    Yours videos are so helpful! Thank you!

  • @ramlimbu2167
    @ramlimbu2167 4 ปีที่แล้ว +1

    Great tutorial!! This is what i was looking for implement in my project.

  • @AbhishekSharma7
    @AbhishekSharma7 4 ปีที่แล้ว +1

    Great tutorial so far! Can you please have a tutorial for JWT

  • @BalajiChinnuSha
    @BalajiChinnuSha 4 ปีที่แล้ว +1

    Nice tutorial... pls see if you can put something on exception in spring boot

  • @jishuschannel
    @jishuschannel 4 ปีที่แล้ว

    Lovely...very crisp and clear 👌👌

  • @karthikgotrala580
    @karthikgotrala580 4 ปีที่แล้ว +3

    Great Thank you for the video series

  • @mickyo9223
    @mickyo9223 3 ปีที่แล้ว +1

    thumbs up for him to sell some merch. I've watch enough of your vids to justify buying some. Think of a nice pc sticker, or cooler sticker. JB-Vids!?!?

  • @bogdanmazur3256
    @bogdanmazur3256 2 ปีที่แล้ว

    Thank you for such great explanation

  • @digvijaypatil5358
    @digvijaypatil5358 4 ปีที่แล้ว +1

    Nice Tutorial !! One question Can we set XSD of mainframe environment with specific properties with Spring Profiles?

  • @luizconrado
    @luizconrado 3 ปีที่แล้ว

    @Java Brains - Is there a way I can get in contact with you? I would very much appreciate that. Thank you.

  • @sonofgod00
    @sonofgod00 2 ปีที่แล้ว

    great sir god bless you thanks for helping

  • @MzamoHerbza
    @MzamoHerbza 4 ปีที่แล้ว

    Hi Kaushik, thanks for the awesome tutorial, my question , is it possible to define profiles for external Property Files and configuration (properties) without using for example application.prop or Is it also possible to have profiles for external Property Files and configurations.

  • @AmittSpeaking
    @AmittSpeaking 3 ปีที่แล้ว

    Amazing explanation!

  • @АртёмГубанов-ц3ц
    @АртёмГубанов-ц3ц 4 ปีที่แล้ว +1

    Огромное, СПАСИБО! Ты просто молодец! :)

  • @vinayrathod9972
    @vinayrathod9972 3 ปีที่แล้ว

    Also, we can have multiple profiles configured under one config file. Can u explain a bit about it how to set it

  • @josephnairpudupermanil8679
    @josephnairpudupermanil8679 2 ปีที่แล้ว

    Awesome Koushik..

  • @shobhit321
    @shobhit321 3 ปีที่แล้ว

    V Good explanation.
    One question , if everything remains in jar , and we have to say change some config value for prod , do we need to change the jar to include that new config value? As the production config sits in jar. We will have to build the code again to generate new build version. Isn't? M I missing something?

  • @rbelatamas
    @rbelatamas 3 ปีที่แล้ว

    Brilliant tutorial! Thank you so much!

  • @_dinesh
    @_dinesh 3 ปีที่แล้ว

    As always thank you for the great video. On a completely different topic, I am curious to know why you are using package view as opposed to the project files in IntelliJ project explorer. In my optional project view is more intuitive and exactly represents the actual folder structure. That's one of the reasons I switched to intelliJ.

  • @vijaysingh-zu3fh
    @vijaysingh-zu3fh 4 ปีที่แล้ว +1

    Nice explanation
    Have one doubt how can I change the profile in pcf using command line

    • @vijaysingh-zu3fh
      @vijaysingh-zu3fh 4 ปีที่แล้ว

      I think in manifest-env.yml we need to write active profile name

  • @shemantsingh765
    @shemantsingh765 ปีที่แล้ว

    Hi @JavaBrains , if we define @Profile("dev") on class say ABC then only ABC class bean will be instantiated in whole application when ran in dev environment, is my understanding correct ?
    can you share your thoughts over this ?

  • @manjum143
    @manjum143 4 ปีที่แล้ว

    Thanks Kaushik. Is there any chance you will share the GIT link of all the programs you explain the concepts on?

  • @mrpotatohasabanana
    @mrpotatohasabanana 2 ปีที่แล้ว +1

    at 9:10 you said it overrides but i faced this issue,
    I did exactly what you did with previous project rather then creating new project with just web dependency, i was able to have two properties but new properties file was not overriding values written in default properties file, but moment i switched to yaml files overriding worked.
    can someone tell me why?

  • @FatovMikhail
    @FatovMikhail 4 ปีที่แล้ว

    what about unit tests? what profile will they use? how to control it? is it possible to have test profile that will not make it's way to the artifact and will be used only in the tests scope?

  • @prabhuprasaddevanaboina3889
    @prabhuprasaddevanaboina3889 ปีที่แล้ว

    Very good sir.

  • @aleksandrkravtsov8727
    @aleksandrkravtsov8727 3 ปีที่แล้ว

    very cool lesson 👍

  • @GovindSingh-sg8lx
    @GovindSingh-sg8lx 2 ปีที่แล้ว

    what about if we are creating War or EAR and deploying to Different Env, how I will choose profile there.

  • @santhoshbasineni
    @santhoshbasineni 4 ปีที่แล้ว +1

    Can you please publish Microservice Saga or event sourcing example. Thanks

  • @danieldiaz6025
    @danieldiaz6025 4 ปีที่แล้ว

    I'm enjoying these videos, I really like how they are structured around the desirable properties a configuration system should have.
    I have a question about the "default profile", though. Is it really correct to say that it's "always active"? My understanding is that, as soon as a different profile is explicitly set with "spring.profiles.active", beans in the default profile won't get loaded into the context. Even beans that are not "overridden" by the explicit profile.
    Also, is it correct to say (around 15:00) that setting @Profile("default") and not including any @Profile annotation in a bean are equivalent? I believe that no @Profile = "always present", while @Profile("default") = "present only when no explicit profile is given".

  • @hyperborean72
    @hyperborean72 3 ปีที่แล้ว

    can we have beans configured for a specific profile but without corresponding specific property file?

  • @mrpotatohasabanana
    @mrpotatohasabanana 2 ปีที่แล้ว

    at 9:10 you said two properties files can be there in our project but when they are present at same location (src/main/resources) overriding is not working , different profile gets selected but values are not overridden, but two yaml files work how you told even in same location.

  • @gchandrasekharreddy2907
    @gchandrasekharreddy2907 4 ปีที่แล้ว +1

    Thanking you Guru ji.....🤝🤝

  • @RohitPal-lz1wf
    @RohitPal-lz1wf 3 ปีที่แล้ว

    Please start series for AWS core services

  • @jeeperscreepers7
    @jeeperscreepers7 3 ปีที่แล้ว

    What if you can't specify the profile in command line arguments because you have to deploy the .war in an environment such as Jboss? thanks

  • @FatovMikhail
    @FatovMikhail 4 ปีที่แล้ว +1

    is it ok to have no default profile in the aplication and provide it manually for each environment with only the profile name in it? this could protect from running application with a wrong profile

    • @Java.Brains
      @Java.Brains  4 ปีที่แล้ว +2

      You can, but remember that there’s always a default profile active. So, even if you have one configuration value in your app that’s common across all profiles, it would be silly to duplicate it across all your profiles. Hope that clarifies

  • @glchiu5292
    @glchiu5292 2 ปีที่แล้ว

    useful skills, thank you

  • @tomknud
    @tomknud 2 ปีที่แล้ว

    12 step process architecture doesn't like it but selecting beans based upon external input, ie. config file, brings Spring back to inversion of control and code-reuse, which it seems to lose with annotations.

  • @gillianbc
    @gillianbc 4 ปีที่แล้ว

    I needed a bean for an integration test. I didn't use a profile annotation so it was instantiated via the default profile. I could see that in the log. However, I got no bean found when autowiring it into my integration test. How can that be when I could see that the bean had been created?

  • @susanpeter3950
    @susanpeter3950 2 ปีที่แล้ว

    Super excellent..

  • @vipin0705
    @vipin0705 4 ปีที่แล้ว +1

    What happened if we have @profile("dev") & @profile("production") and we not activated dev or production profile than which bean should be initiated.

  • @haribachala
    @haribachala 4 ปีที่แล้ว +1

    Question: Lets say you have a bean called Repository( in source code with active profile "production") in source code , in test (folder, for functional tests) having another Bean called Repository( to connect embedded H2 instead of actual DB) with active profile as "test" , when we run application will test bean will be injected to container? (It does not worked for me)

    • @ayushgupta8239
      @ayushgupta8239 4 ปีที่แล้ว +1

      What's the order of profile in ur application file??

    • @haribachala
      @haribachala 4 ปีที่แล้ว

      @@ayushgupta8239 - we are running test base class with with @activeprofile as test, qq: will spring context will consider Repository bean which is in src/test/jav?

    • @ayushgupta8239
      @ayushgupta8239 4 ปีที่แล้ว

      @@haribachala i don't think so

  • @atmiksoni5859
    @atmiksoni5859 4 ปีที่แล้ว

    Where i can find your code . how you can define Map value in yaml file?

  • @punithgowda8890
    @punithgowda8890 3 ปีที่แล้ว

    Very useful..feature

  • @-indeed8285
    @-indeed8285 4 ปีที่แล้ว +2

    Amazing ❤

  • @nolan_villeneuve
    @nolan_villeneuve 4 ปีที่แล้ว +3

    The video number is wrong. It should be [08]

  • @menabebawy390
    @menabebawy390 2 ปีที่แล้ว

    great, thank you

  • @bishwajitvikram3794
    @bishwajitvikram3794 4 ปีที่แล้ว +1

    i added this property on application-test.yml file
    spring.profiles.active: test
    Still it load the default profile.
    i am using the spring boot v2.2.4.RELEASE.
    is there any more change to do ?

    • @bikramnarayankundu2924
      @bikramnarayankundu2924 4 ปีที่แล้ว +1

      i guess you need to add
      spring.profiles.active: test
      to
      application.yml
      and NOT
      application-test.yml

    • @bishwajitvikram3794
      @bishwajitvikram3794 4 ปีที่แล้ว

      @@bikramnarayankundu2924 Suppose i have three version of the profile.
      1. Dev
      2. QA
      3. PROD
      i need to keep three separate files for the three env, correct me if i am wrong.
      so in that case, based on the requirement, we will add the "spring.profiles.active: test" i the file name application-test.yml
      as per the naming convention.. application-.yml
      eg:: application-test.yml, applciation-dev.yml, application-prod.yml

    • @bikramnarayankundu2924
      @bikramnarayankundu2924 4 ปีที่แล้ว

      @@bishwajitvikram3794 I guess this is wrong...
      1. Have all the files
      2. Just change the application.yml file with the property spring.profiles.active: Dev
      Or spring.profiles.active: QA
      Or spring.profiles.active: PROD

    • @bishwajitvikram3794
      @bishwajitvikram3794 4 ปีที่แล้ว +2

      @@bikramnarayankundu2924 Thanks a lot Bikram ! It worked. I git it all wrong. BTW, it working correctly.

  • @sreeshakv5405
    @sreeshakv5405 ปีที่แล้ว

    nice, thanks sir

  • @kamalkant3225
    @kamalkant3225 3 ปีที่แล้ว

    Sir how we run spring boot test from command line with profiles ?

    • @manishdas2471
      @manishdas2471 3 ปีที่แล้ว

      -Dspring.profiles.active=

  • @mohammedshabbirahmed976
    @mohammedshabbirahmed976 3 ปีที่แล้ว

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

  • @uma_r
    @uma_r 4 ปีที่แล้ว

    Wonderful ❣️

  • @SmileKaroYaar
    @SmileKaroYaar 2 ปีที่แล้ว

    Note - 11:34

  • @jithinmv6516
    @jithinmv6516 3 ปีที่แล้ว

    Perfect!

  • @romantsyupryk3009
    @romantsyupryk3009 4 ปีที่แล้ว

    Thank you so much

  • @gnanrajv
    @gnanrajv 4 ปีที่แล้ว

    Awesome

  • @刘恒-o7k
    @刘恒-o7k 3 ปีที่แล้ว

    how come you know so much about this thing, dude?

  • @MrRavihr
    @MrRavihr 4 ปีที่แล้ว

    Awesome tutorial! Thanks for putting this up!
    One confusion I still have is, you mention about having multiple configurations (as a result of multiple profiles) in one jar file at th-cam.com/video/P91tqdWUHE4/w-d-xo.html.
    But wouldn't it be ideal to separate out config from the jar files similar to th-cam.com/video/P91tqdWUHE4/w-d-xo.html because configs have a different lifecycle than the application itself. For instance, I do not need to release a new version of a jar for a config change.

    • @himanshutripathi7441
      @himanshutripathi7441 2 ปีที่แล้ว

      yes but you can override configs from environment variables.
      so for minor change you dont have to release the app.

  • @maurov2104
    @maurov2104 4 ปีที่แล้ว +5

    Spring docs are garbage, man. Fortunately, there is Java Brains to save the day

  • @mariaaasanhce
    @mariaaasanhce ปีที่แล้ว

    yhooooo

  • @wazeeharaa8100
    @wazeeharaa8100 2 ปีที่แล้ว

    Better have full screen. No value showing up you

  • @mysocial
    @mysocial 2 ปีที่แล้ว

    The density of information is very low. So much blah blah. Anyway, thanks for such video