18.06.2019

EJB-фасады для бинов Spring

Возникла идея сделать @Remote EJB с инъекциями из бинов на Spring. Было бы достаточно удобно - это избавляет от всякой промежуточной интеграции, цепляй удалённый бин и выполняй любую логику из Spring.

Занялся вопросом. Оказывается, раньше до Spring 5 так можно было. А сейчас есть вот такая ссылочка, в которой объясняется, почему больше нельзя.
https://github.com/spring-projects/spring-framework/issues/21361
I'm afraid this is by design: We do not support statically managed application contexts for EJB deployments anymore, as of Spring Framework 5.0, due to the unclean lifecycle and cleanup implications there. Strategically, we do not consider EJB Session Bean facades for Spring beans as a recommendable architecture anymore... and generally see EJB as an effectively deprecated technology now. We understand that there is a migration need, of course.
If you'd like to stay with that architecture for some more time, consider using a custom interceptor (based on SpringBeanAutowiringInterceptor source code if you like) managing a local ApplicationContext, possibly in interaction with an EJB 3.1 @Singleton, or a CDI-Spring bridge instead. Alternatively, you could also stay on Spring Framework 4.3.x for the time being which will remain supported for two more years at least.
Вопрос видимо в совместимости жизненных циклов бинов EJB и Spring.
Ну ок. 

Комментариев нет :