Mastering spring bean not found and/or bean creating exceptions

Hello guys

As of today, I decided to talk about a few of important points of Spring in general. As you know bean definition itself does take a big part in Spring environment. I have been a newbie in Spring’s world and working on this big framework for around 4 months by now with no past experience and senior above me who can teach me or lead me to the solution while facing spring related issues.

Long story short, especially today I’ve realized that in most of spring exceptions or errors I was making huge mistakes and they are actually very simple to sort out. The intention of writing this post is to give you some important points which will help you of a big time in the future spring aided developments.

Precautions:

  1. While defining namespaces, first of all make sure that include the namespaces which will be used in your applcations, for example if you are not going to use tx(spring transactions, mostly used along with Hibernate), do not include it, the other important point is that do not imply the version, because this leads the version mismatch issues in the future or at the time you work on your application. This is also suggested by Spring as well(Sorry I could not have found the article I read previously, promise as soon as I find it will include it!)
  2. When you face crazy bean exceptions the first thing you should be checking is to ensure that your spring configuration xmls are loaded up. Today I realized that my applicationContext.xml was included but mvc-dispatcher-servlet.xml was not loaded, so that I had to name my service annotations or anything. Also had difficulty with Spring 3 and Hibernate 4 integration at work.

So far these two points are important. It is not much but in the future I will be adding more elements on my list and keep it up-to-date.

Leave a Reply

Your email address will not be published. Required fields are marked *