title: Use Spring Security with JPA
body: <p>I am new to Spring.</p>
  
  <p>We are using spring security feature.
  Database connectivity: eclipselink implementation of JPA.
  Database: MySql</p>
  
  <p>While using spring security, Configuration of  authentication provider is as follows,-</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>But in JPA we do not define datasource, we use Persistence unit with provider <code>jpa.PersistenceProvider.</code></p>
  
  <p>So how do we configure authentication provider so as to use JPA for database connectivity?</p>
  
  <p>What exactly should data-source-ref field contain to use database for authentication?</p>
  
  <p>Thank you in advance.</p>