Reputation: 42100
Suppose I have a Java Spring
-based client application, which sends a request to a server and process the response. It uses Command
pattern for the response processing.
Now I would like to discover and load these Commands
in run-time. How would you implement it?
I am aware of "plugin" technologies, such as JPF
and OSGI
but they look as a huge overkill for me. I am thinking about using Spring's
autowiring. Would you recommend it?
Upvotes: 5
Views: 6818
Reputation: 33004
The spring-plugin project is probably worth looking at for this need. Unlike JSPF in the accepted answer, spring-plugin is designed specifically for Spring. It touts itself as "The smallest plugin system ever" which might be debatable (I replaced my own mini-framework that was even smaller/lighter) but it's definitely easy to swallow and yet flexible.
Upvotes: 7
Reputation: 10427
If you are looking for a very nice, light and very functional plugin framework, have a look at Java Simple Plugin Framework. I have made extensive use of this and it works great.
Using Spring's autowiring, you have to consider the implications around it. eg. you can only autowire Spring Beans etc etc.
Upvotes: 6