# NoSuchBeanDefinitionException: No qualifying bean of type 'X' available

**Code:** `NoSuchBeanDefinitionException` · **Category:** Java · **Seen on:** Java, Spring Boot

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

## 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?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/java/nosuchbeandefinitionexception-spring)
