spring-projects / spring-projects/spring-framework

Cyclic dependency with setter injection and Java Config

Open
#25,443 13 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

in: core type: documentation
Dominant language
Java
Stars
60.2k
Forks
38.8k
Avg merge
5d 2h
Merged PRs (30d)
27

Description

Hi,

I'm trying to run simple spring core with Spring Circular dependency + Setter Dependency Injection + Java Config => Getting Exception. It's working fine with XML config. but its failing with java config. I'm not able to understand what is the problem.

Attached required files to replicate the issue locally.

Spring Circular dependency + Setter Dependency Injection + Java Config => Getting Exception

Spring Circular dependency + Setter Dependency Injection + XMLConfig => Working Fine
Attached Files for debugging purpose

Exception in thread "main" java.lang.NoClassDefFoundError: org.springframework.beans.FatalBeanExceptionException in thread "main" java.lang.NoClassDefFoundError: org.springframework.beans.FatalBeanException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
circular.zip

Related Issues

  • #26703
  • #27534
  • #30333

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by extracting and running the attached circular.zip reproduction, then compare the Java Config and XML Config cases using the reported stack trace. Inspect AbstractAutowireCapableBeanFactory.createBean at the referenced location and the related issues #26703, #27534, and #30333. Done means the Java Config setter-injection case reproduces the expected circular-dependency behavior without the reported exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.