Spring @Configuration Annotation - What are Proxy Bean Methods?

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ธ.ค. 2022
  • In this tutorial, you will learn about a property of the @Configuration annotation proxyBeanMethods. This property is set to true by default but as you will learn there are situations where you might want to set this to false.
    🔗Resources & Links mentioned in this video:
    👋🏻Connect with me:
    Website: www.danvega.dev
    Twitter: / therealdanvega
    Github: github.com/danvega
    LinkedIn: / danvega
    Newsletter: www.danvega.dev/newsletter
    SUBSCRIBE TO MY CHANNEL: bit.ly/2re4GH0 ❤️
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @mlensment
    @mlensment ปีที่แล้ว +9

    Great insight! Even though we cannot make this behaviour default, it *feels* like it should be default. Personally I’m against any “magic” in code. I like things concise and transparent and I don’t mind writing a little more code instead of using the “magic.”

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

    I always wondered about this but didn't dig much. Thanks for making it clear!

  • @mouadmuslim
    @mouadmuslim 27 วันที่ผ่านมา

    You deserve the thumb up

  • @user-wk7kd4ky6g
    @user-wk7kd4ky6g 4 หลายเดือนก่อน

    Super clear now. Thank you a lot!

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

    A nice & concise tutorial.

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

    Thanks for this tutorial Dan

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

    It's really useful information. FYI - Spring uses its own folk of CGLIB within spring-core.

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

    The explanation is clear.
    You made a small typing error in the description @Configuration :)
    Thank you for the tutorial !

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

      Sorry for that, thanks for the heads up!

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

    So cool, thanks for the video!
    So, what was the decision to introduce the proxies in the past?
    Is it considered to be a bad practice now?
    What are the situations when we cannot avoid proxies?

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

    One thing I don't get - The CGLib proxy installs a wrapper around the conf class, but doesn't modify the class itself (or so we're told in the Spring-AOP documentation, maybe I'm mixing two use cases for CGLib). So when we call restTemplate() from runService(), how does Spring make us go through the proxy (in comparison, the AOP docs specifically indicate that calls from one method of the class to another aren't being proxied)?

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

    Thanks for the cool insight!!!. If possible can you come up with @Transactional annotation specially with R2DBC. Thanks once again.

  • @TheGuroguro12
    @TheGuroguro12 10 หลายเดือนก่อน

    thank u

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

    How to use MQTT broker publish and subscribe in springboot Java & connection set up ?

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

    Can you make a video where a user cannot view and edit information of another user even when they have same role and authority using spring security and a relational database … I looked at many TH-cam channels but they also haven’t showed it .. Can you please make a video ? Thank you so very much !

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

    Thanks, I learned something new. But I noticed that the appearance of IntelliJ is different from the classic, is it a new version or a theme ?

    • @nico-s29
      @nico-s29 ปีที่แล้ว +1

      I am not so far into the Video rn but I am very sure you mean the new ui which can be activated in the settings when you use the newest intellij version

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

    Hello sir
    Can you please make video about
    How to send SMS using Java spring boot
    also mention which is community or paid version
    thanks

  • @abneruriarte1441
    @abneruriarte1441 หลายเดือนก่อน

    how do you do to have a fancy colored terminal in intellij? mine is just plane black & white :(

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

    thanks! great tutorial. Dan why you don't ever use Lombok in your videos? Is it for a better understanding of what's going on? Or it is bcoz some annotations don't work well with Spring? (IDEA sometimes suggests me avoid @Data for entities)

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

      With Records I don't really have a use for Lombok these days. Also I teach a lot of beginner material and I like to avoid having to point out something else in the middle of a tutorial If I can avoid it.

  • @Airforce_inter
    @Airforce_inter 3 หลายเดือนก่อน +1

    Why don't u use the intellij itself to initialize an spring boot project? It also adds dependencies automatically. Everything in intelij 🎉

    • @DanVega
      @DanVega  3 หลายเดือนก่อน

      I use start.spring.io because not everyone is using IntelliJ. When I am working on my projects and not recording tutorials I do use it

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

    Maybe proxyBeanMethods should be set to false by default and then give us warning to enable it if we use bean methods inside config class. If in fact it can improve performance....

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

      The problem is we can't just flip that switch because it wouldn't be backwards compatible. I think its good to understand what's going on here and make an informed decision in your code.

  • @null_user123
    @null_user123 6 วันที่ผ่านมา

    gr8

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

    74th...Thanks Dan

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

    what is your IDE name

    • @nico-s29
      @nico-s29 ปีที่แล้ว

      IntelliJ idea ultimate with New ui activated

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

    Question about @Bean public methods. Does IntelliJ not offer to remove the public modifier? Both Spring Tool Suite and the OpenRewrite best practices recipe will remove it, for reference:
    org.openrewrite.java.spring.BeanMethodsNotPublic Remove public modifier from @Bean methods. They no longer have to be public visibility to be usable by Spring.

  • @vipinkoul595
    @vipinkoul595 7 หลายเดือนก่อน +1

    Nice tutorial. As you were mentioning of "native..", could you please elaborate what does it mean in the context of this tutorial or where it's applicable ? what does it actually mean, like by flipping flag proxyBeanMethods to false does it mean the "code" would run natively, what does it mean?

    • @zombi1034
      @zombi1034 5 หลายเดือนก่อน

      I think he is talking about GraalVM Native Image Support, which turns your java application into a natively compiled system executable.