awspring / spring-cloud-aws

The New Home for Spring Cloud AWS
http://awspring.io
Apache License 2.0
880 stars 299 forks source link

Creating bean with name 'sqsAsyncClient' error when spring boot 3.1.2 use awspring-cloud 3.0.2 #929

Closed lebkset closed 12 months ago

lebkset commented 12 months ago

Type: Bug

Component:

Describe the bug I used awspring-cloud 3.0.2 in Spring-boot 3.1.2 use SqsAutoConfiguration then raise error message : Error creating bean with name 'sqsAsyncClient' defined in class path resource [io/awspring/cloud/autoconfigure/sqs/SqsAutoConfiguration.class]: Could not generate CGLIB subclass of class software.amazon.awssdk.services.sqs.DefaultSqsAsyncClient: Common causes of this problem include using a final class or a non-visible

Sample If possible, please provide a test case or sample application that reproduces the problem. This makes it much easier for us to diagnose the problem and to verify that we have fixed it.

maciejwalkowiak commented 12 months ago

@lebkset can you provide a sample project that reproduces this issue?

lebkset commented 12 months ago

@maciejwalkowiak I can only provide some class such as bellow : I have SqsConfiguration :

@Configuration
@Import(SqsBootstrapConfiguration.class)
public class SqsConfiguration {

  @Bean
  public SqsMessageListenerContainerFactory<Object> defaultSqsListenerContainerFactory(SqsAsyncClient sqsAsyncClient) {
    SqsMessageListenerContainerFactory<Object> factory = new SqsMessageListenerContainerFactory<>();
    factory.setSqsAsyncClient(sqsAsyncClient);
    return factory;
  }
}

and I have component run Aspect Before for check healthy application :

@Component
@Aspect
public class HealthMonitoringAspect {

  private final PollingTime pollingTime;

  public HealthMonitoringAspect(PollingTime pollingTime) {
    this.pollingTime = pollingTime;
  }

  @Before("execution(* software.amazon.awssdk.services.sqs.SqsAsyncClient.receiveMessage("
          + "software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest))")
  public void beforeCallSqsReceive() {
    pollingTime.update();
  }
}

when deploy application then show log error such as title , I can fix temporary use config such as bellow in application.yaml file :

 aop:
    proxy-target-class: false
maciejwalkowiak commented 12 months ago

Since DefaultSqsAsyncClient is a class from AWS SDK, I am sorry but we can't do much here.