java ee - Bean in jar inside EAR/lib folder possible? -
i have ear next structure:
myapp.ear ...meta-inf ......application.xml ...lib ......common.jar ......specialbeanlib.jar ...myejb.jar ...mywar1.war ...mywar2.war
as can see common.jar , specialbeanlib.jar in ear lib folder.
myejb.jar contains service classes. mywar1.war contains user-gui. mywar2.war contains admin-gui.
the ejb , war modules build separate maven projects , referenced in application.xml file. file specialbeanlib.jar referenced provided dependency in both web projects , normal dependency in ejb project gets stored in ear lib folder. explicitly should not own ejb module.
the question: can have beans e.g. @applicationscoped
bean, in file specialbeanlib.jar, accessible both mywar1.war , mywar2.war via @inject
?
it should fine. during compile time, since provide specialbeanlib.jar dependency in maven, should appear in classpath during compilation of mywar1 , mywar2 modules. during run-time, since speicalbeanlib.jar located in ear\lib folder, @ parent classloader of war classloaders, bean class should loaded fine too.
java-ee dependency-injection ejb ear
No comments:
Post a Comment