读书人

Spring LDAP 1.引见

发布时间: 2013-12-28 22:19:33 作者: rapoo

Spring LDAP 1.介绍
1.1. [概述]Overview

[示例方法的代码量较之普通方式编写的代码显著减少。使用LdapTemplate查询确保了上下文实例的创建,执行搜索并使用AttributesMapper映射属性到字符串对象,将字符串对象收集到List,确保NamingEnumeration和DirContext被正确关闭并小心对待可能出现的异常。]The amount of boilerplate code is significantly less than in the traditional example. The

[当然,这是Spring框架的子项目,我们需要用Spring配置我们的应用程序]Naturally?—?this being a Spring Framework sub-project?—?we will use Spring to configure our application>

[需要在XML配置文件中,引用Spring LDAP的命名空间。]In order to use the custom XML namespace for configuring the Spring LDAP components you need to include references to this namespace in your XML declaration as in the example above.

1.3. [2.0版本新特性]What’s new in 2.0?

[保证兼容性的前提下,新版本加入了很多新特性,除了极少数例外情况,使用1.3.X版本的代码不经改动就可以使用2.0的类库。]While quite significant modernizations have been made to the Spring LDAP API in version 2.0, great care has been taken to ensure backward compatibility as far as possible. Code that works with Spring LDAP 1.3.x should with very few exceptions still compile and run using the 2.0 libraries without any modifications whatsoever.

[少量非公共API的代码改变了包路径,如果有一个Spring LDAP中的类cannot be found,需要更新IDE中对包的引用配置。]The exception is a small number of classes that have been moved to new packages in order to make a couple of important refactorings possible. The moved classes are typically not part of the intended public API, and the migration procedure should be very smooth - wherever a Spring LDAP class cannot be found after upgrade, just organize the imports in your IDE.

[你可能会遇到一些已废弃的方法,建议替换为新版本中相同功能的方法。]You will probably encounter some deprecation warnings though, and there are also a lot of other API improvements. The recommendation for getting as much as possible out of the 2.0 version is to move away from the deprecated classes and methods and migrate to the new, improved API utilities.

[下面是2.0版本中一些比较重要的改进]Below is a list of the most important changes in Spring LDAP 2.0.

  • [Spring LDAP 2.0及以后的版本依赖Java 6]Java 6 is now required by Spring LDAP. Spring versions starting at 2.0 and up are still supported.

  • [API已支持Java5的新特性,如范型和可变参数。因此spring-ldap-tiger模块已经被弃用,建议使用新版本的LDAP操作类。核心接口的参数设置会导致大量的现有代码编译警告,而API的用户被鼓励采取适当的行动来摆脱这些警告。]The central API has been updated with Java 5+ features such as generics and varargs. As a consequence, the entirespring-ldap-tiger?module has been deprecated and users are encouraged to migrate to use the core Spring LDAP classes. The parameterization of the core interfaces will cause lots of compilation warnings on existing code, and users of the API are encouraged to take appropriate action to get rid of these warnings.

  • [ODM转为核心代码并且LdapOperations/LdapTemplate中提供了新的方法]The ODM (Object-Directory Mapping) functionality has been moved to core and there are new methods inLdapOperations/LdapTemplate?that use this automatic translation to/from ODM-annotated classes. See?Object-Directory Mapping (ODM)?for more information.

  • A custom XML namespace is now (finally) provided to simplify configuration of Spring LDAP. See?Configuration?for more information.

  • Spring Data Repository and QueryDSL support is now provided in Spring LDAP. See?Spring LDAP Repositories?for more information.

  • Name?instances as attribute values are now handled properly with regards to distinguished name equality in?DirContextAdapter?and ODM. See?DirContextAdapter and Distinguished Names as Attribute Values.?and?ODM and Distinguished Names as Attribute Values.?for more information.

  • DistinguishedName?and associated classes have been deprecated in favor of standard Java?LdapName. See?Dynamically Building Distinguished Names?for information on how the library helps working with?LdapNames.

  • Fluent LDAP query building support has been added. This makes for a more pleasant programming experience when working with LDAP searches in Spring LDAP. See?Building LDAP Queries?and?Advanced LDAP Queries?for more information about the LDAP query builder support.

  • The old?authenticate?methods in?LdapTemplate?have been deprecated in favor of a couple of new?authenticate?methods that work with?LdapQuery?objects and?throw exceptions?on authentication failure, making it easier for the user to find out what caused an authentication attempt to fail.

  • The?samples?have been polished and updated to make use of the features in 2.0. Quite a bit of effort has been put into providing a useful example of an?LDAP user management application.

    ?

读书人网 >编程

热点推荐