BeanCreationException after fixing namespace issues


This is a follow up question for <a href="https://stackoverflow.com/questions/42941003/org-xml-sax-saxparseexceptioncvc-complex-type-2-4-c-the-matching-wildcard-is-s" rel="nofollow">org.xml.sax.SAXParseException;cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found</a> The issue in that question is fixed but i'm now seeing BeanCreationException for stuff that was working before I made the change.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employeeService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.mail.SimpleMailMessage com.xxx.service.EmployeeService.templateMessage; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.mail.SimpleMailMessage] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

My REST controller is annotated this way

@RestController public class EmployeeController

And my service

@Service("employeeService") public class EmployeeService


add this/similar in your applicationContext xml file.

<bean id="simpleMailMessage" class="org.springframework.mail.SimpleMailMessage"> <property name="from" value="from@no-spam.com" /> <property name="to" value="to@no-spam.com" /> <property name="subject" value="Testing Subject" /> <property name="text"> <value> <![CDATA[ Dear %s, Mail Content : %s ]]> </value> </property> </bean>


Have you enabled the component scanning in Spring ?

Also below is an example of how your bean-configuration should be :

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean id="customerService" class="com.abc.customer.services.CustomerService"> <property name="customerDAO" ref="customerDAO" /> </bean> enter code here <bean id="customerDAO" class="com.abc.customer.dao.CustomerDAO" /> </beans>


  • Spring MVC: @Value annotation to get int value defined in *.properties file
  • Spring @Profile works on class, but not on @Bean
  • hibernate validator without using autowire
  • Spring factory-method=“aspectOf” is not working when we deploy the application from RAD
  • java.lang.VerifyError when deploying the new version of my Java EE web application
  • How to use autowiring and package as a jar
  • Using MVC type conversion for path variable and returning 404 on null parameter
  • @JsonIgnoreProperties(ignoreUnknown=false) is not working in Spring 4.2.0 and upper version
  • Access session scoped variable in spring interceptor
  • How to use SpEL to inject result of method call in Spring?
  • Spring-boot application-test.properties
  • Why the event AbstractAuthenticationFailureEvent is never triggered in spring security?
  • Neither BindingResult nor plain target object for bean name 'userProfile' available as req
  • Help translating Reflector deconstruction into compilable code
  • How to best manage SMTP clients
  • auth.provider is not set to 'password' when user signs-in with email and password
  • Getting unread count in Sent Folder using Google Apps Script - GMail
  • How to convert integer to string and get length of string
  • Bad interaction between Zope2 XML-RPC and AT Image mutator?
  • Blackberry 6: how to detect a long click on track pad?
  • How to pass nginx proxy url for socket
  • Salesforce Different WSDL files and when to use
  • Unable to install Git-core+svn by MacPorts
  • Specifying Castle WCF Integration Facility Endpoint Behavior per Endpoint
  • How do I exclude a dependency in provided scope when running in Maven test scope?
  • Email verification using google app script and google forms
  • Linq Objects Group By & Sum
  • Retrieving value from sql ExecuteScalar()
  • Is there a amazon webstore API for customers?
  • output of program is not same as passed argument
  • Javascript + PHP Encryption with pidCrypt
  • Circular dependency while pushing http interceptor
  • KeystoneJS: Relationships in Admin UI not updating
  • Hits per day in Google Big Query
  • Angular 2 constructor injection vs direct access
  • Getting Messege Twice Using IMvxMessenger
  • sending mail using smtp is too slow
  • Checking variable from a different class in C#
  • How can i traverse a binary tree from right to left in java?
  • How can I use threading to 'tick' a timer to be accessed by other threads?