circular references Java Origin: Application & API Last updated 13 Oct 2026

The dependencies of some of the beans in the application context form a cycle

Two or more Spring beans depend on each other through constructors, and Spring Boot 2.6+ forbids cycles by default.

Exact message you may see form a cyclecircular reference
Seen on: Java

Meaning

A → B → A cycles can’t be built with constructor injection. Spring prints the cycle; the fix is usually a design change.

Common causes

  • Services injecting each other
  • Configuration classes depending on beans they define

⚡ Quick fix

  1. Extract shared logic into a third bean
  2. Use events or interfaces to decouple
  3. As a last resort, @Lazy on one injection point

Detailed fix by platform

Java

  1. public OrderService(@Lazy PaymentService payments) { … }

How to diagnose

  1. Cycle — Which beans are listed?
  2. Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

DataSource url not specified — Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. (Java)DataSource url not sp…HttpMessageNotReadableException — HttpMessageNotReadableException: JSON parse error / Required request body is missing (Java)HttpMessageNotReadabl…InvalidOperationException — InvalidOperationException: Unable to resolve service for type 'X' while attempting to activate 'Y' (.NET)InvalidOperationExcep…MethodArgumentNotValidException — MethodArgumentNotValidException: Validation failed for argument [0] (Java)MethodArgumentNotVali…NullInjectorError — Angular: NullInjectorError: No provider for X! (Angular)NullInjectorErrorPort 8080 in use — Web server failed to start. Port 8080 was already in use. (Java)Port 8080 in useUnsatisfiedDependencyException — UnsatisfiedDependencyException / NoSuchBeanDefinitionException: No qualifying bean of type 'X' available (Java)UnsatisfiedDependency…Whitelabel Error Page — Whitelabel Error Page — This application has no explicit mapping for /error (Java)Whitelabel Error Pagecircular …

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.