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 8077851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:36:17+00:00 2026-06-05T15:36:17+00:00

I am trying to create a bean and than trying to inject the same

  • 0

I am trying to create a bean and than trying to inject the same in my Controller but i am getting bean creation failure error.Here is my code

@Service("springSecurityLoginServiceImpl")
public class SpringSecurityLoginServiceImpl implements SpringSecurityLoginService
{
  //impl
}

this is how i am trying to inject it in my controller

@Controller
@RequestMapping("springSecurity/login.json")
public class SpringSecurityLoginController
{
    @Autowired
    @Qualifier("springSecurityLoginServiceImpl")
    SpringSecurityLoginService springSecurityLoginService;

}

There is no entry in Spring-MVC-config xml file except these annotation, but when i am starting server facing the following exception

org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0'
 defined in ServletContext resource [/WEB-INF/config/spring-mvc-config.xml]: 
 Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: 
 Error creating bean with name 'springSecurityLoginController': 
 Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: 
 Could not autowire field: com.core.servicelayer.user.SpringSecurityLoginService com.storefront.controllers.pages.SpringSecurityLoginController.springSecurityLoginService; 
 nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: 
 No matching bean of type [com.core.servicelayer.user.SpringSecurityLoginService] 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),
 @org.springframework.beans.factory.annotation.Qualifier(value=springSecurityLoginServiceImpl)}

i am not sure what i am doing wrong or what extra i have to do

  • 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-06-05T15:36:19+00:00Added an answer on June 5, 2026 at 3:36 pm

    SpringSecurityLoginController class refers SpringSecurityLoginService class, for which a bean isn’t defined. That much the error says.

    It is true, because you’ve only defined a bean for the class LoginServiceImpl, which doesn’t seem to extend SpringSecurityLoginService in any way.

    Spring’s bean lookup algorithm first searches for beans of which type is, or extends, SpringSecurityLoginService. Then, it narrows the avaialble options using the Qualifier. In this case, no bean is found in the first place…

    See Spring doc:

    4.11.3 Fine-tuning annotation-based autowiring with qualifiers

    Since autowiring by type may lead to multiple candidates, it is often
    necessary to have more control over the selection process. One way to
    accomplish this is with Spring’s @Qualifier annotation. This allows
    for associating qualifier values with specific arguments, narrowing
    the set of type matches so that a specific bean is chosen for each
    argument.

    You need that LoginServiceImpl will implement SpringSecurityLoginService, for instance.

    EDIT

    Since it was just a typo you might be not including SpringSecurityLoginService‘s package in component-scan tag, in your spring configuration file (as gkamal has already mentioned). You should have there something like:

    <context:component-scan base-package="org.example"/>
    

    where org.example should be replaced by SpringSecurityLoginService‘s package.

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

Sidebar

Related Questions

I'm trying to create a JNDI bean in an application, but an error Cannot
I'm trying to create a service bean that when referenced will be initialized with
I'm trying to autowire a bean in the MVC Controller class, but I can
I was trying to create Hibernate Validator bean, and run into this problem creating
I'm trying to create an Hello World JSF application. I have a bean with
Ok so I am trying create a login script, here I am using PHP5
Trying to create a black line in my view to separate text blocks but
Trying to create a new Dedicated Cache Role in Windows Azure but get the
I'm trying to create a multiaction web controller using Spring annotations. This controller will
Within my web application, I am trying to create a directory polling bean using

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.