NoSuchBeanDefinitionException Java Origin: Application & API OSI layer 7 · Application Last updated 2 Dec 2026

NoSuchBeanDefinitionException: No qualifying bean of type 'X' available

Spring has no bean of the requested type, so it cannot inject it.

Exact message you may see No qualifying bean of type availableexpected at least 1 bean which qualifies as autowire candidate
Seen on: Java Spring Boot

Meaning

The class is not annotated, not in a scanned package, excluded by a profile or condition, or the starter that defines it is missing.

Common causes

  • Missing @Component/@Service/@Bean
  • Class outside the component-scan base package
  • Wrong profile or @ConditionalOn… false
  • Auto-configuration missing (starter not on classpath)

⚡ Quick fix

  1. Annotate the class and place it under the main application package
  2. Add @ComponentScan or @Import
  3. Add the required starter dependency

Detailed fix by platform

Spring Boot

  1. Put the @SpringBootApplication class in the root package so sub-packages are scanned

How to diagnose

  1. Annotation — Present?
  2. Package — Scanned?
  3. Profile — Active?

🔧 Still not fixed?

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

🧠 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.