title: Spring Social Linkedin - SignIn
body: <p>I am new to Spring social and trying to config spring social signin for linkedin.</p>
  
  <p>My spring config file below,</p>
  
  <pre><code>&lt;context:component-scan base-package="com.tc.web"&gt;
  &lt;context:include-filter type="regex"
  expression="(service|controller|component)\..*" /&gt;
  &lt;/context:component-scan&gt;
  
  &lt;bean id="connectionFactoryLocator"
  class="org.springframework.social.connect.support. ConnectionFactoryRegistry"&gt;
  &lt;property name="connectionFactories"&gt;
  &lt;list&gt;
  &lt;bean
  class="org.springframework.social.linkedin.connect .LinkedInConnectionFactory"&gt;
  &lt;constructor-arg value="key........" /&gt;
  &lt;constructor-arg value="secret .........." /&gt;
  &lt;/bean&gt;
  &lt;/list&gt;
  &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="textEncryptor" class="org.springframework.security.crypto.encrypt .Encryptors"
  factory-method="noOpText" /&gt;
  
  &lt;bean id="usersConnectionRepository"
  class="org.springframework.social.connect.jdbc.Jdb cUsersConnectionRepository"&gt;
  &lt;constructor-arg ref="dataSource" /&gt;
  &lt;constructor-arg ref="connectionFactoryLocator" /&gt;
  &lt;constructor-arg ref="textEncryptor" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="connectionRepository" factory-method="createConnectionRepository"
  factory-bean="usersConnectionRepository" scope="request"&gt;
  &lt;constructor-arg value="#{request.userPrincipal.name}" /&gt;
  &lt;aop:scoped-proxy proxy-target-class="false" /&gt;
  &lt;/bean&gt;
  
  
  &lt;bean id="signInAdapter" class="com.tc.web.social.signin.SocialSignInAdapte r" /&gt;
  
  &lt;bean class="org.springframework.social.connect.web.Prov iderSignInController"&gt;
  &lt;!-- relies on by-type autowiring for the constructor-args --&gt;
  &lt;constructor-arg ref="signInAdapter" /&gt;
  &lt;property name="applicationUrl" value="link" /&gt;
  &lt;property name="signUpUrl" value="link" /&gt;
  &lt;property name="signInUrl" value="link" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>My SocialSignInAdapter.java is,</p>
  
  <p>public class SocialSignInAdapter implements SignInAdapter{</p>
  
  <pre><code>@Override
  public String signIn(String userId, Connection&lt;?&gt; connection, NativeWebRequest request) {
  System.out.println("User Id is ===&gt;&gt;&gt; "+userId);
  System.out.println("Connection is ====&gt;&gt;&gt; "+connection);
  return null;
  }
  
  }
  </code></pre>
  
  <p>In Login.jsp,</p>
  
  <pre><code>&lt;li class="linkedin"&gt;&lt;a href="${pageContext.request.contextPath}/signin/linkedin" title="LinkedIn"&gt;&amp;nbsp;&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <p>When I click the above linkedin link, i get 404 error.</p>
  
  <p>I guess my app is unable to find the ProviderSignInController for the request, ://dom:8080/myApp/signin/linkedin.</p>
  
  <p>I suspect the below config in spring xml.</p>
  
  <pre><code>&lt;context:component-scan base-package="com.tc.web"&gt;
  &lt;context:include-filter type="regex"
  expression="(service|controller|component)\..*" /&gt;
  &lt;/context:component-scan&gt;
  </code></pre>
  
  <p>I have all my controller inside the package com.tc.web. But the ProviderSignInController is in Spring package and my app is unable to find it.</p>
  
  <p>I tried the below as well.</p>
  
  <pre><code>&lt;context:component-scan base-package="com.tc.web,org.springframework.social.con nect.web"&gt;
  &lt;context:include-filter type="regex"
  expression="(service|controller|component)\..*" /&gt;
  &lt;/context:component-scan&gt;
  </code></pre>
  
  <p>I got ambigous mapping error for ProviderSignInController with the above config.
  So, I removed the</p>
  
  <pre><code>&lt;bean class="org.springframework.social.connect.web.Prov iderSignInController"&gt;
  &lt;!-- relies on by-type autowiring for the constructor-args --&gt;
  &lt;constructor-arg ref="signInAdapter" /&gt;
  &lt;property name="applicationUrl" value="link" /&gt;
  &lt;property name="signUpUrl" value="link" /&gt;
  &lt;property name="signInUrl" value="link" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>from my spring xml. But still I am getting the 404 error.</p>
  
  <p>Could anyone help me on this please ..........</p>
  
  <p>Thanks,
  Baskar.S</p>