Thursday, 6 February 2020

getClass info may not correct when proxied (in Spring framework)

Say we have a class MyClass.java, and its instance myObject, normally,
myObject.getClass() and MyClass.class are two ways we get the class info, but sometimes the first one does not work when the instance is a proxy not the original one.

When we use Spring framework, if the instance is a Spring bean and been proxied already, the .getClass() may not return a correct Class object but the proxy one, so using MyClass.class as your first choice.

4 comments:

  1. Java Training institute Coimbatore I am mani lives in Chennai. I have read your blog, its really useful for me. I did java development course in coimbatore at reputed java training course and Certification this is useful for me to make a bright career in IT industry. So If anyone want to get best vist Qtree Technologies.

    ReplyDelete
  2. Breakup is certainly painful and no one wants to go through it. But still if you had a breakup due to any reason, you can still get your ex back, I just got my husband back through the help of genuine love spell caster called dr unity. My name is Emily Sarah am from Tx,USA. My husband left me for another woman, This was just 3 years of our marriage. The most painful thing is that I was pregnant with our second baby. I wanted him back. I did everything within my reach to bring him back but all was in vain, I wanted him back so badly because of the love I had for him, I begged him with everything, I made promises but he refused. I explained my problem to my friend and she suggested that I should rather contact a spell caster that could help me cast a spell to bring him back , I had no choice than to try it. I messaged the spell caster called dr unity, and he assured me there was no problem and that everything will be okay before 11 hours. He cast the spell and surprisingly 11 hours later my husband called me. I was so surprised, I answered the call and all he said was that he was so sorry for everything that had happened He wanted me to return to him. He also said he loved me so much. I was so happy and went to him that was how we started living together happily again.thanks to dr unity . if you are here and your Lover is turning you down, or your husband moved to another woman, do not cry anymore, contact Dr.Unity for help now..Here his contact..WhatsApp him: +2348055361568 ,
    Email him at: Unityspelltemple@gmail.com
    ,Watch this YouTube channel to know how grateful I am https://youtube.com/shorts/rBPtBktMmtA?feature=share

    ReplyDelete
  3. All thanks to Mr Anderson Carl for helping with my profits and making my fifth withdrawal possible. I'm here to share an amazing life changing opportunity with you. its called Bitcoin / Forex trading options. it is a highly lucrative business which can earn you as much as $2,570 in a week from an initial investment of just $200. I am living proof of this great business opportunity. If anyone is interested in trading on bitcoin or any cryptocurrency and want a successful trade without losing notify Mr Anderson Carl now on Whatsapp: +1(252)285-2093 Email: andersoncarlassettrade@gmail.com

    ReplyDelete