title: Where do I find the org.springframework.security.oauth2.provider.DefaultOAuth2RequestFactory class?
body: <p>Does anyone know what Maven dependency contains the class org.springframework.security.oauth2.provider.DefaultOAuth2RequestFactory ?  I’m using Spring 3.2.11.RELEASE with spring-security-oauth2 (v 2.0.9.RELEASE).  I’m having trouble deploying my OAuth application.  I get the below exception …</p>
  
  <pre><code>nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.security.oauth2.provider.DefaultOAuth2RequestFactory] for bean with name 'requestFactory' defined in class path resource [META-INF/spring/oauth-configuration.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.security.oauth2.provider.DefaultOAuth2RequestFactory from [Module "deployment.ebook.war:main" from Service Module Loader]
  </code></pre>
  
  <p>I have included the following dependencies in my project …</p>
  
  <pre><code>            &lt;!-- oauth2 --&gt;
              &lt;dependency&gt;
                      &lt;groupId&gt;org.springframework.security.oauth&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-security-oauth2&lt;/artifactId&gt;
                      &lt;version&gt;${oauth.version}&lt;/version&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                      &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-security-jwt&lt;/artifactId&gt;
                      &lt;version&gt;1.0.4.RELEASE&lt;/version&gt;
              &lt;/dependency&gt;
  </code></pre>
  
  <p>Below is my Spring-OAuth configuration</p>
  
  <pre><code>&lt;http pattern="/oauth/token" create-session="stateless"
      authentication-manager-ref="clientAuthenticationManager"
      xmlns="http://www.springframework.org/schema/security"&gt;
      &lt;intercept-url pattern="/**" method="GET" access="ROLE_DENY" /&gt;
      &lt;intercept-url pattern="/**" method="PUT" access="ROLE_DENY" /&gt;
      &lt;intercept-url pattern="/**" method="DELETE" access="ROLE_DENY" /&gt;
      &lt;intercept-url pattern="/**" access="IS_AUTHENTICATED_FULLY" /&gt;
      &lt;anonymous enabled="false" /&gt;
      &lt;http-basic entry-point-ref="clientAuthenticationEntryPoint" /&gt;
      &lt;!-- include this only if you need to authenticate clients via request 
          parameters --&gt;
      &lt;custom-filter ref="clientCredentialsTokenEndpointFilter"
          after="BASIC_AUTH_FILTER" /&gt;
      &lt;access-denied-handler ref="oauthAccessDeniedHandler" /&gt;
  &lt;/http&gt;
  
  &lt;!-- The OAuth2 protected resources are separated out into their own block 
      so we can deal with authorization and error handling separately. This isn't 
      mandatory, but it makes it easier to control the behaviour. --&gt;
  &lt;http pattern="/oauth/(users|clients)/.*" request-matcher="regex"
      create-session="stateless" entry-point-ref="oauthAuthenticationEntryPoint"
      use-expressions="true" xmlns="http://www.springframework.org/schema/security"&gt;
      &lt;anonymous enabled="false" /&gt;
      &lt;intercept-url pattern="/oauth/users/([^/].*?)/tokens/.*"
          access="#oauth2.clientHasRole('ROLE_CLIENT') and (hasRole('ROLE_USER') or #oauth2.isClient()) and #oauth2.hasScope('write')"
          method="DELETE" /&gt;
      &lt;intercept-url pattern="/oauth/users/.*"
          access="#oauth2.clientHasRole('ROLE_CLIENT') and (hasRole('ROLE_USER') or #oauth2.isClient()) and #oauth2.hasScope('read')"
          method="GET" /&gt;
      &lt;intercept-url pattern="/oauth/clients/.*"
          access="#oauth2.clientHasRole('ROLE_CLIENT') and #oauth2.isClient() and #oauth2.hasScope('read')"
          method="GET" /&gt;
      &lt;intercept-url pattern="/**" access="denyAll()" /&gt;
      &lt;custom-filter ref="resourceServerFilter" before="PRE_AUTH_FILTER" /&gt;
      &lt;access-denied-handler ref="oauthAccessDeniedHandler" /&gt;
      &lt;expression-handler ref="oauthWebExpressionHandler" /&gt;
  &lt;/http&gt;
  
  &lt;!-- The OAuth2 protected resources are separated out into their own block 
      so we can deal with authorization and error handling separately. This isn't 
      mandatory, but it makes it easier to control the behaviour. --&gt;
  &lt;http pattern="/photos/**" create-session="never"
      entry-point-ref="oauthAuthenticationEntryPoint"
      access-decision-manager-ref="accessDecisionManager"
      xmlns="http://www.springframework.org/schema/security"&gt;
      &lt;anonymous enabled="false" /&gt;
      &lt;intercept-url pattern="/photos" access="ROLE_USER,SCOPE_READ" /&gt;
      &lt;intercept-url pattern="/photos/trusted/**" access="ROLE_CLIENT,SCOPE_TRUST" /&gt;
      &lt;intercept-url pattern="/photos/user/**" access="ROLE_USER,SCOPE_TRUST" /&gt;
      &lt;intercept-url pattern="/photos/**" access="ROLE_USER,SCOPE_READ" /&gt;
      &lt;custom-filter ref="resourceServerFilter" before="PRE_AUTH_FILTER" /&gt;
      &lt;access-denied-handler ref="oauthAccessDeniedHandler" /&gt;
  &lt;/http&gt;
  
  &lt;!-- The OAuth2 protected resources are separated out into their own block 
      so we can deal with authorization and error handling separately. This isn't 
      mandatory, but it makes it easier to control the behaviour. --&gt;
  &lt;http pattern="/me/**" create-session="never"
      entry-point-ref="oauthAuthenticationEntryPoint"
      access-decision-manager-ref="accessDecisionManager"
      xmlns="http://www.springframework.org/schema/security"&gt;
      &lt;anonymous enabled="false" /&gt;
      &lt;intercept-url pattern="/me" access="ROLE_USER,SCOPE_READ" /&gt;
      &lt;custom-filter ref="resourceServerFilter" before="PRE_AUTH_FILTER" /&gt;
      &lt;access-denied-handler ref="oauthAccessDeniedHandler" /&gt;
  &lt;/http&gt;
  
  &lt;http access-denied-page="/login.jsp?authorization_error=true"
      disable-url-rewriting="true" xmlns="http://www.springframework.org/schema/security"&gt;
      &lt;intercept-url pattern="/oauth/**" access="ROLE_USER" /&gt;
      &lt;intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" /&gt;
  
      &lt;form-login authentication-failure-url="/login.jsp?authentication_error=true"
          default-target-url="/index.jsp" login-page="/login.jsp"
          login-processing-url="/login.do" /&gt;
      &lt;logout logout-success-url="/index.jsp" logout-url="/logout.do" /&gt;
      &lt;anonymous /&gt;
  &lt;/http&gt;
  
  &lt;bean id="oauthAuthenticationEntryPoint"
      class="org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint"&gt;
      &lt;property name="realmName" value="sparklr2" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="clientAuthenticationEntryPoint"
      class="org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint"&gt;
      &lt;property name="realmName" value="sparklr2/client" /&gt;
      &lt;property name="typeName" value="Basic" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="oauthAccessDeniedHandler"
      class="org.springframework.security.oauth2.provider.error.OAuth2AccessDeniedHandler" /&gt;
  
  &lt;bean id="clientCredentialsTokenEndpointFilter"
      class="org.springframework.security.oauth2.provider.client.ClientCredentialsTokenEndpointFilter"&gt;
      &lt;property name="authenticationManager" ref="clientAuthenticationManager" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="accessDecisionManager" class="org.springframework.security.access.vote.UnanimousBased"
      xmlns="http://www.springframework.org/schema/beans"&gt;
      &lt;constructor-arg&gt;
          &lt;list&gt;
              &lt;bean class="org.springframework.security.oauth2.provider.vote.ScopeVoter" /&gt;
              &lt;bean class="org.springframework.security.access.vote.RoleVoter" /&gt;
              &lt;bean class="org.springframework.security.access.vote.AuthenticatedVoter" /&gt;
          &lt;/list&gt;
      &lt;/constructor-arg&gt;
  &lt;/bean&gt;
  
  &lt;authentication-manager id="clientAuthenticationManager"
      xmlns="http://www.springframework.org/schema/security"&gt;
      &lt;authentication-provider user-service-ref="clientDetailsUserService" /&gt;
  &lt;/authentication-manager&gt;
  
  &lt;authentication-manager alias="authenticationManager"
      xmlns="http://www.springframework.org/schema/security"&gt;
      &lt;authentication-provider&gt;
          &lt;user-service id="userDetailsService"&gt;
              &lt;user name="marissa" password="koala" authorities="ROLE_USER" /&gt;
              &lt;user name="paul" password="emu" authorities="ROLE_USER" /&gt;
          &lt;/user-service&gt;
      &lt;/authentication-provider&gt;
  &lt;/authentication-manager&gt;
  
  &lt;bean id="clientDetailsUserService"
      class="org.springframework.security.oauth2.provider.client.ClientDetailsUserDetailsService"&gt;
      &lt;constructor-arg ref="clientDetails" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="tokenStore"
      class="org.springframework.security.oauth2.provider.token.store.JdbcTokenStore"&gt;
      &lt;constructor-arg ref="dataSource" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="tokenServices"
      class="org.springframework.security.oauth2.provider.token.DefaultTokenServices"&gt;
      &lt;property name="tokenStore" ref="tokenStore" /&gt;
      &lt;property name="tokenEnhancer" ref="tokenEnhancer" /&gt;
      &lt;property name="supportRefreshToken" value="true" /&gt;
      &lt;property name="clientDetailsService" ref="clientDetails" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="tokenEnhancer"
      class="org.springframework.security.oauth2.provider.token.TokenEnhancer" /&gt;
  
  &lt;bean id="requestFactory"
      class="org.springframework.security.oauth2.provider.DefaultOAuth2RequestFactory"&gt;
      &lt;constructor-arg name="clientDetailsService" ref="clientDetails" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="userApprovalHandler"
      class="org.springframework.security.oauth.examples.sparklr.oauth.SparklrUserApprovalHandler"&gt;
      &lt;property name="approvalStore" ref="approvalStore" /&gt;
      &lt;property name="clientDetailsService" ref="clientDetails" /&gt;
      &lt;property name="requestFactory" ref="requestFactory" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="approvalStore"
      class="org.springframework.security.oauth2.provider.approval.TokenApprovalStore"&gt;
      &lt;property name="tokenStore" ref="tokenStore" /&gt;
  &lt;/bean&gt;
  
  &lt;oauth:authorization-server
      client-details-service-ref="clientDetails" token-services-ref="tokenServices"
      user-approval-handler-ref="userApprovalHandler"&gt;
      &lt;oauth:authorization-code /&gt;
      &lt;oauth:implicit /&gt;
      &lt;oauth:refresh-token /&gt;
      &lt;oauth:client-credentials /&gt;
      &lt;oauth:password /&gt;
  &lt;/oauth:authorization-server&gt;
  
  &lt;oauth:resource-server id="resourceServerFilter"
      resource-id="sparklr" token-services-ref="tokenServices" /&gt;
  
  &lt;oauth:client-details-service id="clientDetails"&gt;
      &lt;oauth:client client-id="my-trusted-client"
          authorized-grant-types="password,authorization_code,refresh_token,implicit"
          authorities="ROLE_CLIENT, ROLE_TRUSTED_CLIENT" scope="read,write,trust"
          access-token-validity="60" /&gt;
      &lt;oauth:client client-id="my-trusted-client-with-secret"
          authorized-grant-types="password,authorization_code,refresh_token,implicit"
          secret="somesecret" authorities="ROLE_CLIENT, ROLE_TRUSTED_CLIENT" /&gt;
      &lt;oauth:client client-id="my-client-with-secret"
          authorized-grant-types="client_credentials" authorities="ROLE_CLIENT"
          scope="read" secret="secret" /&gt;
      &lt;oauth:client client-id="my-less-trusted-client"
          authorized-grant-types="authorization_code,implicit" authorities="ROLE_CLIENT" /&gt;
      &lt;oauth:client client-id="my-less-trusted-autoapprove-client"
          authorized-grant-types="implicit" authorities="ROLE_CLIENT" scope="read,write,trust"
          autoapprove="true" /&gt;
      &lt;oauth:client client-id="my-client-with-registered-redirect"
          authorized-grant-types="authorization_code,client_credentials"
          authorities="ROLE_CLIENT" redirect-uri="http://anywhere?key=value"
          scope="read,trust" /&gt;
      &lt;oauth:client client-id="my-untrusted-client-with-registered-redirect"
          authorized-grant-types="authorization_code" authorities="ROLE_CLIENT"
          redirect-uri="http://anywhere" scope="read" /&gt;
      &lt;oauth:client client-id="tonr" resource-ids="sparklr"
          authorized-grant-types="authorization_code,implicit" authorities="ROLE_CLIENT"
          scope="read,write" secret="secret" /&gt;
      &lt;oauth:client client-id="tonr-with-redirect"
          resource-ids="sparklr" authorized-grant-types="authorization_code,implicit"
          authorities="ROLE_CLIENT" scope="read,write" secret="secret"
          redirect-uri="${tonr.redirect:http://localhost:8080/tonr2/sparklr/redirect}" /&gt;
  &lt;/oauth:client-details-service&gt;
  </code></pre>