Announcement Announcement Module
No announcement yet.
Can't get rid of "No unique bean found" OR "StackOverflowError" Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can't get rid of "No unique bean found" OR "StackOverflowError"

    I have a standard Java EE Setup with Hibernate and Spring. I want to accomplish normal inheritance, one parent 2 children. The problem is that at lesat the parent has to be a spring bean. If all 3 are beans (@Service("csv...Service")) and I extend the parent in the children I get a "No unique bean found"-exception when Initializing the Spring root WebApplicationContext. If I only declare the parent as a bean, (@Service("csv...Service")), and create the 2 children as normal class instances, I get a StackOverflowError. It's calling the constructor hundreds of times for one of the children.

  • #2
    Can you be more specific for the use of your beans?

    You should normally declare only the 2 childreen bean @Service("xxx1") and @Service("xxx2"); then autowire the 2 beans with

    List<ParentBean> listChildreen;

    Or use the @Qualifier to select the correct bean
    ParentBean beanXxx1;

    ParentBean beanXxx2;