title: IllegalArgumentException: 'dataSource' or 'jdbcTemplate' is required when extending JdbcUserDetailsManager
body: <p>I´m pretty new to Spring, and I´m currently struggling with an exception being thrown when I´m attempting to extend JdbcUserDetailsManager since I need additional features besides the ones provided. The class signature looks looks like this, with a default constructor.</p>
  
  <pre><code>@Repository
  public class PrimeUserDetailsManager extends JdbcUserDetailsManager implements CustomUserDetailsManager {
  
      public static String CUSTOM_USERS_BY_USERNAME_QUERY = "select username,password,enabled from users where username like ?%";  
      public static String FIND_ALL_USERS_QUERY = "select username,password,enabled from users";
  
      @Override
      public List&lt;UserDetails&gt; loadUsersByUsername(String username) {
          return super.loadUsersByUsername(username);
      }
  
      @Override
      public List&lt;UserDetails&gt; findAllUsers() {
          return getJdbcTemplate().query(FIND_ALL_USERS_QUERY, new RowMapper&lt;UserDetails&gt;() {
              public UserDetails mapRow(ResultSet rs, int rowNum) throws SQLException {
                  String username = rs.getString(1);
                  String password = rs.getString(2);
                  boolean enabled = rs.getBoolean(3);
                  return new User(username, password, enabled, true, true, true, AuthorityUtils.NO_AUTHORITIES);
              }
          });
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>My custom Interfaces looks like this:</p>
  
  <pre><code>public interface CustomUserDetailsManager extends UserDetailsManager {
      public List&lt;UserDetails&gt; loadUsersByUsername(String username);
      public List&lt;UserDetails&gt; findAllUsers();
  }
  </code></pre>
  
  <p>Simple autowire:</p>
  
  <pre><code>@Service("userService")
  public class UserServiceImpl implements UserService{
  
      @Autowired
      public UserServiceImpl(CustomUserDetailsManager customUserDetailsManager) {
          this.customUserDetailsManager = customUserDetailsManager;
      }
  
      private CustomUserDetailsManager customUserDetailsManager;
      ....
  }
  </code></pre>
  
  <p>And in my ApplicationContext, I have this:</p>
  
  <pre><code>&lt;beans:bean id="jdbcUserService" class="org.primefaces.examples.moviecollector.custom.PrimeUserDetailsManager"&gt;
      &lt;beans:property name="dataSource" ref="dataSource"/&gt;
      &lt;beans:property name="authenticationManager" ref="authenticationManager"/&gt;
      &lt;beans:property name="enableGroups" value="true"/&gt;
      &lt;beans:property name="enableAuthorities" value="false"/&gt;
  &lt;/beans:bean&gt;
  </code></pre>
  
  <p>Still, when staring my application, I get the exception below, so apperently I must have missed something? Can someone please tell me what? </p>
  
  <p>Complete stacktrack:</p>
  
  <pre><code>2011-sep-07 13:08:49 org.apache.catalina.core.StandardContext listenerStart
  ALLVARLIG: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
  org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userBean' defined in file [C:\Program\springsource\vfabric-tc-server-developer-2.5.0.RELEASE\Localhost\wtpwebapps\prime-sweet\WEB-INF\classes\org\primefaces\examples\moviecollector\beans\UserBean.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.security.provisioning.GroupManager]: : Error creating bean with name 'primeUserDetailsManager' defined in file [C:\Program\springsource\vfabric-tc-server-developer-2.5.0.RELEASE\Localhost\wtpwebapps\prime-sweet\WEB-INF\classes\org\primefaces\examples\moviecollector\custom\PrimeUserDetailsManager.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'dataSource' or 'jdbcTemplate' is required; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'primeUserDetailsManager' defined in file [C:\Program\springsource\vfabric-tc-server-developer-2.5.0.RELEASE\Localhost\wtpwebapps\prime-sweet\WEB-INF\classes\org\primefaces\examples\moviecollector\custom\PrimeUserDetailsManager.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'dataSource' or 'jdbcTemplate' is required
      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
      at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
      at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4701)
      at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204)
      at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
      at java.lang.Thread.run(Thread.java:619)
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'primeUserDetailsManager' defined in file [C:\Program\springsource\vfabric-tc-server-developer-2.5.0.RELEASE\Localhost\wtpwebapps\prime-sweet\WEB-INF\classes\org\primefaces\examples\moviecollector\custom\PrimeUserDetailsManager.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'dataSource' or 'jdbcTemplate' is required
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
      at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
      ... 23 more
  Caused by: java.lang.IllegalArgumentException: 'dataSource' or 'jdbcTemplate' is required
      at org.springframework.jdbc.core.support.JdbcDaoSupport.checkDaoConfig(JdbcDaoSupport.java:112)
      at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
      ... 34 more
  </code></pre>
  
  <p>EDIT:
  I´ve included the entire body of PrimeUserDetailsManager above. Here´s the dataSource definition:</p>
  
  <pre><code>&lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" &gt;
      &lt;property name="driverClassName" value="${database.driver}"/&gt;
      &lt;property name="url" value="${database.url}"/&gt;
      &lt;property name="username" value="${database.username}"/&gt;
      &lt;property name="password" value="${database.password}"/&gt;
  &lt;/bean&gt;
  </code></pre>