This is an automated email from the ASF dual-hosted git repository. zhangliang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/shardingsphere-elasticjob.git
The following commit(s) were added to refs/heads/master by this push: new 45d28f2 Add event trace spring boot starter usage document (#1162) 45d28f2 is described below commit 45d28f2f75b8a9b851bd8ad344e3c9db1810d8c3 Author: 吴伟杰 <root496879...@me.com> AuthorDate: Sun Jul 19 16:28:56 2020 +0800 Add event trace spring boot starter usage document (#1162) --- .../usage/event-trace/spring-boot-starter.cn.md | 42 ++++++++++++++++++++- .../usage/event-trace/spring-boot-starter.en.md | 43 +++++++++++++++++++++- 2 files changed, 81 insertions(+), 4 deletions(-) diff --git a/docs/content/user-manual/elasticjob-lite/usage/event-trace/spring-boot-starter.cn.md b/docs/content/user-manual/elasticjob-lite/usage/event-trace/spring-boot-starter.cn.md index 51b080d..acab7e1 100644 --- a/docs/content/user-manual/elasticjob-lite/usage/event-trace/spring-boot-starter.cn.md +++ b/docs/content/user-manual/elasticjob-lite/usage/event-trace/spring-boot-starter.cn.md @@ -1,7 +1,45 @@ +++ -title = "Spring Boot Starter" +title = "使用 Spring Boot Starter" weight = 2 chapter = true +++ -TODO +ElasticJob-Lite 提供了自动配置 TracingConfiguration 的 Tracing Spring Boot Starter, +开发者只需注册一个 DataSource 到 Spring 容器中, +Starter 就会自动创建一个 TracingConfiguration 并注册到 Spring 容器中。 + +## 引入 elasticjob-tracing-spring-boot-starter + +```xml +<dependency> + <groupId>org.apache.shardingsphere.elasticjob</groupId> + <artifactId>elasticjob-tracing-spring-boot-starter</artifactId> + <version>${elasticjob.latest.version}</version> +</dependency> +``` + +## 借助 spring-boot-starter-jdbc 注册 DataSource + +引入依赖: +```xml +<dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-jdbc</artifactId> + <version>${springboot.version}</version> +</dependency> +``` + +配置 DataSource: +```yaml +spring: + datasource: + url: jdbc:h2:mem:job_event_storage + driver-class-name: org.h2.Driver + username: sa + password: +``` + +## 使用 + +TracingConfiguration 会自动注册到容器中,如果与 elasticjob-lite-spring-boot-starter 配合使用, +开发者无需进行其他额外的操作,作业启动器会自动使用创建的 TracingConfiguration。 diff --git a/docs/content/user-manual/elasticjob-lite/usage/event-trace/spring-boot-starter.en.md b/docs/content/user-manual/elasticjob-lite/usage/event-trace/spring-boot-starter.en.md index 51b080d..5a481f0 100644 --- a/docs/content/user-manual/elasticjob-lite/usage/event-trace/spring-boot-starter.en.md +++ b/docs/content/user-manual/elasticjob-lite/usage/event-trace/spring-boot-starter.en.md @@ -1,7 +1,46 @@ +++ -title = "Spring Boot Starter" +title = "Use Spring Boot Starter" weight = 2 chapter = true +++ -TODO +ElasticJob-Lite provides a Spring Boot Starter to configure TracingConfiguration automatically. +What developers need to do is register a bean of DataSource into the Spring IoC Container. +Then the Starter will create an instance of TracingConfiguration and register it into the container. + +## Introduce elasticjob-tracing-spring-boot-starter dependency + +```xml +<dependency> + <groupId>org.apache.shardingsphere.elasticjob</groupId> + <artifactId>elasticjob-tracing-spring-boot-starter</artifactId> + <version>${elasticjob.latest.version}</version> +</dependency> +``` + +## Register DataSource via spring-boot-starter-jdbc + +Introduce dependency: +```xml +<dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-jdbc</artifactId> + <version>${springboot.version}</version> +</dependency> +``` + +Configure DataSource: +```yaml +spring: + datasource: + url: jdbc:h2:mem:job_event_storage + driver-class-name: org.h2.Driver + username: sa + password: +``` + +## Usage + +TracingConfiguration will be registered into the IoC container imperceptibly. +If elasticjob-lite-spring-boot-starter was introduced, developers need to do nothing else. +The instances of JobBootstrap will use the TracingConfiguration automatically.