• Post Reply Bookmark Topic Watch Topic
  • New Topic

Spring bean circular dependency - RESTEasy Spring integration  RSS feed

George Chow
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

I'm having trouble when trying to integrate RESTEasy (3.0.13.Final) with Spring (4.2.4.RELEASE). I have a service (DummyService) annotated as @Provider, and it is defined in Spring applicationContext.xml. Something like:




when I start the application, it fails because dummyService cannot be initialized, due to circular depends-on relations between "dummyService" and "dummyService" (yes, itself).

Looking into the code, I found that SpringContextLoaderListener, via SpringProcessor.postProcessBeanFactory(), has set a dependency on all classes with the @Provider annotation. As per the javadoc,
This method keeps track of Provider:and resources for future use. It also registers the RESTEasy Registry, ProviderFactry, and Dispatcher for @Autowire injection.
Beyond tracking, this will ensure that non-MessageBody(Reader|Writer) @Providers are created by Spring before any resources by having the resources "depends-on" the @Providers.

Has anyone experience this? Is there anything mis-configured in my setup? Any feedback are welcomed.

Thanks a lot
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!