How to fix Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException

java
exception
mailapi

(App Shah) #1

How to fix exception reported here: https://crunchify.com/java-mailapi-example-send-an-email-via-gmail-smtp/#comment-2778683139

INFO: Loading XML bean definitions from class path resource [Nani-mail.xml]
Exception in thread “main” org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘CrunchifyEmailAPI’ is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.jav…:698)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1174)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:283)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.jav…:1045)
at mailproject.CrunchifyEmailTest.main(CrunchifyEmailTest.java:22)


(pranish.shres) #2

Hello

This is a very simple and a frequently occurring error while using spring. The problem is that your IDE is not finding a proper bean object for a service, repository or an entity. Make sure that you have defined the proper bean name for the classes. If the error still occurs, try refreshing your application by selecting the project and clicking ‘F5’ button or by closing and opening the project. You can do Maven Update in eclipse. By right clicking on the project > Maven > Update Project.

Regards


(App Shah) #3

Thanks @pranish.shres.

I’m going to try it out tomorrow and update. Keep sharing experience and happy coding.


Copyright © 2018 Crunchify, LLC.  •  WordPress Services  •  Contact  •  Hosted at DiscourseHosting.