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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:19:09+00:00 2026-06-10T23:19:09+00:00

I keep receiving the exception with a message: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘userDetailsService’ is

  • 0

I keep receiving the exception with a message: “org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘userDetailsService’ is defined” even though the bean is defined as a service in the UserDetailsServiceImpl class. Such as:

@Service(value="userDetailsService")
public class UserDetailsServiceImpl implements UserDetailsService{

I am using the latest Spring and Spring Security.

I am not sure what I am doing wrong. I am pasting the configuration of my spring xml files. The spring-security.xml shows that it can find beans from the servlet-context.xml when using the component-scan.

Thank you

org.springframework.beans.factory.BeanCreationException: Error creating bean with name org.springframework.security.filterChains': Cannot resolve reference to bean org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property sourceList' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot resolve reference to bean org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0' while setting constructor argument with key [2]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0': Cannot resolve reference to bean org.springframework.security.authentication.ProviderManager#0' while setting bean property authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name org.springframework.security.authentication.ProviderManager#0': Cannot resolve reference to bean 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name org.springframework.security.authenticationManager': Cannot resolve reference to bean org.springframework.security.authentication.dao.DaoAuthenticationProvider#0' while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name org.springframework.security.authentication.dao.DaoAuthenticationProvider#0': Cannot resolve reference to bean 'userDetailsService' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'userDetailsService' is defined

spring-security.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="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-3.0.xsd
       http://www.springframework.org/schema/security
       http://www.springframework.org/schema/security/spring-security-3.1.xsd">


<beans:import resource="classpath*:servlet-context.xml"/> 

<global-method-security secured-annotations="enabled"></global-method-security>    

<http auto-config="true" >
    <!-- Filtering url patterns -->

    <!-- Anonymous users -->
    <intercept-url pattern="/" access="IS_AUTHENTICATED_ANONYMOUSLY" />
    <intercept-url pattern="/login*" access="IS_AUTHENTICATED_ANONYMOUSLY" />

    <!-- Login and logout controls -->
    <form-login login-page="/login" default-target-url="/profile"
        authentication-failure-url="/loginfailed" />
    <logout invalidate-session="true" logout-success-url="/"
        delete-cookies="JSESSIONID" />

</http>

<beans:bean id="authenticationProvider"
    class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
    <beans:property name="userDetailsService" ref="userDetailsService"/>
</beans:bean>



<beans:bean id="authenticationManager"
    class="org.springframework.security.authentication.ProviderManager">
    <beans:property name="providers">
        <beans:list>
            <beans:ref local="authenticationProvider" />
        </beans:list>
    </beans:property>
</beans:bean>

<authentication-manager>
    <authentication-provider user-service-ref="userDetailsService">
    </authentication-provider>
</authentication-manager>    

servlet-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">


<annotation-driven />

<resources mapping="/resources/**" location="/resources/" />

<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <beans:property name="prefix" value="/WEB-INF/views/" />
    <beans:property name="suffix" value=".jsp" />
</beans:bean>

                                              <!-- Data source configuration -->

<!-- JDBC configuration for ORM -->
<beans:bean id="dbDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
   <beans:property name="driverClassName" value="com.mysql.jdbc.Driver"/>
   <beans:property name="url" value="jdbc:mysql://localhost:3306/dbName"/>
   <beans:property name="username" value="root"/>
   <beans:property name="password" value=""/>
</beans:bean>   

<!-- Hibernate session Factory -->
<beans:bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
   <beans:property name="dataSource" ref="dbDataSource" />

   <!-- All the model packages with hibernate annotations that need to be scanned. -->
   <beans:property name="packagesToScan">
       <beans:value>
           com.package.registration.models
       </beans:value>
   </beans:property>

   <!-- Hibernate specific properties -->
   <beans:property name="hibernateProperties">
       <beans:props>
           <beans:prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</beans:prop>
           <beans:prop key="hibernate.show_sql">true</beans:prop>
           <beans:prop key="hibernate.format_sql">true</beans:prop>
           <beans:prop key="hibernate.hbm2ddl.auto">update</beans:prop>
           <beans:prop key="org.hibernate.transaction">true</beans:prop>
       </beans:props>
   </beans:property>
</beans:bean>

<!-- A transaction manager for working with Hibernate SessionFactories -->
<beans:bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
    <beans:property name="sessionFactory" ref="sessionFactory"/>
</beans:bean>

<tx:annotation-driven transaction-manager="transactionManager" />

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

  • 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-10T23:19:11+00:00Added an answer on June 10, 2026 at 11:19 pm

    You need to put a component scan in your other Spring config file, not just the servlet config.

    They’re different contexts, one loaded by the context loader listener, one by the dispatcher servlet.

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

Sidebar

Related Questions

We keep receiving this exception on Cruise Control, and it says the build failed,
I keep receiving this error... [2012-06-14 11:54:50,072: ERROR/MainProcess] Hard time limit (300s) exceeded for
I'm trying to implement my own GenericIdentity implementation but keep receiving the following error
The error that I keep on receiving when running a regression uite, can someone
I've just lauched a HTML5 game application, and I keep receiving ' object doesn't
I keep receiving a C2664 conversion error in visual studio It tells me that
I keep on receiving odd unexpected values for my bool testValue . I keep
I am keep receiving this error on my magento pages in frontend and back-end.
I'm new to javascript/jquery. I have the following basic code and I keep receiving
I keep receiving the following error when attempting to unmarshall an xml document 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.