title: Spring security using JPA. How to configure applicationContext-security.XML file?(using DaoAuthenticationProvider)
body: <p>I was using JDBC Authentication service for my security.
  code of authentication provider is ,</p>
  
  <pre><code>&lt;authentication-provider&gt;
      &lt;jdbc-user-service id="userDetailsService" data-source-ref="dataSource" /&gt;
  &lt;/authentication-provider&gt;
  </code></pre>
  
  <p>And for data source,</p>
  
  <pre><code>&lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" &gt;
    &lt;property name="driverClassName" value="com.mysql.jdbc.Driver" /&gt; 
    &lt;property name="url" value="jdbc:mysql://localhost:3306/demodata" /&gt; 
    &lt;property name="username" value="root"/&gt; 
    &lt;property name="password" value="root"/&gt; 
  &lt;/bean&gt;
  </code></pre>
  
  <p>Also I was using <strong>daoAuthenticationProvider</strong> , code of that is,</p>
  
  <pre><code>&lt;beans:bean id="daoAuthenticationProvider" class="org.springframework.security.providers.dao.DaoAuthenticationProvider"&gt;
    &lt;property name="userDetailsService" ref="userDetailsService"/&gt;
    &lt;property name="saltSource" ref bean="saltSource"/&gt;
    &lt;property name="passwordEncoder" ref="passwordEncoder"/&gt;
  &lt;/beans:bean&gt;
  </code></pre>
  
  <p>And It was working properly.
  Now I want to use <strong>JPA</strong> connection instead of <strong>JDBC</strong>.
  So I Created new class <strong>CustomUserDetailsService</strong> which <strong>implements UserDetailsService</strong> Interface. Now My authentication provider looks like,</p>
  
  <pre><code>&lt;authentication-provider  user-service-ref="CustomUserDetailsService"&gt;
  &lt;/authentication-provider&gt;
  &lt;beans:bean id="CustomUserDetailsService" class="com.service.CustomUserDetailsService" /&gt;
  </code></pre>
  
  <p>Authentication manager's code :</p>
  
  <pre><code>&lt;beans:bean id="authenticationManager"
          class="org.springframework.security.providers.ProviderManager"&gt;
          &lt;beans:property name="providers"&gt;&lt;beans:list&gt;
                  &lt;beans:ref local="daoAuthenticationProvider" /&gt;
          &lt;/beans:list&gt; &lt;/beans:property&gt;
          &lt;beans:property name="sessionController"
              ref="defaultConcurrentSessionController" /&gt;
  &lt;/beans:bean&gt;
  </code></pre>
  
  <p>Problem is that, Now how do I give its reference in <strong>daoAuthenticationProvider's property userDetailsService</strong>?
  Thank you in advance. (I can provide more information if needed)</p>