ttl-spring-boot-starter

ttl

License

License

MIT
Categories

Categories

Spring Boot Container Microservices
GroupId

GroupId

com.github.dreamroute
ArtifactId

ArtifactId

ttl-spring-boot-starter
Last Version

Last Version

1.3-RELEASE
Release Date

Release Date

Type

Type

jar
Description

Description

ttl-spring-boot-starter
ttl
Project URL

Project URL

https://github.com/Dreamroute/ttl
Source Code Management

Source Code Management

https://github.com/Dreamroute/ttl

Download ttl-spring-boot-starter

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.dreamroute/ttl-spring-boot-starter/ -->
<dependency>
    <groupId>com.github.dreamroute</groupId>
    <artifactId>ttl-spring-boot-starter</artifactId>
    <version>1.3-RELEASE</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.dreamroute/ttl-spring-boot-starter/
implementation 'com.github.dreamroute:ttl-spring-boot-starter:1.3-RELEASE'
// https://jarcasting.com/artifacts/com.github.dreamroute/ttl-spring-boot-starter/
implementation ("com.github.dreamroute:ttl-spring-boot-starter:1.3-RELEASE")
'com.github.dreamroute:ttl-spring-boot-starter:jar:1.3-RELEASE'
<dependency org="com.github.dreamroute" name="ttl-spring-boot-starter" rev="1.3-RELEASE">
  <artifact name="ttl-spring-boot-starter" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.dreamroute', module='ttl-spring-boot-starter', version='1.3-RELEASE')
)
libraryDependencies += "com.github.dreamroute" % "ttl-spring-boot-starter" % "1.3-RELEASE"
[com.github.dreamroute/ttl-spring-boot-starter "1.3-RELEASE"]

Dependencies

compile (4)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-web jar 2.4.3
org.springframework.boot : spring-boot-configuration-processor Optional jar 2.4.3
org.projectlombok : lombok jar 1.18.18
com.alibaba : transmittable-thread-local jar 2.12.1

Project Modules

There are no modules declared in this project.

ttl

封装了阿里transmittable-thread-local工具,让SpringBoot应用更为简单的使用TTL

封装了阿里的ttl,封装的理由:使用agent的方式有点繁琐,需要修改启动命令,另外,本地IDE开发的时候总是需要配置jvm启动参数,参考了ttl项目的issue#152和#173,总结出来的。
使用方法

SpringBoot依赖:

<dependency>
    <groupId>com.github.dreamroute</groupId>
    <artifactId>ttl-spring-boot-starter</artifactId>
    <version>最新版本</version>
</dependency>

最新版本,点击查看

效果:
  • 系统中被@Async标记的方法回从Spring线程池中获取线程,获取到的线程已经被ttl处理过,对用来说是透明的
  • 如果系统中其他地方需要使用线程池,并且希望带着ThreadLocal信息,那么直接注入ExecutorService即可,starter已经将ExecutorService用ttl代理, 只要引入starter包,系统中任何地方注入ExecutorService,都可以享受到ThreadLocal的传递

Versions

Version
1.3-RELEASE
1.2-RELEASE
1.1-RELEASE
1.0-RELEASE