Scrivio Interview library
DebuggingFoundations6 min read · updated 12 November 2026

Startup fails with 'No qualifying bean of type InventoryClient available'. List the causes you would check.

No qualifying bean of type InventoryClient means Spring found no bean definition that matches the requested type. I would check, in order: whether the class is annotated and inside a scanned package; whether the @Bean method or its configuration is behind a condition or profile that is not active; whether the auto-configuration that should create it did not match, using the condition evaluation report from --debug; whether the bean exists but is a JDK proxy while the injection point asks for the concrete class; and whether generic types differ, such as Client<String> requested and Client<Object> defined.

Why this question is asked

This is the first Spring error many developers ever see, and it keeps appearing in senior work, because the causes range from a missing annotation to subtle proxy and generics rules. Interviewers ask for a list of causes to see whether we debug systematically or by trial and error. In this answer, we will recap what the message really says, then go through each cause with how it looks and how to confirm it, and end with a quick order of checks that finds the problem fast.

1A Quick Recap of What the Message Means

When a bean needs an InventoryClient, Spring searches its bean definitions, the container's recipes for creating beans, for every one whose type is assignable to InventoryClient. NoSuchBeanDefinitionException with No qualifying bean of type InventoryClient available means that search came back empty. Spring Boot usually rewrites it into a friendlier failure analysis that names the injection point.

Text
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of constructor in com.shop.stock.StockService required a bean of type
'com.shop.inventory.InventoryClient' that could not be found.
Action:
Consider defining a bean of type 'com.shop.inventory.InventoryClient' in your configuration.

Notice what it does not say: it does not tell us whether the bean was never defined, was defined and switched off, or exists with a type that does not match. Our job is to find out which.

2Cause 1: Not Annotated or Not Scanned

Component scanning only finds classes annotated with @Component or a stereotype such as @Service, and only in the packages being scanned. In Spring Boot, @SpringBootApplication scans the package of the main class and everything below it.

Java
package com.shop.app; @SpringBootApplication class ShopApplication { } // scans com.shop.app.**
package com.shop.inventory; @Component class InventoryClient { } // sibling package: never scanned

Notice that com.shop.inventory is not below com.shop.app, so the class is invisible. The fix is to move the main class up to com.shop, or add @ComponentScan or an @Import for the other package. A forgotten annotation looks identical, so we check both.

3Cause 2: A Condition or Profile Is Not Active

The bean may be defined in a @Bean method that is switched off. @Profile("prod") is only active when the prod profile is, and @ConditionalOnProperty("inventory.url") only when that property is set. The whole @Configuration class may carry the condition, so a perfectly correct @Bean method never runs.

A typical sign is "works on my machine, fails in the test" or the other way round, because the environment differs. Logging the active profiles at startup, which Spring Boot does by default in its "The following profiles are active" line, often answers this in seconds.

4Cause 3: Auto-Configuration Did Not Match

If InventoryClient should come from a starter, its auto-configuration has conditions too: a class on the classpath, a property, or a missing bean. Starting the application with --debug, or with debug=true in application properties, prints the condition evaluation report, which lists every auto-configuration with the reason it matched or did not.

Shell
java -jar shop.jar --debug
Negative matches:
-----------------
InventoryClientAutoConfiguration:
Did not match:
- @ConditionalOnProperty (inventory.base-url) did not find property 'base-url'

Here the report says exactly what is missing: a property. Actuator's /actuator/conditions endpoint shows the same report in a running application.

5Cause 4: A JDK Proxy and a Concrete Class

Sometimes the bean exists, but its type does not match. If InventoryClient is a class that implements an interface, and something creates a JDK dynamic proxy for it, the bean in the container is a proxy object that implements the interface only. It is not an instance of the class.

Java
interface StockLookup { int available(String sku); }
@Component class InventoryClient implements StockLookup { @Transactional public int available(String sku) { return 0; } }
// with spring.aop.proxy-target-class=false (JDK proxies):
@Autowired InventoryClient client; // No qualifying bean of type 'InventoryClient': the bean is a proxy implementing StockLookup
@Autowired StockLookup lookup; // works

