-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b8ff77
commit 94e8f3e
Showing
343 changed files
with
51,495 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Copyright (c) 2015-present, xuxueli. | ||
|
||
Dependencies: | ||
================================================================ | ||
|
||
Spring: | ||
|
||
* LICENSE: | ||
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0) | ||
* HOMEPAGE: | ||
* http://www.springsource.org | ||
|
||
Netty: | ||
|
||
* LICENSE: | ||
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0) | ||
* HOMEPAGE: | ||
* https://github.com/netty/netty | ||
|
||
Hessian: | ||
|
||
* LICENSE: | ||
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0) | ||
* HOMEPAGE: | ||
* http://hessian.caucho.com | ||
|
||
SLF4J: | ||
|
||
* LICENSE: | ||
* http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0) | ||
* HOMEPAGE: | ||
* http://www.slf4j.org |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.3.2.RELEASE</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
<groupId>xyz.zhouzhaodong</groupId> | ||
<artifactId>demo</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<name>demo</name> | ||
<description>Demo project for Spring Boot</description> | ||
|
||
<properties> | ||
<java.version>1.8</java.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<!-- 导入xxl-job依赖 --> | ||
<dependency> | ||
<groupId>com.xuxueli</groupId> | ||
<artifactId>xxl-job-core</artifactId> | ||
<version>2.2.0</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.junit.vintage</groupId> | ||
<artifactId>junit-vintage-engine</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
13 changes: 13 additions & 0 deletions
13
xxl-job/demo/src/main/java/xyz/zhouzhaodong/demo/DemoApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package xyz.zhouzhaodong.demo; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class DemoApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(DemoApplication.class, args); | ||
} | ||
|
||
} |
77 changes: 77 additions & 0 deletions
77
xxl-job/demo/src/main/java/xyz/zhouzhaodong/demo/config/XxlJobConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package xyz.zhouzhaodong.demo.config; | ||
|
||
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
/** | ||
* xxl-job配置类 | ||
* @author 84266 | ||
*/ | ||
@Configuration | ||
public class XxlJobConfig { | ||
private final Logger logger = LoggerFactory.getLogger(XxlJobConfig.class); | ||
|
||
@Value("${xxl.job.admin.addresses}") | ||
private String adminAddresses; | ||
|
||
@Value("${xxl.job.accessToken}") | ||
private String accessToken; | ||
|
||
@Value("${xxl.job.executor.appname}") | ||
private String appname; | ||
|
||
@Value("${xxl.job.executor.address}") | ||
private String address; | ||
|
||
@Value("${xxl.job.executor.ip}") | ||
private String ip; | ||
|
||
@Value("${xxl.job.executor.port}") | ||
private int port; | ||
|
||
@Value("${xxl.job.executor.logpath}") | ||
private String logPath; | ||
|
||
@Value("${xxl.job.executor.logretentiondays}") | ||
private int logRetentionDays; | ||
|
||
|
||
@Bean | ||
public XxlJobSpringExecutor xxlJobExecutor() { | ||
logger.info(">>>>>>>>>>> xxl-job config init."); | ||
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); | ||
xxlJobSpringExecutor.setAdminAddresses(adminAddresses); | ||
xxlJobSpringExecutor.setAppname(appname); | ||
xxlJobSpringExecutor.setAddress(address); | ||
xxlJobSpringExecutor.setIp(ip); | ||
xxlJobSpringExecutor.setPort(port); | ||
xxlJobSpringExecutor.setAccessToken(accessToken); | ||
xxlJobSpringExecutor.setLogPath(logPath); | ||
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); | ||
|
||
return xxlJobSpringExecutor; | ||
} | ||
|
||
/** | ||
* 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP; | ||
* | ||
* 1、引入依赖: | ||
* <dependency> | ||
* <groupId>org.springframework.cloud</groupId> | ||
* <artifactId>spring-cloud-commons</artifactId> | ||
* <version>${version}</version> | ||
* </dependency> | ||
* | ||
* 2、配置文件,或者容器启动变量 | ||
* spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.' | ||
* | ||
* 3、获取IP | ||
* String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); | ||
*/ | ||
|
||
|
||
} |
Oops, something went wrong.