Thursday, 15 March 2012

java - Using spring-configuration without creating a spring dependency for your clients -


If I use spring configuration to make an object, will it be for me to import this object to customers Is it possible to institute my spring configuration without the need?

If this can not be done, then does a client always need to use spring to use any client who uses Spring?

If this can be done, then what is the right way to do it? Something like this ...

Library Code:

  Public MyFactor () {@Autowired InitializedObject obj public getInstance () {obj; }}   

Customer Code: Import com.code.package.something.myfactory.MyFactory; ... initial object obj = MyFactory.getInstance ();

One option is to completely avoid spring annotations, Working with Constructor or Setter-based injection In this way, your classes become independent of the Spring Code and your customer can use your code as long as it provides dependency using the factory or whatever.

No comments:

Post a Comment