Skip to content

Commit f041ccc

Browse files
author
binbin.hou
committedAug 6, 2020
release branch 0.0.4
1 parent 3888020 commit f041ccc

File tree

16 files changed

+218
-82
lines changed

16 files changed

+218
-82
lines changed
 

‎doc/CHANGELOG.md renamed to ‎CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,10 @@
2525

2626
| 序号 | 变更类型 | 说明 | 时间 | 备注 |
2727
|:---|:---|:---|:---|:--|
28-
| 1 | A | 添加 spring 整合实现 | 2020-7-30 23:06:40 | |
28+
| 1 | A | 添加 spring 整合实现 | 2020-7-30 23:06:40 | |
29+
30+
# release_0.0.4
31+
32+
| 序号 | 变更类型 | 说明 | 时间 | 备注 |
33+
|:---|:---|:---|:---|:--|
34+
| 1 | A | 添加 spring-boot 整合实现 | 2020-08-06 23:06:40 | |

‎async-api/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>async</artifactId>
77
<groupId>com.github.houbb</groupId>
8-
<version>0.0.4-SNAPSHOT</version>
8+
<version>0.0.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

‎async-core/pom.xml

+3-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>async</artifactId>
77
<groupId>com.github.houbb</groupId>
8-
<version>0.0.4-SNAPSHOT</version>
8+
<version>0.0.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

@@ -28,11 +28,9 @@
2828
<groupId>${project.groupId}</groupId>
2929
<artifactId>log-integration</artifactId>
3030
</dependency>
31-
32-
<!--============================== OTHER ==============================-->
3331
<dependency>
34-
<groupId>cglib</groupId>
35-
<artifactId>cglib</artifactId>
32+
<groupId>com.github.houbb</groupId>
33+
<artifactId>aop-core</artifactId>
3634
</dependency>
3735
</dependencies>
3836

‎async-spring/pom.xml

+3-26
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>async</artifactId>
77
<groupId>com.github.houbb</groupId>
8-
<version>0.0.4-SNAPSHOT</version>
8+
<version>0.0.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

@@ -20,31 +20,8 @@
2020

2121
<!--spring-->
2222
<dependency>
23-
<groupId>org.springframework</groupId>
24-
<artifactId>spring-aop</artifactId>
25-
<version>${spring.version}</version>
26-
</dependency>
27-
<dependency>
28-
<groupId>org.springframework</groupId>
29-
<artifactId>spring-context</artifactId>
30-
<version>${spring.version}</version>
31-
</dependency>
32-
<dependency>
33-
<groupId>org.springframework</groupId>
34-
<artifactId>spring-test</artifactId>
35-
<version>${spring.version}</version>
36-
<scope>test</scope>
37-
</dependency>
38-
39-
<dependency>
40-
<groupId>org.aspectj</groupId>
41-
<artifactId>aspectjweaver</artifactId>
42-
<version>${aspectj.version}</version>
43-
</dependency>
44-
<dependency>
45-
<groupId>org.aspectj</groupId>
46-
<artifactId>aspectjrt</artifactId>
47-
<version>${aspectj.version}</version>
23+
<groupId>com.github.houbb</groupId>
24+
<artifactId>aop-spring</artifactId>
4825
</dependency>
4926
</dependencies>
5027

