Spring-LDAP前言
[Java命名和目录接口(JNDI)相当于SQL编程中的JDBC。两者有一些相似之处,尽管API风格迥异并且有不同的优缺点,他们都有以下几个不讨喜的特点:]The Java Naming and Directory Interface (JNDI) is for LDAP programming what Java Database Connectivity (JDBC) is for SQL programming. There are several similarities between JDBC and JNDI/LDAP (Java LDAP). Despite being two completely different APIs with different pros and cons, they share a number of less flattering characteristics:
[即使进行简单操作也需要大量编码。]They require extensive plumbing code, even to perform the simplest of tasks.
[不管出现什么情况都要关闭资源。]All resources need to be correctly closed, no matter what happens.
[异常很难处理。]Exception handling is difficult.
[以上几点导致API大量重复的方法,代码重复的恶劣性质众人皆知。总而言之,JDBC和LDAP编程在Java中非常枯燥乏味并且重复工作量多。]The above points often lead to massive code duplication in common usages of the APIs. As we all know, code duplication is one of the worst code smells. All in all, it boils down to this: JDBC and LDAP programming in Java are both incredibly dull and repetitive.
[Spring框架中核心组件Spring JDBC极好的简化了SQL编程。我们需要一个类似的,简化Java LDAP编程的框架。]Spring JDBC, a core component of Spring Framework, provides excellent utilities for simplifying SQL programming. We need a similar framework for Java LDAP programming.