Spring Boot uses class-based proxies by default, which subclass the class and so match both types, but some setups switch to JDK proxies, and some libraries create their own interface proxies. The fix is to inject the interface, which is good practice anyway, or to use class-based proxies. A related message, BeanNotOfRequiredTypeException, appears when injection is by name instead of by type.

6Cause 5: Generic Types Do Not Match

Spring treats generic type parameters as part of the type when matching. A Client<Object> is not a Client<String>, so if we define one and ask for the other, there is no candidate.

Java
@Bean Client<Object> inventoryClient() { return new Client<>(); }
@Autowired Client<String> client; // No qualifying bean of type 'Client<String>'
@Autowired Client<?> any; // works
Step throughA quick order of checks
  1. Is the class annotated and in a scanned package?
    YesNext checkNoFix scanning or add the annotation
  2. Is its @Bean or @Configuration conditional or profiled?
    YesCheck the active profiles and propertiesNoNext check
  3. Should a starter create it?
    YesRun with --debug, read negative matchesNoNext check
  4. Does the bean exist under another type?
    YesProxy or generics mismatch: inject the right typeNoLook at test slices and contexts

4 steps in order. Play them, or step through them one at a time.

Ask the container what exists before changing code.

Notice that the error message shows the full generic type, which is the clue. The fix is to declare the @Bean method with the exact type the consumer needs.

7Follow-up questions

How can I see which beans of a type actually exist?

In a running application, Actuator's /actuator/beans endpoint lists every bean with its type and dependencies. In a test or a debugger, context.getBeanNamesForType(InventoryClient.class, true, false) returns the names, and calling it with the interface type instead shows whether a proxy is hiding the class.

Why does it fail only in a @WebMvcTest?

Test slices such as @WebMvcTest load only part of the application, controllers and MVC infrastructure, and deliberately leave out services and clients. A controller that needs InventoryClient then has no candidate. We provide one with @MockitoBean, or use @SpringBootTest when we really want the full context.

Can a child context cause this error?

Yes. A bean defined only in a child context, such as a servlet context or a plugin context, is invisible to beans in the parent. If the injecting bean lives in the parent, it gets No qualifying bean even though the log shows the bean being created.

8Conclusion

In this answer, we saw that No qualifying bean of type InventoryClient means no bean definition matched the requested type, and that the causes fall into two groups. Either the bean was never defined, because the class is not annotated or not scanned, or its @Bean method, configuration, profile or auto-configuration condition is not active, which the --debug condition report reveals. Or it exists under a type that does not match, such as a JDK proxy that only implements the interface, or a different generic type. Checking these in order, and asking the container what exists, finds the cause quickly.

What to say in the interviewAbout 90 seconds aloud

Open with

The message means Spring searched all bean definitions and none matches InventoryClient, so I check two groups of causes: the bean was never defined, or it exists with a different type.

Then, if they want more

First I check the class is annotated, with @Component or @Service, and is in a scanned package; in Boot that means at or below the main application class's package, and a sibling package is a classic mistake.

Second, if it comes from a @Bean method, I check whether that method or its whole configuration is behind @Profile or a @Conditional that is not active, by looking at the active profiles line in the startup log and the properties.

Third, if a starter should create it, I run with --debug and read the condition evaluation report; the negative matches say exactly which condition failed, for example a missing property, and Actuator's conditions endpoint shows the same at runtime. If the bean does exist, I look at its real type.

With JDK dynamic proxies, a bean whose class implements an interface becomes a proxy that only implements the interface, so injecting the concrete class fails while injecting the interface works. Finally, generics count: a Client of Object is not a Client of String, and the error message shows the full generic type.

I also keep in mind test slices like WebMvcTest and child contexts, which hide beans by design.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Startup fails with 'No qualifying bean of type InventoryClient available'. List the...": https://scrivio-interview-library.netlify.app/spring-boot/dependency-injection/6f06b9ae0d/