‎async-springboot-starter/pom.xml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>async</artifactId>
7+
<groupId>com.github.houbb</groupId>
8+
<version>0.0.4</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>async-springboot-starter</artifactId>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>${project.groupId}</groupId>
17+
<artifactId>async-spring</artifactId>
18+
</dependency>
19+
20+
<dependency>
21+
<groupId>org.springframework.boot</groupId>
22+
<artifactId>spring-boot-starter</artifactId>
23+
</dependency>
24+
</dependencies>
25+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.github.houbb.async.springboot.starter.config;
2+
3+
import com.github.houbb.async.spring.annotation.EnableAsync;
4+
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
5+
import org.springframework.context.annotation.Configuration;
6+
7+
/**
8+
* 异步配置
9+
* @author binbin.hou
10+
* @since 0.0.4
11+
*/
12+
@Configuration
13+
@ConditionalOnClass(EnableAsync.class)
14+
@EnableAsync
15+
public class AsyncAutoConfig {
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package com.github.houbb.async.springboot.starter;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.github.houbb.async.springboot.starter.config.AsyncAutoConfig

‎async-test/pom.xml

+3-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>async</artifactId>
77
<groupId>com.github.houbb</groupId>
8-
<version>0.0.4-SNAPSHOT</version>
8+
<version>0.0.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

@@ -28,13 +28,8 @@
2828

2929
<!--============================== SELF ==============================-->
3030
<dependency>
31-
<groupId>junit</groupId>
32-
<artifactId>junit</artifactId>
33-
</dependency>
34-
35-
<dependency>
36-
<groupId>org.springframework</groupId>
37-
<artifactId>spring-test</artifactId>
31+
<groupId>com.github.houbb</groupId>
32+
<artifactId>test-spring</artifactId>
3833
</dependency>
3934
</dependencies>
4035

‎async-test2/pom.xml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>async</artifactId>
7+
<groupId>com.github.houbb</groupId>
8+
<version>0.0.4</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>async-test2</artifactId>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>com.github.houbb</groupId>
17+
<artifactId>async-springboot-starter</artifactId>
18+
</dependency>
19+
20+
<dependency>
21+
<groupId>com.github.houbb</groupId>
22+
<artifactId>test-spring</artifactId>
23+
</dependency>
24+
</dependencies>
25+
26+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.github.houbb.async.test2;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
/**
7+
* @author binbin.hou
8+
* @since 0.0.4
9+
*/
10+
@SpringBootApplication
11+
public class AsyncApplication {
12+
13+
public static void main(String[] args) {
14+
SpringApplication.run(AsyncApplication.class, args);
15+
}
16+
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.github.houbb.async.test2.service;
2+
3+
import com.github.houbb.async.core.model.async.AsyncResult;
4+
5+
/**
6+
* 用户服务接口
7+
* @author binbin.hou
8+
* @since 0.0.4
9+
*/
10+
public interface UserService {
11+
12+
/**
13+
* 查询用户信息
14+
* @param id 主键
15+
* @return 结果
16+
*/
17+
AsyncResult<String> queryUser(final String id);
18+
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.github.houbb.async.test2.service.impl;
2+
3+
import com.github.houbb.async.api.annotation.Async;
4+
import com.github.houbb.async.core.model.async.AsyncResult;
5+
import com.github.houbb.async.test2.service.UserService;
6+
import org.springframework.stereotype.Service;
7+
8+
import java.util.concurrent.TimeUnit;
9+
10+
/**
11+
* 用户实现类
12+
* @author binbin.hou
13+
* @since 0.0.4
14+
*/
15+
@Service
16+
public class UserServiceImpl implements UserService {
17+
18+
@Override
19+
@Async
20+
public AsyncResult<String> queryUser(String id) {
21+
System.out.println("开始根据用户id 查询用户信息 " + id);
22+
try {
23+
// 沉睡模拟处理耗时
24+
TimeUnit.SECONDS.sleep(3);
25+
} catch (InterruptedException e) {
26+
e.printStackTrace();
27+
}
28+
final String result = id + "-result";
29+
System.out.println("结束根据用户id 查询用户信息 " + result);
30+
31+
AsyncResult<String> asyncResult = new AsyncResult<>();
32+
asyncResult.setValue(result);
33+
return asyncResult;
34+
}
35+
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.github.houbb.async.test2;
2+
3+
import com.github.houbb.async.core.model.async.AsyncResult;
4+
import com.github.houbb.async.test2.service.UserService;
5+
import org.junit.Test;
6+
import org.junit.runner.RunWith;
7+
import org.springframework.beans.factory.annotation.Autowired;
8+
import org.springframework.test.context.ContextConfiguration;
9+
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
10+
11+
/**
12+
* @author binbin.hou
13+
* @since 1.0.0
14+
*/
15+
@RunWith(SpringJUnit4ClassRunner.class)
16+
@ContextConfiguration(classes = AsyncApplication.class)
17+
public class UserServiceTest {
18+
19+
@Autowired
20+
private UserService userService;
21+
22+
@Test
23+
public void userAysncTest() {
24+
long start = System.currentTimeMillis();
25+
AsyncResult<String> result = userService.queryUser("123");
26+
AsyncResult<String> result2 = userService.queryUser("1234");
27+
28+
System.out.println("查询结果" + result.getResult());
29+
System.out.println("查询结果" + result2.getResult());
30+
long end = System.currentTimeMillis();
31+
System.out.println("共计耗时: " + (end-start));
32+
}
33+
34+
}

‎pom.xml

+24-39
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
<groupId>com.github.houbb</groupId>
88
<artifactId>async</artifactId>
99
<packaging>pom</packaging>
10-
<version>0.0.4-SNAPSHOT</version>
10+
<version>0.0.4</version>
1111
<modules>
1212
<module>async-api</module>
1313
<module>async-core</module>
1414
<module>async-test</module>
1515
<module>async-spring</module>
16+
<module>async-springboot-starter</module>
17+
<module>async-test2</module>
1618
</modules>
1719

1820

@@ -38,12 +40,11 @@
3840
<!--============================== INTER ==============================-->
3941
<heaven.version>0.1.112</heaven.version>
4042
<log-integration.version>1.1.8</log-integration.version>
43+
<aop.version>0.0.2</aop.version>
44+
<test.version>0.0.1</test.version>
4145

4246
<!--============================== OTHER ==============================-->
43-
<junit.version>4.12</junit.version>
44-
<cglib.version>3.1</cglib.version>
45-
<spring.version>4.3.24.RELEASE</spring.version>
46-
<aspectj.version>1.8.5</aspectj.version>
47+
<spring-boot.version>1.5.22.RELEASE</spring-boot.version>
4748
</properties>
4849

4950
<dependencyManagement>
@@ -65,6 +66,11 @@
6566
<artifactId>async-spring</artifactId>
6667
<version>${project.version}</version>
6768
</dependency>
69+
<dependency>
70+
<groupId>${project.groupId}</groupId>
71+
<artifactId>async-springboot-starter</artifactId>
72+
<version>${project.version}</version>
73+
</dependency>
6874

6975
<!--============================== INTER ==============================-->
7076
<dependency>
@@ -78,48 +84,27 @@
7884
<version>${log-integration.version}</version>
7985
</dependency>
8086

81-
<!--============================== OTHER ==============================-->
82-
<dependency>
83-
<groupId>junit</groupId>
84-
<artifactId>junit</artifactId>
85-
<version>${junit.version}</version>
86-
<optional>true</optional>
87-
<scope>test</scope>
88-
</dependency>
89-
90-
<dependency>
91-
<groupId>cglib</groupId>
92-
<artifactId>cglib</artifactId>
93-
<version>${cglib.version}</version>
94-
</dependency>
95-
96-
<!--spring-->
9787
<dependency>
98-
<groupId>org.springframework</groupId>
99-
<artifactId>spring-aop</artifactId>
100-
<version>${spring.version}</version>
88+
<groupId>com.github.houbb</groupId>
89+
<artifactId>aop-core</artifactId>
90+
<version>${aop.version}</version>
10191
</dependency>
10292
<dependency>
103-
<groupId>org.springframework</groupId>
104-
<artifactId>spring-context</artifactId>
105-
<version>${spring.version}</version>
106-
</dependency>
107-
<dependency>
108-
<groupId>org.springframework</groupId>
109-
<artifactId>spring-test</artifactId>
110-
<version>${spring.version}</version>
111-
<scope>test</scope>
93+
<groupId>com.github.houbb</groupId>
94+
<artifactId>aop-spring</artifactId>
95+
<version>${aop.version}</version>
11296
</dependency>
11397

11498
<dependency>
115-
<groupId>org.aspectj</groupId>
116-
<artifactId>aspectjweaver</artifactId>
117-
<version>${aspectj.version}</version>
99+
<groupId>com.github.houbb</groupId>
100+
<artifactId>test-spring</artifactId>
101+
<version>${test.version}</version>
118102
</dependency>
103+
<!--============================== OTHER ==============================-->
119104
<dependency>
120-
<groupId>org.aspectj</groupId>
121-
<artifactId>aspectjrt</artifactId>
122-
<version>${aspectj.version}</version>
105+
<groupId>org.springframework.boot</groupId>
106+
<artifactId>spring-boot-starter</artifactId>
107+
<version>${spring-boot.version}</version>
123108
</dependency>
124109

125110
</dependencies>

‎release.bat

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ ECHO "============================= RELEASE START..."
1010

1111
:: 版本号信息(需要手动指定)
1212
:::: 旧版本名称
13-
SET version=0.0.3
13+
SET version=0.0.4
1414
:::: 新版本名称
15-
SET newVersion=0.0.4
15+
SET newVersion=0.0.5
1616
:::: 组织名称
1717
SET groupName=com.github.houbb
1818
:::: 项目名称

0 commit comments

Comments
 (0)
Please sign in to comment.