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

Open and Fix NativeTest by Spring Framework under GraalVM CE #562

Merged
merged 1 commit into from
Sep 6, 2023
Merged

Open and Fix NativeTest by Spring Framework under GraalVM CE #562

merged 1 commit into from
Sep 6, 2023

Conversation

linghengqian
Copy link
Contributor

@linghengqian linghengqian commented Sep 5, 2023

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style
  • Refactor
  • Doc
  • Other, please describe:

The description of the PR:

Other information:

  • DynamicRoutingDataSource has design flaws. This class attempts to inject a List<DynamicDataSourceProvider> Spring Bean into a non-container environment, which causes the Spring Framework to deliberately take over this class and set a NoArgConstructor for this class with an unaligned parameter list.

  • As a fix, I added a AllArgsConstructor for DynamicRoutingDataSource to avoid https://github.com/baomidou/dynamic-datasource/actions/runs/6080472779/job/16494489274?pr=560 display, injected List<DynamicDataSourceProvider> is null.

  • Similarly, Alibaba Druid's Spring Boot Starter has a similar problem with Spring Bean introspection failures, resulting in the Spring Framework's improper initialization of beans.

linghengqian added a commit to linghengqian-scratches/spring-plugin-graalvm-agent-test that referenced this pull request Sep 5, 2023
linghengqian added a commit to linghengqian-scratches/dynamic-datasource-nativetest that referenced this pull request Sep 5, 2023
@linghengqian linghengqian marked this pull request as ready for review September 5, 2023 15:47
@linghengqian
Copy link
Contributor Author

  • Call @huayanYu to help review.

  • DynamicRoutingDataSource has design flaws. This class attempts to inject a List<DynamicDataSourceProvider> Spring Bean into a non-container environment, which causes the Spring Framework to deliberately take over this class and set a NoArgConstructor for this class with an unaligned parameter list.

  • As a fix, I added a AllArgsConstructor for DynamicRoutingDataSource to avoid https://github.com/baomidou/dynamic-datasource/actions/runs/6080472779/job/16494489274?pr=560 display, injected List<DynamicDataSourceProvider> is null.

  • Similarly, Alibaba Druid's Spring Boot Starter has a similar problem with Spring Bean introspection failures, resulting in the Spring Framework's improper initialization of beans.

  • I'll discuss how to manage GraalVM Reachability Metadata and convert Standard Metadata to Conditional Metadata in a new issue. Now the downstream still needs to add some of the contents of the JSON file itself. But the core problem has been solved, because nativeTest has already run through.

  • From this point of view, apart from the fact that SPEL cannot be used, we can claim that dynamic-datasource should not conflict with GraalVM Native Image.

@linghengqian
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants