title: Getting error "No converter found capable of converting from type java.lang.String to type org.springframework.security.core.GrantedAuthority"
body: <p>I am using Spring Boot and Spring Security in my application. I am getting the below error when I fetch user from database, even though I included all dependencies for it:</p>
  
  <blockquote>
    <p>No converter found capable of converting from type java.lang.String to type org.springframework.security.core.GrantedAuthority</p>
  </blockquote>
  
  <p>How is this caused and how can I solve it?</p>
  
  <p>My entity is </p>
  
  <pre><code>public class User {
      public static final String USERNAME = "username";
      public static final String PASSWORD = "password";
      public static final String ROLES = "roles";
  
      @Id String id;
  
      String firstName;
  
       @JsonProperty(PASSWORD)
      String password;
  
      @JsonProperty(USERNAME)
      String userName;
  
      @JsonProperty(ROLES)
      @JsonSerialize(contentUsing = GrantedAuthoritySerializer.class)
      @JsonDeserialize(contentUsing = GrantedAuthorityDeserializer.class)
      private List&lt;GrantedAuthority&gt; roles;
  
  
  
      public String getId() {
          return id;
      }
  
      public void setId(String id) {
          this.id = id;
      }
  
      public String getFirstName() {
          return firstName;
      }
  
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
  
      public String getPassword() {
          return password;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
      public String getUserName() {
          return userName;
      }
  
      public void setUserName(String userName) {
          this.userName = userName;
      }
  
       public List&lt;GrantedAuthority&gt; getRoles() {
              System.out.println("roles"+roles);
              return roles;
          }
  
       @Override
          public String toString() {
              return new ToStringBuilder(this)
                      .append("username", userName)
                      .append("password", password)
                      .append("roles", roles)
                      .toString();
          }
  </code></pre>
  
  <p>UserService</p>
  
  <pre><code>User user = userRepository.findById("5555c3e77d6e5b11dd4ff858");
  </code></pre>
  
  <p>AuthProvider</p>
  
  <pre><code>UserDetails loadedUser;
  
          System.out.println("username"+username);
  
          try {
               com.samepinch.domain.user.User samepinchuser = userService.findUserByUsername(username);
              System.out.println("samepinchuser"+samepinchuser);
              loadedUser = new User(samepinchuser.getUserName(), samepinchuser.getPassword(),samepinchuser.getRoles());
              System.out.println("loaded user"+loadedUser);
          } catch (Exception repositoryProblem) {
              throw new InternalAuthenticationServiceException(repositoryProblem.getMessage(), repositoryProblem);
          }
  </code></pre>