Announcement Announcement Module
No announcement yet.
API architecture best choice between JEE Service Provider API or SPRING Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • API architecture best choice between JEE Service Provider API or SPRING


    I'm working on a API implementation for my company,
    I made a maven module API which describe services through interfaces in a spi package, and has a Facade to get Implementation staticly hidden behing the interface.

    To be used, java applications have to depend on API jar and an IMPL jar which contains services implementations.
    My first idea was to create an ApplicationContext in my facade which expect a spring file in META-INF/Spring/ from IMPL jar and return the correct implementation staticly.

    After some research, i just learned about JAVA Service Provider API (use for example in Spring-web module) which enable to let the IMPL jar indicate the implementation of the SPI inside a file put in META-INF/services/[spi canonical name]

    My problem using this way is some of my implementation (may)use other class with differrents implementations which i at first thought to be Inject by Spring when it create the impl instance, so in the new strategy i should repeat the same process as ServiceProviderAPI again.

    My second strategy focus on the lack of coupling for my API jar with Spring has i remove the creation of ApplicationContext in the Facade, but so i lost the factory behaviour.

    Could some Java evangelist help madde the best choice between Service Provider API and Spring to answer my needs.

    Thanks in advance