title: Spring boot application for accessing LinkedIn data
body: <p><br/>
  Please reply to this question, I develop one spring boot application which accesses LinkedIn data but when I click on "<strong>connect to linkedIn</strong>" button the URL change from "<strong><a href="http://localhost:8080/connect/linkedin" rel="nofollow">http://localhost:8080/connect/linkedin</a></strong>" to "<strong><a href="http://localhost:8080/connect/linkedin#" rel="nofollow">http://localhost:8080/connect/linkedin#</a>!</strong>" </p>
  
  <p><strong>LinkedInController.java</strong></p>
  
  <p>package com.linkedIn;</p>
  
  <pre><code>import javax.inject.Inject;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.social.connect.ConnectionRepository;
  
  import org.springframework.social.linkedin.api.LinkedIn;
  import org.springframework.social.linkedin.api.LinkedInProfile;
  import org.springframework.social.linkedin.api.impl.LinkedInTemplate;
  import org.springframework.stereotype.Controller;
  import org.springframework.ui.Model;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  
  @Controller
  @RequestMapping("/")
  public class LinkedInController {
  
      private LinkedIn linkedIn;
      private ConnectionRepository connectionRepository;
  
      @Inject
      public LinkedInController(LinkedIn linkedIn, ConnectionRepository connectionRepository) {
          this.linkedIn = linkedIn;
          this.connectionRepository = connectionRepository;
      }
  
      @RequestMapping(method = RequestMethod.GET)
      public String helloLinkedIn(Model model) {
          if (connectionRepository.findPrimaryConnection(LinkedIn.class) == null) {
              return "redirect:/connect/linkedin";
          }
          LinkedInProfile linkedInProfile = linkedIn.profileOperations().getUserProfile();
          model.addAttribute("linkedInProfile", linkedInProfile);
          return "hello";
      }
  }
  </code></pre>
  
  <p><strong>\src\main\resources\templates\connect\linkedinConnect.html</strong> </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta charset="ISO-8859-1"&gt;&lt;/meta&gt;
          &lt;title&gt;Hello LinkedIn&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h3&gt;Connect to LinkedIn&lt;/h3&gt;
  
          &lt;form action="/connect/linkedin" method="POST"&gt;
              &lt;input type="hidden" name="scope" value="user_posts" /&gt;
              &lt;div class="formInfo"&gt;
  
                  &lt;p&gt;You aren't connected to LinkedIn yet. Click the button to
                      connect this application with your LinkedIn account.&lt;/p&gt;
              &lt;/div&gt;
              &lt;button type="submit"&gt;Connect to LinkedIn&lt;/button&gt;      
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>