|
该版本仍在开发中,尚未被视为稳定。对于最新稳定版本,请使用 Spring LDAP 4.0.0! |
春季LDAP常见问题解答
作属性
我如何通过以下方式移除作属性context.removeAttributeValue()?
默认情况下,DirContextAdapter只读取可见属性。这是因为作属性只有在明确请求时服务器才会返回,而 Spring LDAP 无法知道该请求哪些属性。这意味着DirContextAdapter未包含作属性。因此,removeAttributeValue没有任何影响(因为从该角度看DirContextAdapter,它本来就不存在)。
基本上有两种方法:
-
使用以属性名称为参数的搜索或查找方法,例如
LdapTemplate#lookup(Name, String[], ContextMapper).然后使用上下文地图实现返回所提供的DirContextAdapter在mapFromContext(). -
用
LdapTemplate#modifyAttributes(Name, ModificationItem[])直接手动构建修改物品数组。