Skip to content

Avoid reflective copying in SqsContainerOptions builder#1609

Open
sondemar wants to merge 1 commit intoawspring:mainfrom
sondemar:fix-sqs-native-image-loses-custom-message-converter
Open

Avoid reflective copying in SqsContainerOptions builder#1609
sondemar wants to merge 1 commit intoawspring:mainfrom
sondemar:fix-sqs-native-image-loses-custom-message-converter

Conversation

@sondemar
Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Replace reflective builder state copying in SqsContainerOptions with explicit field copying.

This change updates the SQS container options builder copy paths to avoid ReflectionUtils.shallowCopyFieldState(...) and preserve custom messageConverter configuration when options are copied through builder/container creation flows.

It also adds regression tests for:

  • builder createCopy()
  • fromBuilder(...)
  • container creation through SqsMessageListenerContainerFactory

💡 Motivation and Context

This fixes the issue where custom messageConverter configuration could be lost or behave incorrectly when SqsContainerOptions were copied.

It also removes reflection from this builder-copy path, which is a better fit for AOT/native scenarios.

Fixes #1598

💚 How did you test it?

Ran focused SQS tests covering the changed code paths:

  • mvn -o -pl spring-cloud-aws-sqs -Dtest=ContainerOptionsTests,SqsMessageListenerContainerFactoryTests test

Also verified the project still packages successfully with tests skipped:

  • mvn -o -DskipTests clean package

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • I updated reference documentation to reflect the change
  • All tests passing
  • No breaking changes

🔮 Next steps

None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: sqs SQS integration related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native SQS listener container loses custom messageConverter

1 participant