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

optimize: First support spring:6.x and spring-boot:3.x #5115

Merged
merged 38 commits into from
Dec 18, 2022

Conversation

wangliang181230
Copy link
Contributor

@wangliang181230 wangliang181230 commented Dec 2, 2022

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

optimize: First support spring:6.x and spring-boot:3.x.
优化:首次支持 spring:6.xspring-boot:3.x

经测试,碰到的问题如下:

  1. 自动装配类的配置方式变了,要从 /META-INF/spring.factories 转移到 /META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
    为了兼容低版本springboot,两边都加。
  2. springboot:3.x,已将 javax.servlet 包 要改成 jakarta.servlet 包,需要 jakarta.servlet-api 依赖的支持。

    注:由于 jakarta.servlet-api6.0.0 版本开始,最低要求 java11,所以使用了 5.0.0 版本。

  3. 部分 XxxxAdapter (适配器)类已不存在,自己添加相应的适配器类。

所做的改造:

  1. 添加了 seata-http-jakarta模块,含 JakartaSeataWebMvcConfigurer.javaJakartaTransactionPropagationInterceptor.java 两个类。
  2. 添加了几个 /META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  3. 移除 HandlerInterceptorAdapter.java 类,因为其功能与 TransactionPropagationInterceptor.afterCompletion(...) 方法重复了。
  4. test.yml 添加了 基于 springboot:3 的自动测试job。

目前,仅针对client端,做了兼容 springboot3,server端由于兼容性问题比较多,还未做过兼容。

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

请在我的测试项目中进行校验:
https://github.com/wangliang181230/study-spring-boot

Ⅴ. Special notes for reviews

代码变更比较简单,review难度不大。
基本上都是一些兼容性代码,并没有逻辑上的变动。

@wangliang181230 wangliang181230 changed the title optimize: Support for the spring-boot:3.x optimize: Compatible with the spring-boot:3.x Dec 2, 2022
@codecov-commenter
Copy link

codecov-commenter commented Dec 2, 2022

Codecov Report

Merging #5115 (9c3c373) into develop (fad95fe) will decrease coverage by 0.02%.
The diff coverage is 25.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #5115      +/-   ##
=============================================
- Coverage      48.56%   48.53%   -0.03%     
- Complexity      4136     4139       +3     
=============================================
  Files            741      743       +2     
  Lines          26521    26544      +23     
  Branches        3294     3294              
=============================================
+ Hits           12879    12884       +5     
- Misses         12244    12261      +17     
- Partials        1398     1399       +1     
Impacted Files Coverage Δ
.../seata/integration/http/SeataWebMvcConfigurer.java 0.00% <0.00%> (ø)
...eata/integration/http/WebMvcConfigurerAdapter.java 0.00% <0.00%> (ø)
...ta/spring/boot/autoconfigure/StarterConstants.java 100.00% <ø> (ø)
...boot/autoconfigure/SeataHttpAutoConfiguration.java 0.00% <0.00%> (ø)
...ta/integration/http/HandlerInterceptorAdapter.java 33.33% <50.00%> (ø)
...ration/http/TransactionPropagationInterceptor.java 66.66% <87.50%> (+23.80%) ⬆️
...o/seata/server/coordinator/DefaultCoordinator.java 44.67% <0.00%> (+0.40%) ⬆️

@wangliang181230 wangliang181230 requested review from funky-eyes, l81893521 and slievrly and removed request for funky-eyes December 2, 2022 09:02
@wangliang181230 wangliang181230 added this to the 1.6.1 milestone Dec 2, 2022
@@ -57,6 +57,7 @@
<testcontainers.version>1.11.2</testcontainers.version>
<guava.version>27.0.1-jre</guava.version>
<javax-inject.version>1</javax-inject.version>
<jakarta.servlet-api.version>5.0.0</jakarta.servlet-api.version>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jakarta.servlet-api6.0.0 版本开始,最低要求 java11,所以最高只能使用 5.0.0 版本。

@wangliang181230 wangliang181230 changed the title optimize: Compatible with the spring-boot:3.x optimize: Compatible with the spring-boot:3.x and spring:6.x Dec 5, 2022
@wangliang181230 wangliang181230 changed the title optimize: Compatible with the spring-boot:3.x and spring:6.x optimize: Compatible with the spring:6.x and spring-boot:3.x Dec 5, 2022
@wangliang181230 wangliang181230 changed the title optimize: Compatible with the spring:6.x and spring-boot:3.x optimize: First support spring:6.x and spring-boot:3.x Dec 9, 2022
@CLAassistant
Copy link

CLAassistant commented Dec 12, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@xingfudeshi xingfudeshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@funky-eyes funky-eyes merged commit d07516b into apache:develop Dec 18, 2022
Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wangliang181230 wangliang181230 deleted the support-springboot3.x branch December 19, 2022 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants