Java Spring ожидал как минимум 1 bean-компонент, который квалифицируется как кандидат на автоподключение. Аннотации завиJAVA

Программисты JAVA общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 Java Spring ожидал как минимум 1 bean-компонент, который квалифицируется как кандидат на автоподключение. Аннотации зави

Сообщение Anonymous »

Приложение Spring boot выдает «Нет подходящего компонента доступного типа: ожидается как минимум 1 компонент, который соответствует требованиям автоподключения.» ошибка во время выполнения.
Пожалуйста, найдите мой код ниже.
SpringBoot version : 2.7.9
JDK 11
public class CatalogServiceImpl extends CatalogService.CatalogServiceImplBase {

private final DataSourceHandler dataSourceHandlerDelegate;

private final StorefrontServiceHelper storefrontServiceHelper

CatalogServiceImpl ( DataSourceHandler dataSourceHandlerDelegate,
StorefrontServiceHelper storefrontServiceHelper) {
this.dataSourceHandlerDelegate = dataSourceHandlerDelegate;
this.storefrontServiceHelper = storefrontServiceHelper;
}
}

public class StorefrontServiceHelper {

private final CatalogServiceHelper catalogServiceHelper

public StorefrontServiceHelper(CatalogServiceHelper catalogServiceHelper){
this.catalogServiceHelper = catalogServiceHelper;
}

}

public class CatalogServiceHelper {

private final DataSourceHandler dataSourceHandlerDelegate

public CatalogServiceHelper(DataSourceHandler dataSourceHandlerDelegate) {
this.dataSourceHandlerDelegate = dataSourceHandlerDelegate
}

}

public interface DataSourceHandler {

}

public class DataSourceHandlerDelegate implements DataSourceHandler {

public DataSourceHandlerDelegate(DataSourceHandler dynamoDBDataSourceHandler){
this.dynamoDBDataSourceHandler = dynamoDBDataSourceHandler
}
}

public class AppConfig {

@Bean
DataSourceHandlerDelegate
dataSourceHandlerDelegate(@Qualifier("DataSourceHandlerDelegate") DataSourceHandler
dynamoDBDataSourceHandler){
return new DataSourceHandlerDelegate(dynamoDBDataSourceHandler)
}

Ошибка времени выполнения:
2024-10-26 16:20:31,703 [thread="main" class="o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext" cid="" id="" dd_trace_id="" dd_span_id=""] Exception encountered during context initialization cancelling refresh attempt: org.springframework.beans.factory. Unsatisfied Dependency Exception: Error creating bean with name 'catalogServiceImpl' defined in file [item-service/build/classes/java/main/com/item/grpc/CatalogServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory. UnsatisfiedDependencyException: Error creating bean with name 'storefrontServiceHelper' defined in file [item-service/build/classes/java/main/com/item/service/StorefrontServiceHelper.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory. UnsatisfiedDependencyException: Error creating bean with name 'catalogServiceHelper' defined in file [item-service/build/classes/java/main/com/item/service/CatalogServiceHelper.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory. Unsatisfied DependencyException: Error creating bean with name 'dataSourceHandlerDelegate' defined in class path resource [com/item/config/AppConfig.class]: Unsatisfied dependency expressed through method 'dataSourceHandlerDelegate' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com..item.datasource.DataSourceHandler' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation. Qualifier (value="DataSourceHandlerDelegate")}


Подробнее здесь: https://stackoverflow.com/questions/791 ... idate-depe
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «JAVA»