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

Commit

Permalink
Merge pull request #464 from sofastack/youji-dev
Browse files Browse the repository at this point in the history
format service samples
  • Loading branch information
lvjing2 authored Jan 11, 2024
2 parents 2614f26 + 39518ca commit bd5a950
Show file tree
Hide file tree
Showing 45 changed files with 50 additions and 46 deletions.
6 changes: 3 additions & 3 deletions samples/springboot-samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
<module>web/tomcat</module>
<module>web/webflux/base</module>
<module>web/webflux/biz</module>
<module>service/sample-service-base</module>
<module>service/sample-service-biz</module>
<module>service/sample-service-biz2</module>
<module>service/base</module>
<module>service/biz1</module>
<module>service/biz2</module>
<module>slimming/log4j2</module>
<module>msg/kafka/base</module>
<module>msg/kafka/biz1</module>
Expand Down
10 changes: 5 additions & 5 deletions samples/springboot-samples/service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ curl http://localhost:8080

#### 验证模块调用基座

访问 biz 的 web 服务
访问 biz1 的 web 服务
```shell
curl http://localhost:8080/biz/
curl http://localhost:8080/biz1/
```
返回 `hello to ark dynamic deploy`
返回 `hello to ark biz1 dynamic deploy`

且日志里能看到对基座base的调用都是成功的,证明模块通过 @AutowiredFromBase 或者 SpringServiceFinder.getBaseService() 方式调用基座是成功的

Expand All @@ -126,11 +126,11 @@ curl http://localhost:8080/biz/
```shell
curl http://localhost:8080/biz2/
```
返回 `hello to ark2 dynamic deploy`
返回 `hello to ark biz2 dynamic deploy`

且日志里能看到对模块biz的调用都是成功的,证明模块通过 @AutowiredFromBiz 或者 SpringServiceFinder.getModuleService 方式调用模块biz是成功的

## 注意事项
这里主要使用简单应用做验证,如果复杂应用,需要注意模块做好瘦身,基座有的依赖,模块尽可能设置成 provided,尽可能使用基座的依赖。
这里验证模块功能时,web接口后需要加上斜号,例如curl http://localhost:8080/biz/ ,而不是 http://localhost:8080/biz
这里验证模块功能时,web接口后需要加上斜号,例如curl http://localhost:8080/biz1/ ,而不是 http://localhost:8080/biz1

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>sample-service-base</artifactId>
<artifactId>base</artifactId>
<groupId>com.alipay.sofa.service</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
Expand Down Expand Up @@ -41,7 +41,7 @@
</dependency>
<dependency>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>biz-facade</artifactId>
<artifactId>biz1-facade</artifactId>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
spring.application.name=base
logging.file.path=./service/logs/
logging.path=./service/logs/
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>sample-service-base</artifactId>
<artifactId>base</artifactId>
<groupId>com.alipay.sofa.service</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
Expand All @@ -16,4 +16,4 @@
<maven.compiler.target>8</maven.compiler.target>
</properties>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>sample-service-base</artifactId>
<artifactId>base</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sample-service-base</name>
<description>sample-service-base</description>
Expand All @@ -34,7 +34,7 @@
</dependency>
<dependency>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>biz-facade</artifactId>
<artifactId>biz1-facade</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>sample-service-biz</artifactId>
<artifactId>biz1</artifactId>
<groupId>com.alipay.sofa.service</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>biz-bootstrap</artifactId>
<artifactId>biz1-bootstrap</artifactId>

<properties>
<maven.compiler.source>8</maven.compiler.source>
Expand All @@ -19,7 +19,7 @@
<dependencies>
<dependency>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>biz-facade</artifactId>
<artifactId>biz1-facade</artifactId>
</dependency>
<dependency>
<groupId>com.alipay.sofa.service</groupId>
Expand Down Expand Up @@ -72,13 +72,13 @@
<configuration>
<skipArkExecutable>true</skipArkExecutable>
<outputDirectory>target</outputDirectory>
<bizName>biz</bizName>
<bizName>biz1</bizName>
<!-- 单host下需更换 web context path -->
<webContextPath>biz</webContextPath>
<webContextPath>biz1</webContextPath>
<declaredMode>true</declaredMode>
</configuration>
</plugin>
</plugins>
</build>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ public String hello() {
System.out.println(result1);
}

return "hello to ark dynamic deploy";
return "hello to ark biz1 dynamic deploy";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
spring.application.name=biz
logging.file.path=./service/logs/
logging.path=./service/logs/
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>sample-service-biz</artifactId>
<artifactId>biz1</artifactId>
<groupId>com.alipay.sofa.service</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>biz-facade</artifactId>
<artifactId>biz1-facade</artifactId>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<modules>
<module>biz-bootstrap</module>
<module>biz-facade</module>
<module>biz1-bootstrap</module>
<module>biz1-facade</module>
</modules>
<parent>
<groupId>com.alipay.sofa</groupId>
Expand All @@ -14,7 +14,7 @@
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>sample-service-biz</artifactId>
<artifactId>biz1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sample-service-biz</name>
<description>sample-service-biz</description>
Expand All @@ -23,12 +23,12 @@
<dependencies>
<dependency>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>biz-facade</artifactId>
<artifactId>biz1-facade</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>biz-bootstrap</artifactId>
<artifactId>biz1-bootstrap</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>sample-service-biz2</artifactId>
<artifactId>biz2</artifactId>
<groupId>com.alipay.sofa.service</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
Expand All @@ -23,7 +23,7 @@
</dependency>
<dependency>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>biz-facade</artifactId>
<artifactId>biz1-facade</artifactId>
</dependency>
<dependency>
<groupId>com.alipay.sofa.service</groupId>
Expand Down Expand Up @@ -85,4 +85,4 @@
</plugins>
</build>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public class SampleController {
@AutowiredFromBase
private AppService appService;

@AutowiredFromBiz(bizName = "biz", bizVersion = "0.0.1-SNAPSHOT", name = "studentProvider")
@AutowiredFromBiz(bizName = "biz1", bizVersion = "0.0.1-SNAPSHOT", name = "studentProvider")
private Provider studentProvider;

@AutowiredFromBiz(bizName = "biz", name = "teacherProvider")
@AutowiredFromBiz(bizName = "biz1", name = "teacherProvider")
private Provider teacherProvider;

@AutowiredFromBiz(bizName = "biz", bizVersion = "0.0.1-SNAPSHOT")
@AutowiredFromBiz(bizName = "biz1", bizVersion = "0.0.1-SNAPSHOT")
private List<Provider> providers;

@RequestMapping(value = "/", method = RequestMethod.GET)
Expand Down Expand Up @@ -85,6 +85,6 @@ public String hello() {
Result result2 = providerMap.get(beanName).provide(new Param());
}

return "hello to ark2 dynamic deploy";
return "hello to ark biz2 dynamic deploy";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
spring.application.name=biz2
logging.file.path=./service/logs/
logging.path=./service/logs/
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>sample-service-biz2</artifactId>
<artifactId>biz2</artifactId>
<groupId>com.alipay.sofa.service</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
Expand All @@ -16,4 +16,4 @@
<maven.compiler.target>8</maven.compiler.target>
</properties>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>sample-service-biz2</artifactId>
<artifactId>biz2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sample-service-biz2</name>
<description>sample-service-biz2</description>
Expand All @@ -28,12 +28,12 @@
</dependency>
<dependency>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>biz-facade</artifactId>
<artifactId>biz1-facade</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>biz-bootstrap</artifactId>
<artifactId>biz1-bootstrap</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit bd5a950

Please sign in to comment.