Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plugins for Java Spring application

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?

like image 247
Michael Avatar asked Jul 08 '11 10:07

Michael


People also ask

What are plugins in Spring?

Spring Plugin provides a more pragmatic approach to plugin development by providing the core flexibility of having plugin implementations extending a core system's functionality but of course not delivering core OSGi features like dynamic class loading or runtime installation and deployment of plugins.

What are plugins in spring-boot?

The Spring Boot Maven Plugin provides Spring Boot support in Apache Maven. It allows you to package executable jar or war archives, run Spring Boot applications, generate build information and start your Spring Boot application prior to running integration tests.

How do I enable Spring plugins?

To enable Spring integration, simply include struts2-spring-plugin-x-x-x. jar in your application. The framework enables “autowiring” by default. (Autowiring means to look for objects defined in Spring with the same name as your object property).


1 Answers

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.

like image 82
E-Riz Avatar answered Sep 28 '22 15:09

E-Riz