title: Spring Ldaptemplate 2 add member to group
body: <p>what is best way to add member in group using spring LdapTemplate.
  I have successfully create user and remove user ex.
  But I'm trying to add member then I'm facing issue. </p>
  
  <p>Add Member Code:</p>
  
  <pre><code>public boolean addMemberToGroup(List&lt;String&gt; groupList, User user) {
      boolean isAddedSuccessfully=false;
      try{
          for(int i=0;i&lt;groupList.size();i++){
              Name groupDn = buildGroupDn(groupList.get(i));
              DirContextOperations ctx =   ldapTemplate.lookupContext(groupDn);
              ctx.addAttributeValue("member",buildPersonDn(user.getUid()));
              ldapTemplate.update(ctx);
              }
          isAddedSuccessfully=true;
      }
      catch(Exception e){
          isAddedSuccessfully=false;
  
      }
      return isAddedSuccessfully;
  }
  
  private Name buildGroupDn(String groupName) {
      return LdapNameBuilder.newInstance("cn=groups").add("cn", groupName).build();
  }
  
  private Name buildPersonDn(String userID) {
      return LdapNameBuilder.newInstance()
          .add("uid", userID).add("cn", "users")
          .build();
  </code></pre>
  
  <p>}</p>
  
  <blockquote>
    <p>Exception Of addMemberToGroup: Class class org.springframework.ldap.core.DirContextAdapter must have a class level interface org.springframework.ldap.odm.annotations.Entry annotation.</p>
  </blockquote>
  
  <p>please let me know what i am missing.</p>