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

Поделиться
HTML-код
  • Опубликовано: 25 окт 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.

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

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

  • @harshverm776
    @harshverm776 Год назад

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

  • @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!

  • @Blueflamey
    @Blueflamey Год назад

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

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

  • @pablon3115
    @pablon3115 4 года назад +2

    Amazing. Perfect mix between theory and practice. Thanks!

  • @vinodhkumarummaneni9627
    @vinodhkumarummaneni9627 4 года назад +25

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

  • @Creeper-dc9oz
    @Creeper-dc9oz Год назад

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

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

  • @hyperborean72
    @hyperborean72 4 года назад +1

    You are doing a fantastic job Sir

  • @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👌

  • @yashpalgandhi4108
    @yashpalgandhi4108 4 года назад +2

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

  • @harshadholkar
    @harshadholkar 4 года назад +1

    Trust me this guy is a genius

  • @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!

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

  • @marekdarek7299
    @marekdarek7299 2 года назад

    Yours videos are so helpful! Thank you!

  • @jishuschannel
    @jishuschannel 4 года назад

    Lovely...very crisp and clear 👌👌

  • @kumarchandresh0
    @kumarchandresh0 4 года назад +3

    Happy Republic Day Koushik.!

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

  • @rajmiglani4159
    @rajmiglani4159 4 года назад

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

  • @sauravsrivastava9019
    @sauravsrivastava9019 3 года назад

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

  • @karthikgotrala580
    @karthikgotrala580 4 года назад +3

    Great Thank you for the video series

  • @ramlimbu2167
    @ramlimbu2167 4 года назад +1

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

  • @bogdanmazur3256
    @bogdanmazur3256 2 года назад

    Thank you for such great explanation

  • @AmittSpeaking
    @AmittSpeaking 3 года назад

    Amazing explanation!

  • @АртёмГубанов-ц3ц
    @АртёмГубанов-ц3ц 4 года назад +1

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

  • @josephnairpudupermanil8679
    @josephnairpudupermanil8679 3 года назад

    Awesome Koushik..

  • @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!?!?

  • @rbelatamas
    @rbelatamas 3 года назад

    Brilliant tutorial! Thank you so much!

  • @aleksandrkravtsov8727
    @aleksandrkravtsov8727 3 года назад

    very cool lesson 👍

  • @sonofgod00
    @sonofgod00 2 года назад

    great sir god bless you thanks for helping

  • @prabhuprasaddevanaboina3889
    @prabhuprasaddevanaboina3889 Год назад

    Very good sir.

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

  • @digvijaypatil5358
    @digvijaypatil5358 4 года назад +1

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

  • @susanpeter3950
    @susanpeter3950 2 года назад

    Super excellent..

  • @luizconrado
    @luizconrado 3 года назад

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

  • @glchiu5292
    @glchiu5292 2 года назад

    useful skills, thank you

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

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

  • @gchandrasekharreddy2907
    @gchandrasekharreddy2907 4 года назад +1

    Thanking you Guru ji.....🤝🤝

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

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

  • @manjum143
    @manjum143 4 года назад

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

  • @santhoshbasineni
    @santhoshbasineni 4 года назад +1

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

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

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

  • @-indeed8285
    @-indeed8285 4 года назад +2

    Amazing ❤

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

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

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

  • @punithgowda8890
    @punithgowda8890 3 года назад

    Very useful..feature

  • @sreeshakv5405
    @sreeshakv5405 Год назад

    nice, thanks sir

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

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

  • @menabebawy390
    @menabebawy390 2 года назад

    great, thank you

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

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

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

  • @RohitPal-lz1wf
    @RohitPal-lz1wf 3 года назад

    Please start series for AWS core services

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

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

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

  • @nolan_villeneuve
    @nolan_villeneuve 4 года назад +3

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

  • @uma_r
    @uma_r 4 года назад

    Wonderful ❣️

  • @atmiksoni5859
    @atmiksoni5859 4 года назад

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

  • @jithinmv6516
    @jithinmv6516 3 года назад

    Perfect!

  • @kamalkant3225
    @kamalkant3225 3 года назад

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

  • @gnanrajv
    @gnanrajv 4 года назад

    Awesome

  • @romantsyupryk3009
    @romantsyupryk3009 4 года назад

    Thank you so much

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

  • @mohammedshabbirahmed976
    @mohammedshabbirahmed976 3 года назад

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

  • @SmileKaroYaar
    @SmileKaroYaar 2 года назад

    Note - 11:34

  • @刘恒-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 ruclips.net/video/P91tqdWUHE4/видео.html.
    But wouldn't it be ideal to separate out config from the jar files similar to ruclips.net/video/P91tqdWUHE4/видео.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

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

  • @mariaaasanhce
    @mariaaasanhce Год назад

    yhooooo