JAVAWarningFramework ErrorJune 23, 2026

Framework Error

No qualifying bean of type 'com.example.data.DataSource' available

What This Error Means

This error occurs when the Spring Framework is unable to find a bean that matches the specified type in the application context.

Why It Happens

This error typically happens when the bean is not properly registered in the application context, or when the bean's name does not match the specified type. It can also occur when there are multiple beans of the same type, and the Spring Framework is unable to determine which one to use.

How to Fix It

  1. 1To fix this error, you can try the following steps:
  2. 21. Check that the bean is properly registered in the application context, either through XML configuration or Java-based configuration.
  3. 32. Verify that the bean's name matches the specified type.
  4. 43. If there are multiple beans of the same type, use the @Qualifier annotation to specify which one to use.
  5. 54. If you are using Java-based configuration, ensure that the bean is properly annotated with the @Bean annotation.

Example Code Solution

❌ Before (problematic code)
Java
@SpringBootApplication
public class AppConfig {
  @Bean
  public DataSource dataSource() {
    return null;
  }
}
✅ After (fixed code)
Java
@SpringBootApplication
public class AppConfig {
  @Bean
  public DataSource dataSource() {
    return DataSourceBuilder.create().build();
  }
}

Fix for No qualifying bean of type 'com.example.data.DataSource' available

Related JAVA Errors

Related JAVA Blog Articles

Have a different error? Get an instant explanation.

Explain Another Error