Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No qualifying bean of type 'io.eventuate.tram.sagas.orchestration.SagaInstanceFactory' available #94

Open
kumar-csice opened this issue Mar 7, 2023 · 0 comments

Comments

@kumar-csice
Copy link

kumar-csice commented Mar 7, 2023

I am new to SAGA design pattern and just started to try some sample with your eventuate tram saga framework but I am unable to build project due to below issues.
Please help me to solve this issue.

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'io.eventuate.tram.sagas.orchestration.SagaInstanceFactory' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

Github link:
https://github.com/eventuate-tram/eventuate-tram-sagas-examples-customers-and-orders/blob/master/order-service/src/main/java/io/eventuate/examples/tram/sagas/ordersandcustomers/orders/service/OrderSagaService.java

My Reference Link:
https://eventuate.io/docs/manual/eventuate-tram/latest/getting-started-eventuate-tram-sagas.html

Added dependencies:

           <properties>
	<java.version>17</java.version>		
	<eventuateTramVersion>0.31.0.RELEASE</eventuateTramVersion>
	<eventuateTramSagasVersion>0.20.0.RELEASE</eventuateTramSagasVersion>		
	</properties>
	
	<dependency>
		<groupId>io.eventuate.tram.sagas</groupId>
		<artifactId>eventuate-tram-sagas-spring-orchestration-simple-dsl-starter</artifactId>
		<version>${eventuateTramSagasVersion}</version>
	</dependency>
	
	<dependency>
		<groupId>io.eventuate.tram.core</groupId>
		<artifactId>eventuate-tram-spring-jdbc-kafka</artifactId>
		<version>${eventuateTramVersion}</version>
	</dependency>


     @Service
      public class OrderSagaService {

  @Autowired
  private OrderRepository orderRepository;

  @Autowired
  private SagaInstanceFactory sagaInstanceFactory;

  @Autowired
  private CreateOrderSaga createOrderSaga;	

  @Transactional
  public Order createOrder(OrderDetails orderDetails) {
    CreateOrderSagaData data = new CreateOrderSagaData(orderDetails);
    sagaInstanceFactory.create(createOrderSaga, data);
    return orderRepository.findById(data.getOrderId()).get();
  }
}

What i have tried:
I added below import statement:
@import(SagaOrchestratorConfiguration.class)
public class OrderServiceApplication {

      public static void main(String[] args) {
	      SpringApplication.run(OrderServiceApplication.class, args);
      }	 
  }

But getting below issues:
'io.eventuate.tram.messaging.producer.MessageProducer' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'orderSagaService': Unsatisfied dependency expressed through field 'sagaInstanceFactory': Error creating bean with name 'sagaInstanceFactory' defined in io.eventuate.tram.sagas.spring.orchestration.SagaOrchestratorConfiguration: Unsatisfied dependency expressed through method 'sagaInstanceFactory' parameter 1: Error creating bean with name 'commandProducer' defined in io.eventuate.tram.spring.commands.producer.TramCommandProducerConfiguration: Unsatisfied dependency expressed through method 'commandProducer' parameter 0: No qualifying bean of type 'io.eventuate.tram.messaging.producer.MessageProducer' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sagaInstanceFactory' defined in io.eventuate.tram.sagas.spring.orchestration.SagaOrchestratorConfiguration: Unsatisfied dependency expressed through method 'sagaInstanceFactory' parameter 1: Error creating bean with name 'commandProducer' defined in io.eventuate.tram.spring.commands.producer.TramCommandProducerConfiguration: Unsatisfied dependency expressed through method 'commandProducer' parameter 0: No qualifying bean of type 'io.eventuate.tram.messaging.producer.MessageProducer' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'commandProducer' defined in io.eventuate.tram.spring.commands.producer.TramCommandProducerConfiguration: Unsatisfied dependency expressed through method 'commandProducer' parameter 0: No qualifying bean of type 'io.eventuate.tram.messaging.producer.MessageProducer' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'io.eventuate.tram.messaging.producer.MessageProducer' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

@kumar-csice kumar-csice changed the title Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'io.eventuate.tram.sagas.orchestration.SagaInstanceFactory' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} No qualifying bean of type 'io.eventuate.tram.sagas.orchestration.SagaInstanceFactory' available Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant