Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 963637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:42:07+00:00 2026-05-16T01:42:07+00:00

My app-config.xml has a definition for my UserDao bean: <bean id=userDao class=com.blah.core.db.hibernate.UserDaoImpl> <property name=sessionFactory

  • 0

My app-config.xml has a definition for my UserDao bean:

  <bean id="userDao" class="com.blah.core.db.hibernate.UserDaoImpl">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

I have my component scanning:

<context:component-scan base-package="com.blah" />

My index action in my HomeController works fine (it outputs the contents of a method on my UserService to a freemarker template).

@Controller
public class HomeController {

    @Autowired
    private UserService userService;




    @RequestMapping("/")
    public ModelAndView Index() {



        ModelAndView mav = new ModelAndView();

        mav.setViewName("index");
        mav.addObject("message", userService.sayHello());

        mav.addObject("username", userService.getTestUser());


        return mav;
    }

The ‘getTestUser()’ is a new method that makes reference to UserDao, it looks like:

@Service
public class UserServiceImpl implements UserService{

    @Autowired
    UserDao userDao;

    public String sayHello() {

        return "hello from user service impl part 2";

    }

    public String getTestUser() {


        return userDao.getById(1L).getUsername();

    }


}

I am getting the error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.blah.core.db.hibernate.UserDao com.blah.core.services.UserServiceImpl.userDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.blah.core.db.hibernate.UserDao] 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)}
  1. What could the issue be?
  2. If I didn’t do autowire, what would I be doing instead of adding the @AutoWire on the UserDao definition.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T01:42:08+00:00Added an answer on May 16, 2026 at 1:42 am

    Have you tried exporting all registered beans of Spring (or read Spring’s bootstrap log or the memory via debugging) to find out if the userDao bean is in the list. Please make sure that UserDaoImpl is really implementing UserDao too – I am pointing at this because am not seeing the snippet of UserDaoImpl here.

    If you do not use @Autowired, the alternative will be explicitly obtaining a reference of the bean through ApplicationContext’s getBean() (which is considered as a dirty way, fix your @Autowired instead), via its bean name, class name, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is my app.config <?xml version=1.0 encoding=utf-8 ?> <configuration> <system.serviceModel> <services> <service name=Indexer> <endpoint
this is my common app.config <?xml version=1.0 encoding=utf-8 ?> <configuration> <connectionStrings> <add name=BO connectionString=Data
My db-data-config.xml like this: <dataSource name=192.168.5.206 driver=com.mysql.jdbc.Driver url=jdbc:mysql://192.168.5.206:3306/editor_app user=root password=tvmining /> <dataSource name=localhost driver=com.mysql.jdbc.Driver
Little confused, the basic spring mvc app has this: app-config.xml <context:component-scan base-package=org.springframework.samples.mvc.basic /> and
My project has a netTCP WCF service. This is the app.config for it: <?xml
I have two WARS: base-overlay example-app base-overlay has XML config files in src/main/webapp/WEB-INF/spring/*.xml .
I have a WCF server which has the following app.config file: <?xml version=1.0?> <configuration>
I'm getting this error. my web.xml has this <servlet> <servlet-name>springweb</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/web-application-config.xml</param-value>
This is my App.Config <?xml version=1.0 encoding=utf-8 ?> <configuration> <appSettings> <add key=lang value=English/> </appSettings>
I have defined a config section in my app.config in the following way: <?xml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.