简体   繁体   中英

Using Spring packages as external libraries

I store all the person information in LDAP. But i must also handle them as Java objects.

I concern an object and look for every attribute, check if the attribute exists for that object and set it to my Java object. I do this for several object types. This seems to me ugly according to OOP concepts. I have found a Spring package do what i need ( Spring ODM ), but i do not want my application to have a Spring context. Is it possible to use Spring classes and methods like an external library without having context? Thanks.

This depends on what exactly you want to use from Spring. If you can feed all the dependencies of that class (parameters in its constructor), and it compiles without having other Spring jars on your classpath, there is a good chance you can use it.

But just as an FYI, Spring Ldap is kind of a dead project, and there are other libraries that you can use for Object-Directory Mapping. Especially if your project doesn't depend on Spring otherwise, you might want to consider using eg the UnboundID LDAP SDK instead which provides the same kind of facility . Probably you can use it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM