Skip to content

Skip mapper scanning in AOT generated runtime#1236

Merged
hazendaz merged 1 commit into
mybatis:3.0.xfrom
DragonFSKY:fix-aot-skip-runtime-mapper-scan-3.0
May 9, 2026
Merged

Skip mapper scanning in AOT generated runtime#1236
hazendaz merged 1 commit into
mybatis:3.0.xfrom
DragonFSKY:fix-aot-skip-runtime-mapper-scan-3.0

Conversation

@DragonFSKY
Copy link
Copy Markdown
Contributor

This PR addresses the duplicate mapper scanning part of #929.

When an application runs with Spring AOT generated artifacts, mapper bean definitions have already been generated during AOT processing. However, the generated runtime still registers the MapperScannerConfigurer bean. If it scans again at runtime, it may attempt to register the same mapper bean definition and fail with ConflictingBeanDefinitionException.

This change keeps MapperScannerConfigurer registered/generated for compatibility, but skips mapper scanning when AotDetector.useGeneratedArtifacts() is true. Placeholder processing is still performed before the guard, and the regular non-AOT scanning path is unchanged.

This is complementary to #1235, which fixes the generated MapperFactoryBean constructor argument. Both changes are needed for the sample application from #929 to start successfully with AOT generated artifacts.

Tested with:

  • git diff --check
  • ./mvnw -Dlicense.skip=true -Drewrite.skip=true -Dformatter.skip=true -Dimpsort.skip=true -Dwhitespace.skip=true test

@DragonFSKY DragonFSKY force-pushed the fix-aot-skip-runtime-mapper-scan-3.0 branch from 168927a to ed1b677 Compare May 3, 2026 04:58
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 90.26% (+0.02%) from 90.242% — DragonFSKY:fix-aot-skip-runtime-mapper-scan-3.0 into mybatis:3.0.x

@hazendaz hazendaz merged commit 09fe477 into mybatis:3.0.x May 9, 2026
14 checks passed
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

Successfully merging this pull request may close these issues.

3 participants