Application context duplicated
I have a Java SE application running a Jetty web server hosting a web application. I want to use Spring dependency injection both in the Jetty configuration and in the web application. Some beans, e.g. a dao and the entity manager, needs to be shared between the two. When I start the application I get duplicate versions of both the beans and the entity manager.
Spring prints this to the log:
Code:
WARN EntityManagerFactoryRegistry.addEntityManagerFactory:80 - HHH000436: Entity manager factory name (persistenceUnit) is already registered. If entity manager will be clustered or passivated, specify a unique value for property 'hibernate.ejb.entitymanager_factory_name'
How can I make the web application use the same application context as the rest of the application and not duplicate all the beans?