Provide own instance of IPhase4PeppolIncomingSBDHandlerSPI #115
Replies: 1 comment 6 replies
-
Hi Florian, Thanks for reaching out to me. I think I understand your considerations, even though I am not a Spring expert (please bare that in mind when you read the rest of my suggestion). Making the change you suggested would mean a breaking change for all existing users. Instead I would like to suggest a different solution that just takes one more level of indirection.
With this solution, you are losing a few nanonseconds for the indirection, but finally you have an object that is fully injected and you can do whatever you need. How does that sound to you? |
Beta Was this translation helpful? Give feedback.
-
Hi Philip,
I am currently using your library in a Spring Boot Project. I have provided an implementation of the IPhase4PeppolIncomingSBDHandlerSPI Interface through SPI which is working fine.
It was however always a headache for me to do it this way because I have to use Autoinjected Dependencies in that class. That meant that I had to keep a reference to the Spring Context and manually inject my dependencies that way.
It would be way easier if I could register a Provider or Factory instance in your library which then provides an instance of my implementation for your library to use. This class can be kept completely Spring-free.
What do you think about this idea?
Beta Was this translation helpful? Give feedback.
All reactions