Skip to content
This repository was archived by the owner on Feb 18, 2024. It is now read-only.

Commit b83af8a

Browse files
authored
Merge pull request #469 from sofastack/youji-dev
optimize pom defination
2 parents 2ab5540 + 4e3b20f commit b83af8a

File tree

15 files changed

+103
-167
lines changed

15 files changed

+103
-167
lines changed

samples/springboot-samples/pom.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@
3838
<module>web/tomcat</module>
3939
<module>web/webflux/base</module>
4040
<module>web/webflux/biz</module>
41-
<module>service/base</module>
42-
<module>service/biz1</module>
43-
<module>service/biz2</module>
41+
<module>service</module>
4442
<module>slimming/log4j2</module>
4543
<module>msg/kafka/base</module>
4644
<module>msg/kafka/biz1</module>

samples/springboot-samples/service/base/base-bootstrap/src/main/java/com/alipay/sofa/base/rest/SampleController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ public class SampleController {
2222
@RequestMapping(value = "/", method = RequestMethod.GET)
2323
public String hello() {
2424

25-
Provider studentProvider = SpringServiceFinder.getModuleService("biz", "0.0.1-SNAPSHOT",
25+
Provider studentProvider = SpringServiceFinder.getModuleService("biz1", "0.0.1-SNAPSHOT",
2626
"studentProvider", Provider.class);
2727
Result result = studentProvider.provide(new Param());
2828
System.out.println(result.getClass());
2929
System.out.println(result.isSuccess());
3030
System.out.println(result.getPeople().getClass());
3131
System.out.println(result);
3232

33-
Provider teacherProvider = SpringServiceFinder.getModuleService("biz", "0.0.1-SNAPSHOT",
33+
Provider teacherProvider = SpringServiceFinder.getModuleService("biz1", "0.0.1-SNAPSHOT",
3434
"teacherProvider", Provider.class);
3535
Result result1 = teacherProvider.provide(new Param());
3636
System.out.println(result1.getClass());
3737
System.out.println(result1.isSuccess());
3838
System.out.println(result1.getPeople().getClass());
3939
System.out.println(result1);
4040

41-
Map<String, Provider> providerMap = SpringServiceFinder.listModuleServices("biz", "0.0.1-SNAPSHOT",
41+
Map<String, Provider> providerMap = SpringServiceFinder.listModuleServices("biz1", "0.0.1-SNAPSHOT",
4242
Provider.class);
4343
for (String beanName : providerMap.keySet()) {
4444
Result result2 = providerMap.get(beanName).provide(new Param());

samples/springboot-samples/service/base/pom.xml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88
<module>base-bootstrap</module>
99
</modules>
1010
<parent>
11-
<groupId>com.alipay.sofa</groupId>
12-
<artifactId>springboot-samples</artifactId>
11+
<groupId>com.alipay.sofa.service</groupId>
12+
<artifactId>cross-biz-calling</artifactId>
1313
<version>0.0.1-SNAPSHOT</version>
14-
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
14+
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
1515
</parent>
16-
<groupId>com.alipay.sofa.service</groupId>
1716
<artifactId>base</artifactId>
1817
<version>0.0.1-SNAPSHOT</version>
19-
<name>sample-service-base</name>
20-
<description>sample-service-base</description>
2118
<packaging>pom</packaging>
2219

2320
<dependencyManagement>

samples/springboot-samples/service/biz1/pom.xml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88
<module>biz1-facade</module>
99
</modules>
1010
<parent>
11-
<groupId>com.alipay.sofa</groupId>
12-
<artifactId>springboot-samples</artifactId>
11+
<groupId>com.alipay.sofa.service</groupId>
12+
<artifactId>cross-biz-calling</artifactId>
1313
<version>0.0.1-SNAPSHOT</version>
14-
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
14+
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
1515
</parent>
16-
<groupId>com.alipay.sofa.service</groupId>
1716
<artifactId>biz1</artifactId>
1817
<version>0.0.1-SNAPSHOT</version>
19-
<name>sample-service-biz</name>
20-
<description>sample-service-biz</description>
2118

2219
<dependencyManagement>
2320
<dependencies>

samples/springboot-samples/service/biz2/pom.xml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88
<module>biz2-facade</module>
99
</modules>
1010
<parent>
11-
<groupId>com.alipay.sofa</groupId>
12-
<artifactId>springboot-samples</artifactId>
11+
<groupId>com.alipay.sofa.service</groupId>
12+
<artifactId>cross-biz-calling</artifactId>
1313
<version>0.0.1-SNAPSHOT</version>
14-
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
14+
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
1515
</parent>
16-
<groupId>com.alipay.sofa.service</groupId>
1716
<artifactId>biz2</artifactId>
1817
<version>0.0.1-SNAPSHOT</version>
19-
<name>sample-service-biz2</name>
20-
<description>sample-service-biz2</description>
2118

2219
<dependencyManagement>
2320
<dependencies>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>com.alipay.sofa</groupId>
7+
<artifactId>springboot-samples</artifactId>
8+
<version>0.0.1-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
10+
</parent>
11+
<groupId>com.alipay.sofa.service</groupId>
12+
<artifactId>cross-biz-calling</artifactId>
13+
<version>0.0.1-SNAPSHOT</version>
14+
<packaging>pom</packaging>
15+
16+
<modules>
17+
<module>base</module>
18+
<module>biz1</module>
19+
<module>biz2</module>
20+
</modules>
21+
</project>

samples/springboot3-samples/pom.xml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>3.0.9</version>
9+
<version>3.2.1</version>
1010
<relativePath/> <!-- lookup parent from repository -->
1111
</parent>
1212

@@ -18,10 +18,10 @@
1818
<packaging>pom</packaging>
1919

2020
<properties>
21-
<spring.boot.version>3.0.9</spring.boot.version>
21+
<spring.boot.version>3.2.1</spring.boot.version>
2222
<java.version>17</java.version>
2323
<sofa.ark.version>3.0.1</sofa.ark.version>
24-
<sofa.serverless.runtime.version>0.5.5-jdk17</sofa.serverless.runtime.version>
24+
<sofa.serverless.runtime.version>0.5.6-jdk17-SNAPSHOT</sofa.serverless.runtime.version>
2525
<disruptor.version>3.4.2</disruptor.version>
2626
<os.plugin.version>1.7.1</os.plugin.version>
2727
<protobuf.plugin.version>0.6.1</protobuf.plugin.version>
@@ -103,6 +103,25 @@
103103
<artifactId>sofa-serverless-app-starter</artifactId>
104104
<version>${sofa.serverless.runtime.version}</version>
105105
</dependency>
106+
107+
<dependency>
108+
<groupId>com.alipay.sofa</groupId>
109+
<artifactId>log-sofa-boot-starter</artifactId>
110+
<version>3.9.1</version>
111+
</dependency>
112+
113+
<dependency>
114+
<!-- 增加适配 springboot3 的 sofa-common-tools 版本 -->
115+
<groupId>com.alipay.sofa.common</groupId>
116+
<artifactId>sofa-common-tools</artifactId>
117+
<version>2.0.3</version>
118+
<exclusions>
119+
<exclusion>
120+
<groupId>com.google.guava</groupId>
121+
<artifactId>*</artifactId>
122+
</exclusion>
123+
</exclusions>
124+
</dependency>
106125
</dependencies>
107126
</dependencyManagement>
108127

@@ -133,4 +152,4 @@
133152
</profile>
134153
</profiles>
135154

136-
</project>
155+
</project>

sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ArkletComponentRegistry.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
*/
4343
public class ArkletComponentRegistry {
4444

45-
private static final ArkletLogger LOGGER = ArkletLoggerFactory.getDefaultLogger();
46-
4745
private static final Injector componentInjector = Guice
4846
.createInjector(new ComponentGuiceModule());
4947

@@ -60,20 +58,20 @@ public class ArkletComponentRegistry {
6058

6159
private static void initComponents() {
6260
String components = componentList.stream().map(s -> s.getClass().getSimpleName()).collect(Collectors.joining(", "));
63-
LOGGER.info("found components: {}", components);
64-
LOGGER.info("start to initialize components");
61+
ArkletLoggerFactory.getDefaultLogger().info("found components: {}", components);
62+
ArkletLoggerFactory.getDefaultLogger().info("start to initialize components");
6563
for (ArkletComponent component : componentList) {
6664
component.init();
6765
}
68-
LOGGER.info("finish initialize components");
66+
ArkletLoggerFactory.getDefaultLogger().info("finish initialize components");
6967
}
7068

7169
private static void destroyComponents() {
72-
LOGGER.info("start to destroy components");
70+
ArkletLoggerFactory.getDefaultLogger().info("start to destroy components");
7371
for (ArkletComponent component : componentList) {
7472
component.destroy();
7573
}
76-
LOGGER.info("finish destroy components");
74+
ArkletLoggerFactory.getDefaultLogger().info("finish destroy components");
7775
}
7876

7977
public static UnifiedOperationService getOperationServiceInstance() {

sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/record/ProcessRecord.java

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,29 @@
3737
@Setter
3838
public class ProcessRecord {
3939

40-
private static final ArkletLogger LOGGER = ArkletLoggerFactory.getDefaultLogger();
40+
private String requestId;
4141

42-
private String requestId;
42+
private ArkBizMeta arkBizMeta;
4343

44-
private ArkBizMeta arkBizMeta;
44+
private String threadName;
4545

46-
private String threadName;
46+
private Status status;
4747

48-
private Status status;
48+
private Throwable throwable;
4949

50-
private Throwable throwable;
50+
private String errorCode;
5151

52-
private String errorCode;
52+
private String message;
5353

54-
private String message;
54+
private Date startTime;
5555

56-
private Date startTime;
56+
private long startTimestamp;
5757

58-
private long startTimestamp;
58+
private Date endTime;
5959

60-
private Date endTime;
60+
private long endTimestamp;
6161

62-
private long endTimestamp;
63-
64-
private long elapsedTime;
62+
private long elapsedTime;
6563

6664
public enum Status {
6765

@@ -102,21 +100,24 @@ public boolean finished() {
102100
public void start() {
103101
if (INITIALIZED.equals(getStatus())) {
104102
setStatus(EXECUTING);
105-
LOGGER.info("Command execution status change: INIT -> EXECUTING");
103+
ArkletLoggerFactory.getDefaultLogger().info(
104+
"Command execution status change: INIT -> EXECUTING");
106105
}
107106
}
108107

109108
public void success() {
110109
if (EXECUTING.equals(getStatus())) {
111110
setStatus(SUCCEEDED);
112-
LOGGER.info("Command execution status change: EXECUTING -> SUCCESS");
111+
ArkletLoggerFactory.getDefaultLogger().info(
112+
"Command execution status change: EXECUTING -> SUCCESS");
113113
}
114114
}
115115

116116
public void fail() {
117117
if (EXECUTING.equals(getStatus())) {
118118
setStatus(FAILED);
119-
LOGGER.info("Command execution status change: EXECUTING -> FAIL");
119+
ArkletLoggerFactory.getDefaultLogger().info(
120+
"Command execution status change: EXECUTING -> FAIL");
120121
}
121122
}
122123

sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/HealthServiceImpl.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
*/
1717
package com.alipay.sofa.serverless.arklet.core.health;
1818

19-
import com.alibaba.fastjson.JSON;
20-
import com.alibaba.fastjson.JSONObject;
2119
import com.alipay.sofa.ark.api.ArkClient;
2220
import com.alipay.sofa.ark.common.util.AssertUtils;
2321
import com.alipay.sofa.ark.common.util.StringUtils;
@@ -47,7 +45,6 @@
4745
@Singleton
4846
public class HealthServiceImpl implements HealthService {
4947

50-
private static final ArkletLogger LOGGER = ArkletLoggerFactory.getDefaultLogger();
5148
private final HealthBuilder healthBuilder = new HealthBuilder();
5249

5350
private final Map<String, Indicator> indicators = new ConcurrentHashMap<>(3);
@@ -190,7 +187,8 @@ public Indicator getIndicator(String indicatorId) {
190187
@Override
191188
public void registerIndicator(Indicator indicator) {
192189
this.indicators.put(indicator.getIndicatorId(), indicator);
193-
LOGGER.info("register indicator " + indicator.getIndicatorId());
190+
ArkletLoggerFactory.getDefaultLogger().info(
191+
"register indicator " + indicator.getIndicatorId());
194192
}
195193

196194
private void initIndicators() {

0 commit comments

Comments
 (0)