Skip to content

Commit

Permalink
Merge spring 3.2 (#841)
Browse files Browse the repository at this point in the history
* Suit 3.2.0 (#789)

* suit sprignboot 3.2.0

* suit springboot 3.2.0

---------

Co-authored-by: 致节 <hzj266771@antgroup.com>

* Ark2.0 support Netty plugin (#653)

* Ark support Netty plugin

* fix mvn issue

* fix pom issue

---------

Co-authored-by: Xuhao Wang <1023605039@qq.com>
Co-authored-by: leo james <leojames.googol@gmail.com>
Co-authored-by: yuanyuancin <yuancin@163.com>

(cherry picked from commit 362f9a8)

* Bump org.springframework.boot:spring-boot-starter-webflux from 2.1.0.RELEASE to 2.5.12 in /sofa-ark-plugin/netty-ark-plugin (#785)

* Bump org.springframework.boot:spring-boot-starter-webflux

Bumps [org.springframework.boot:spring-boot-starter-webflux](https://github.com/spring-projects/spring-boot) from 2.1.0.RELEASE to 2.5.12.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](spring-projects/spring-boot@v2.1.0.RELEASE...v2.5.12)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-webflux
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update pom.xml

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: leo james <leojames.googol@gmail.com>
(cherry picked from commit 6a9f471)

* support spring cloud for base (#784)

* support .* for exclude

* support .* for exclude

* support spring cloud

* update to 2.2.5-SNAPSHOT

* remove duplicate version properties setting

* update to 2.2.5

(cherry picked from commit cefc679)

* update guava or netty (#788)

* support .* for exclude

* support .* for exclude

* update version

(cherry picked from commit ef684f6)

* Optimize to support spring webflux in ark (#798)

* extend ArkNettyReactiveWebServerFactory

* fix biz override master ReactorHttpHandlerAdapter

* fix Port in use

* fix base service faile when biz uninstalled

* fix the biz service is still accessible after biz was uninstalled

* change version to 2.2.5

* remove unuse code

* disposableServer dispose when master stopping

* fix ut,sofa-ark-springboot-starter dependent reactor-netty, change netty-handler version

* fix ci check

---------

Co-authored-by: yuanyuan <fengjun.zfj@antgroup.com>
Co-authored-by: leo james <leojames.googol@gmail.com>

(cherry picked from commit 361d445)

* Create cloud_code_scan.yml (#797)

Co-authored-by: leo james <leojames.googol@gmail.com>
(cherry picked from commit 584ac7c)

* Add a newFile method to handle file paths with spaces. (#803)

(cherry picked from commit 9c37315)

* enable override for plugin (#790)

* support .* for exclude

* support .* for exclude

* enable override for plugin

* optimize static import

* enable classpath for plugin

* add test for override

* remove unused import

* format

* update 2.2.5-SNAPSHOT

(cherry picked from commit 7de1384)

* Export plugin project classes by default (#799)

* feat: export plugin classes by default.

* feat: export plugin classes by default.

* feat: export plugin classes by default.

* feat: export plugin package by default.

* feat: export plugin package by default.

* default add all packages for plugin

* format

---------

Co-authored-by: yanhuai.yh <yanhuai.yh@antgroup.com>
Co-authored-by: leojames <leojames.googol@gmail.com>
(cherry picked from commit 4ade973)

* 插件内部将参数解析成set,避免对maven版本有要求 (#805)

(cherry picked from commit a491814)

* support biz multi context for logback (#807)

Co-authored-by: yuanyuan <fengjun.zfj@antgroup.com>

(cherry picked from commit 52910e5)

* Add ut 1221 (#813)

* add ut

* add tests

* update test

* update format

* update test

* update jarutils test

* update tests

* update tests

* update web server test

* update tests

* update tests

* update test

* update test

* update tests

* update tests

* update format

* update tests

* update test

---------

Co-authored-by: LiuYu <ly109106@alibaba-inc.com>
(cherry picked from commit bb17be2)

* Avoid biz logger context being attached early,support for logback (#816)

* Avoid biz logger context being attached early,support for logback

* format

* fix ut

---------

Co-authored-by: yuanyuan <fengjun.zfj@antgroup.com>
(cherry picked from commit 3fca4a6)

* default exclude pack rules (#814)

* default exclude pack rules

* formar

---------

Co-authored-by: yuanyuan <fengjun.zfj@antgroup.com>
Co-authored-by: leo james <leojames.googol@gmail.com>
(cherry picked from commit 7ec6184)

* Add ut 1221 (#817)

* add ut

* add tests

* update test

* update format

* update test

* update jarutils test

* update tests

* update tests

* update web server test

* update tests

* update tests

* update test

* update test

* update tests

* update tests

* update format

* update tests

* update test

* update tests

* update test

* Delete sofa-ark-parent/core/common/C:\temp dir\b\c directory

* update test

* update test

---------

Co-authored-by: LiuYu <ly109106@alibaba-inc.com>
(cherry picked from commit dfef361)

* support delegate from classLoaderHook for getResourceAsStream (#811)

* support delegate from classLoaderHook for getResourceAsStream

* rm guice-multibinding

* remove guice multi binding lib

* Revert "support delegate from classLoaderHook for getResourceAsStream"

This reverts commit 5bd306b.

* fix typo

* remove guice-multibinding

* fix format

(cherry picked from commit 3bcf96f)

* plugin default export package without activator, modify to set (#818)

* support delegate from classLoaderHook for getResourceAsStream

* Revert "support delegate from classLoaderHook for getResourceAsStream"

This reverts commit 5bd306b.

* fix typo

* plugin default export package without activator, modify to set

* fix format

(cherry picked from commit 9c5ce37)

* modify plugin export with classes as default (#819)

* support delegate from classLoaderHook for getResourceAsStream

* Revert "support delegate from classLoaderHook for getResourceAsStream"

This reverts commit 5bd306b.

* fix typo

* plugin default export package without activator, modify to set

* fix format

* export class for plugin as default

(cherry picked from commit ef9584d)

* Add ut 1221 (#820)

* add ut

* add tests

* update test

* update format

* update test

* update jarutils test

* update tests

* update tests

* update web server test

* update tests

* update tests

* update test

* update test

* update tests

* update tests

* update format

* update tests

* update test

* update tests

* update test

* Delete sofa-ark-parent/core/common/C:\temp dir\b\c directory

* update test

* update test

* update tesst

* update test

* update test

* update test

* update test

* update test

* update test

* update test

---------

Co-authored-by: LiuYu <ly109106@alibaba-inc.com>
(cherry picked from commit c3192d0)

* 1. update 2.2.7-SNAPSHOT (#823)

2. support SpringBoot 3.2.0 new LaunchedURLClassLoader class

Co-authored-by: 致节 <hzj266771@antgroup.com>

(cherry picked from commit 11f5507)

* Add ut 1221 (#824)

* add ut

* add tests

* update test

* update format

* update test

* update jarutils test

* update tests

* update tests

* update web server test

* update tests

* update tests

* update test

* update test

* update tests

* update tests

* update format

* update tests

* update test

* update tests

* update test

* Delete sofa-ark-parent/core/common/C:\temp dir\b\c directory

* update test

* update test

* update tesst

* update test

* update test

* update test

* update test

* update test

* update test

* update test

* update test

* update test

* update test

* update test

---------

Co-authored-by: LiuYu <ly109106@alibaba-inc.com>
(cherry picked from commit bc52a4c)

* update javadoc to support multi jdk env

* ut for the target jdk17 branch

* update logback

* remove logback context selector adapter, cause it had beed abandoned by qos-ch/logback#765

* fix autoconfiguration

* ark logger lazy init (#829)

* support delegate from classLoaderHook for getResourceAsStream

* Revert "support delegate from classLoaderHook for getResourceAsStream"

This reverts commit 5bd306b.

* fix typo

* plugin default export package without activator, modify to set

* fix format

* export class for plugin as default

* update to 2.2.6

* ark logger lazy init

* format

(cherry picked from commit 368a8be)

* fix windows mvn goal parse (#831)

* update to 2.2.7

* fix windows mvn goal parse

(cherry picked from commit 6a97493)

* enable sub bundle pom analysis first

* commit

* add etst

* remove unused imports

(cherry picked from commit b3133d4)

* modify github to httpbin

(cherry picked from commit f8d2b07)

* support run mvn tree in test

(cherry picked from commit 34580be)

* log version

* remove log sofa boot starter

* 支持对tomcat进行配置 (#839)

Co-authored-by: 巨鹿 <yanwen@cai-inc.com>

(cherry picked from commit 1b2ac68)

* unit etst

* unit test

* add unit test

* add unit test

* resove application.properties extension

* Update inactive_issues_robot.yml (#840)

(cherry picked from commit 4f8c7d6)

* modify test for zip fill to support jdk9+

* add unit test

* add comment

* fix export import config

* support multi sdk

* format test

* add guice lib

* remove module slimming

* inner test class

* unit test

* commit

* adjust package postion

* unit test

* update version

---------

Co-authored-by: HzjNeverStop <441627022@qq.com>
Co-authored-by: 致节 <hzj266771@antgroup.com>
Co-authored-by: FanYang <399284508@qq.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: leo james <leojames.googol@gmail.com>
Co-authored-by: yuanyuancin <yuancin@163.com>
Co-authored-by: Duan-0916 <76544421+Duan-0916@users.noreply.github.com>
Co-authored-by: FlyAbner <776070848@qq.com>
Co-authored-by: Yan Huai <compasty@163.com>
Co-authored-by: Liu Jing <anderson.liuj@antfin.com>
Co-authored-by: lylingzhen <101314559+lylingzhen@users.noreply.github.com>
Co-authored-by: chaya.cy <chaya.cy@antgroup.com>
Co-authored-by: 巨鹿 <290584697@qq.com>
  • Loading branch information
14 people authored Feb 1, 2024
1 parent d077390 commit e34491b
Show file tree
Hide file tree
Showing 16 changed files with 170 additions and 93 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</modules>

<properties>
<sofa.ark.version>3.0.2-SNAPSHOT</sofa.ark.version>
<sofa.ark.version>3.1.0-SNAPSHOT</sofa.ark.version>
<project.encoding>UTF-8</project.encoding>
<java.version>17</java.version>
<license.maven.plugin>3.0</license.maven.plugin>
Expand Down
14 changes: 1 addition & 13 deletions sofa-ark-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<maven.plugin.plugin>3.6.1</maven.plugin.plugin>
<surefire.version>2.22.2</surefire.version>
<netty.version>4.1.94.Final</netty.version>
<spring.boot.version>3.0.9</spring.boot.version>
<spring.boot.version>3.2.1</spring.boot.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -238,18 +238,6 @@
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>

<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>log-sofa-boot-starter</artifactId>
<version>${log.sofa.starter.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alipay.sofa.common</groupId>
<artifactId>sofa-common-tools</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public class DirectoryContainerArchive implements ContainerArchive {
"jakarta.inject-api-2.0.1", "logback-core-1.4.14", "logback-classic-1.4.14",
"slf4j-api-2.0.11", "sofa-common-tools", "netty-all-4.1.94.Final",
"netty-transport-4.1.94.Final", "netty-common-4.1.94.Final",
"netty-handler-4.1.94.Final", "netty-codec-4.1.94.Final", "netty-buffer-4.1.94.Final",
"sofa-ark-parent/core-impl/container/target/classes",
"jakarta.inject-api-2.0.1", "netty-handler-4.1.94.Final", "netty-codec-4.1.94.Final",
"netty-buffer-4.1.94.Final", "sofa-ark-parent/core-impl/container/target/classes",
"sofa-ark-parent/core-impl/archive/target/classes",
"sofa-ark-parent/core/spi/target/classes",
"sofa-ark-parent/core/common/target/classes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@
package com.alipay.sofa.ark.loader;

import com.alipay.sofa.ark.common.util.FileUtils;
import com.alipay.sofa.ark.loader.archive.JarFileArchive;
import com.alipay.sofa.ark.spi.archive.BizArchive;
import com.alipay.sofa.ark.spi.archive.Archive;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.boot.loader.archive.Archive;
import org.springframework.boot.loader.archive.JarFileArchive;

import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;

Expand All @@ -44,15 +42,16 @@ public void testGetContainerArchive() throws Exception {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
URL springbootFatJar = cl.getResource("sample-springboot-fat-biz.jar");
JarFileArchive jarFileArchive = new JarFileArchive(FileUtils.file(springbootFatJar.getFile()));
Iterator<Archive> archives = jarFileArchive.getNestedArchives(this::isNestedArchive,null);

List<Archive> archives = jarFileArchive.getNestedArchives(this::isNestedArchive);
List<URL> urls = new ArrayList<>();
while (archives.hasNext()){
urls.add(archives.next().getUrl());
for (Archive archive : archives) {
urls.add(archive.getUrl());
}

EmbedClassPathArchive archive = new EmbedClassPathArchive(
"com.alipay.sofa.ark.sample.springbootdemo.SpringbootDemoApplication", "main",
urls.toArray(new URL[] {}));
urls.toArray(new URL[]{}));
assertTrue(archive.getContainerArchive().getUrls().length != 0);
assertTrue(archive.getConfClasspath().size() != 0);
assertTrue(archive.getBizArchives().size() == 0);
Expand All @@ -77,15 +76,15 @@ public void testStaticCombineGetBizArchives() throws Exception {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
URL springbootFatJar = cl.getResource("static-combine-demo.jar");
JarFileArchive jarFileArchive = new JarFileArchive(FileUtils.file(springbootFatJar.getFile()));
Iterator<org.springframework.boot.loader.archive.Archive> archives = jarFileArchive.getNestedArchives(this::isNestedArchive,null);
List<Archive> archives = jarFileArchive.getNestedArchives(this::isNestedArchive);
List<URL> urls = new ArrayList<>();
while (archives.hasNext()){
urls.add(archives.next().getUrl());
for (Archive archive : archives) {
urls.add(archive.getUrl());
}
EmbedClassPathArchive archive = new EmbedClassPathArchive("com.alipay.sofa.ark.sample.springbootdemo.SpringbootDemoApplication",
"main",
urls.toArray(new URL[] {}));
urls.toArray(new URL[]{}));
List<BizArchive> bizArchives = archive.getBizArchives();
Assert.assertFalse(bizArchives==null||bizArchives.isEmpty());
Assert.assertFalse(bizArchives == null || bizArchives.isEmpty());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public void testFill() throws Exception {
new ByteArrayInputStream(new byte[0]), 0);
assertEquals(0, zipInflaterInputStream.available());
zipInflaterInputStream.fill();

Field field = ZipInflaterInputStream.class.getDeclaredField("extraBytesWritten");
field.setAccessible(true);
assertEquals(true, field.get(zipInflaterInputStream));
Expand Down
18 changes: 5 additions & 13 deletions sofa-ark-parent/core/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,15 @@
<artifactId>sofa-ark-common</artifactId>

<dependencies>

<!--SOFAArk modules-->
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-ark-spi</artifactId>
<groupId>com.alipay.sofa.common</groupId>
<artifactId>sofa-common-tools</artifactId>
<version>${sofa.common.tools.version}</version>
</dependency>

<!--third party library-->
<!--SOFAArk modules-->
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>log-sofa-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
</exclusion>
</exclusions>
<artifactId>sofa-ark-spi</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1065,5 +1065,4 @@ public static String getType() {
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<description>A light-weight, java based classloader-isolated framework open-sourced by Ant Financial.</description>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-ark-plugin-maven-plugin</artifactId>
<version>2.0.1-SNAPSHOT</version>
<version>3.0.1-SNAPSHOT</version>
<goalPrefix>sofa-ark</goalPrefix>
<isolatedRealm>false</isolatedRealm>
<inheritedByDefault>true</inheritedByDefault>
Expand Down Expand Up @@ -209,12 +209,6 @@
<type>jar</type>
<version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>log-sofa-boot-starter</artifactId>
<type>jar</type>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>com.alipay.sofa.common</groupId>
<artifactId>sofa-common-tools</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<modelVersion>4.0.0</modelVersion>

<properties>
<spring.boot.version>3.0.9</spring.boot.version>
<spring.boot.version>3.2.1</spring.boot.version>
</properties>

<artifactId>sofa-ark-springboot-starter</artifactId>
Expand Down Expand Up @@ -140,7 +140,13 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.17.1</version>
<version>2.19.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.19.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/
package com.alipay.sofa.ark.springboot.loader;

import org.springframework.boot.loader.LaunchedURLClassLoader;
import org.springframework.boot.loader.archive.Archive;
import org.springframework.boot.loader.launch.Archive;
import org.springframework.boot.loader.launch.LaunchedClassLoader;

import java.io.IOException;
import java.net.URL;
Expand All @@ -36,7 +36,7 @@
*
* @author bingjie.lbj
*/
public class CachedLaunchedURLClassLoader extends LaunchedURLClassLoader {
public class CachedLaunchedURLClassLoader extends LaunchedClassLoader {
private final Map<String, LoadClassResult> classCache = new ConcurrentHashMap<>(
3000);
private final Map<String, Optional<URL>> resourceUrlCache = new ConcurrentHashMap<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,24 @@
package com.alipay.sofa.ark.springboot.loader;

import java.net.URL;
import java.util.Collection;

/**
* A JarLauncher to load classes with CachedLaunchedURLClassLoader
*
* @author bingjie.lbj
*/
public class JarLauncher extends org.springframework.boot.loader.JarLauncher {
public class JarLauncher extends org.springframework.boot.loader.launch.JarLauncher {
public JarLauncher() throws Exception {
}

public static void main(String[] args) throws Exception {
new JarLauncher().launch(args);
}

@Override
protected ClassLoader createClassLoader(URL[] urls) throws Exception {
return new CachedLaunchedURLClassLoader(isExploded(), getArchive(), urls, getClass()
.getClassLoader());
protected ClassLoader createClassLoader(Collection<URL> urls) throws Exception {
return new CachedLaunchedURLClassLoader(isExploded(), getArchive(),
urls.toArray(new URL[0]), getClass().getClassLoader());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.alipay.sofa.ark.spi.service.ArkInject;
import com.alipay.sofa.ark.spi.service.biz.BizManagerService;
import com.alipay.sofa.ark.spi.web.EmbeddedServerService;
import org.springframework.boot.ssl.SslBundle;
import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory;
import org.springframework.boot.web.embedded.netty.NettyRouteProvider;
import org.springframework.boot.web.embedded.netty.NettyServerCustomizer;
Expand All @@ -35,6 +36,8 @@
import reactor.netty.http.server.HttpServer;
import reactor.netty.resources.LoopResources;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.InetSocketAddress;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
Expand All @@ -46,6 +49,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;

import static com.alipay.sofa.ark.spi.constant.Constants.ROOT_WEB_CONTEXT_PATH;

Expand Down Expand Up @@ -150,9 +154,30 @@ private HttpServer initEmbedNetty(){
}

private HttpServer customizeSslConfiguration(HttpServer httpServer) {
SslServerCustomizer sslServerCustomizer = new SslServerCustomizer(this.getSsl(),
this.getHttp2(), this.getSslStoreProvider());
return sslServerCustomizer.apply(httpServer);

SslServerCustomizer customizer = new SslServerCustomizer(this.getHttp2(), this.getSsl().getClientAuth(), this.getSslBundle());
String bundleName = this.getSsl().getBundle();
if (StringUtils.hasText(bundleName)) {
try{
// 找到类 SslServerCustomizer 的updateSslBundle方法
Method updateSslBundleMethod = SslServerCustomizer.class.getDeclaredMethod("updateSslBundle", SslBundle.class);
updateSslBundleMethod.setAccessible(true);

// 使用反射创建Consumer<SslBundle>
Consumer<SslBundle> consumer = sslBundle -> {
try {
// 通过反射调用updateSslBundle方法
updateSslBundleMethod.invoke(customizer, sslBundle);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
};
this.getSslBundles().addBundleUpdateHandler(bundleName, consumer);
}catch (Exception e){
throw new RuntimeException(e);
}
}
return customizer.apply(httpServer);
}

private HttpProtocol[] listProtocols() {
Expand Down
Loading

0 comments on commit e34491b

Please sign in to comment.