接入到nacos
This commit is contained in:
parent
ac27658665
commit
0085f6bfc5
|
|
@ -31,7 +31,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<version>2.3.4.RELEASE</version>
|
||||
<version>${springboot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
<version>2.7.6</version>
|
||||
<version>2.8.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
|
@ -75,6 +75,8 @@
|
|||
<version>9.0.38</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
package cn.org.gitlink.notification.common.utils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
|
@ -96,7 +98,7 @@ public class RedisUtil {
|
|||
if (key.length == 1) {
|
||||
redisTemplate.delete(key[0]);
|
||||
} else {
|
||||
redisTemplate.delete(CollectionUtils.arrayToList(key));
|
||||
redisTemplate.delete((Collection) CollectionUtils.arrayToList(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,35 @@
|
|||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<version>${springboot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
<!-- knife4j -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>${knife4j-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>2.0.1.Final</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
@ -41,6 +70,7 @@
|
|||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ package cn.org.gitlink.notification.executor;
|
|||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@ComponentScan("cn.org.gitlink.notification.*")
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement
|
||||
@EnableDiscoveryClient
|
||||
public class ExecutorApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ExecutorApplication.class, args);}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,22 @@ logging:
|
|||
config: classpath:logback.xml
|
||||
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: microservices-gns-executor
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: nacos:8848
|
||||
# username: nacos
|
||||
# password: nacos
|
||||
kafka:
|
||||
producer:
|
||||
bootstrap_servers: kafka1:9092,kafka2:9092
|
||||
|
|
@ -44,7 +60,7 @@ spring:
|
|||
timeout: 1000
|
||||
|
||||
datasource:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://mysql:3306/gitlink_notification?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2B8&allowMultiQueries=true&useSSL=false
|
||||
username: gitlink
|
||||
password: giTlinK0^827
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ KAFKA_CONTAINER_02_NAME=gitlink_kafka_02
|
|||
GNS_EXECUTOR_CONTAINER_NAME=gns_executor
|
||||
GNS_READER_CONTAINER_NAME=gns_reader
|
||||
GNS_WRITER_CONTAINER_NAME=gns_writer
|
||||
NACOS_CONTAINER_NAME=nacos-test
|
||||
|
||||
#============================================ Ports config ============================================
|
||||
|
||||
|
|
|
|||
|
|
@ -121,6 +121,8 @@ services:
|
|||
- kafka2
|
||||
- redis
|
||||
- mysql
|
||||
external_links:
|
||||
- ${NACOS_CONTAINER_NAME}:nacos
|
||||
ports:
|
||||
- ${GNS_READER_LOCAL_PORT}:8081
|
||||
restart: always
|
||||
|
|
@ -143,6 +145,8 @@ services:
|
|||
- kafka2
|
||||
- redis
|
||||
- mysql
|
||||
external_links:
|
||||
- ${NACOS_CONTAINER_NAME}:nacos
|
||||
ports:
|
||||
- ${GNS_WRITER_LOCAL_PORT}:8082
|
||||
restart: always
|
||||
|
|
@ -165,6 +169,8 @@ services:
|
|||
- kafka2
|
||||
- redis
|
||||
- mysql
|
||||
external_links:
|
||||
- ${NACOS_CONTAINER_NAME}:nacos
|
||||
ports:
|
||||
- ${GNS_EXECUTOR_LOCAL_PORT}:8083
|
||||
restart: always
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<configuration>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
|
|
@ -35,24 +36,26 @@
|
|||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- mybatis-plus begin -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<version>3.5.5</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<version>3.5.5</version>
|
||||
</dependency>
|
||||
<!-- mybatis-plus end -->
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.38</version>
|
||||
<version>8.0.31</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
@ -75,7 +78,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<version>2.3.4.RELEASE</version>
|
||||
<version>${springboot.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
package cn.org.gitlink.notification.model.config;
|
||||
|
||||
import cn.org.gitlink.notification.model.handler.MetaHandler;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.core.config.GlobalConfig;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
@ -13,13 +15,28 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||
@MapperScan("cn.org.gitlink.notification.model.dao")
|
||||
public class MyBatisPlusConfig {
|
||||
|
||||
// /**
|
||||
// * 分页插件
|
||||
// */
|
||||
// @Bean
|
||||
// public PaginationInnerInterceptor paginationInterceptor() {
|
||||
// PaginationInnerInterceptor paginationInterceptor = new PaginationInnerInterceptor();
|
||||
// return paginationInterceptor;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 分页插件
|
||||
*/
|
||||
@Bean
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
|
||||
return paginationInterceptor;
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
PaginationInnerInterceptor paginationInterceptor = new PaginationInnerInterceptor(DbType.MYSQL);
|
||||
// 配置分页参数
|
||||
paginationInterceptor.setMaxLimit(500L);
|
||||
// 设置分页参数的封装方式,默认为false,即不封装分页参数
|
||||
paginationInterceptor.setOverflow(false);
|
||||
interceptor.addInnerInterceptor(paginationInterceptor);
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
34
pom.xml
34
pom.xml
|
|
@ -26,30 +26,26 @@
|
|||
<skipTests>true</skipTests>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<springboot.version>2.3.4.RELEASE</springboot.version>
|
||||
<!-- <springboot.version>2.3.12.RELEASE</springboot.version>-->
|
||||
<springboot.version>2.7.7</springboot.version>
|
||||
<spring-boot.version>2.7.7</spring-boot.version>
|
||||
<spring-cloud.version>2021.0.5</spring-cloud.version>
|
||||
<spring-cloud-alibaba.version>2021.0.4.0</spring-cloud-alibaba.version>
|
||||
<swagger.fox.version>3.0.0</swagger.fox.version>
|
||||
<knife4j-spring-ui.version>3.0.3</knife4j-spring-ui.version>
|
||||
<knife4j-spring-boot-starter.version>3.0.3</knife4j-spring-boot-starter.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>swagger-bootstrap-ui</artifactId>
|
||||
<version>1.9.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-discovery-spring-boot-starter</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>2.0.5</version>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
|
|
@ -59,7 +55,7 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.10</version>
|
||||
<version>3.12.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,36 @@
|
|||
<artifactId>gns-model</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<version>${springboot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
<!-- knife4j -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>${knife4j-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>2.0.1.Final</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
@ -37,6 +67,7 @@
|
|||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ package cn.org.gitlink.notification.reader;
|
|||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@ComponentScan("cn.org.gitlink.notification.*")
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement
|
||||
@EnableDiscoveryClient
|
||||
public class ReaderApiApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ReaderApiApplication.class, args);
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ package cn.org.gitlink.notification.reader.config;
|
|||
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
|
|
@ -15,6 +14,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|||
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
@EnableWebMvc
|
||||
@EnableKnife4j
|
||||
public class SwaggerConfig {
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -5,7 +5,19 @@ logging:
|
|||
config: classpath:logback.xml
|
||||
|
||||
spring:
|
||||
|
||||
application:
|
||||
# 应用名称
|
||||
name: microservices-gns-reader
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: nacos:8848
|
||||
# username: nacos
|
||||
# password: nacos
|
||||
redis:
|
||||
database: 0
|
||||
host: redis
|
||||
|
|
@ -19,7 +31,7 @@ spring:
|
|||
timeout: 1000
|
||||
|
||||
datasource:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://mysql:3306/gitlink_notification?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2B8&allowMultiQueries=true&useSSL=false
|
||||
username: gitlink
|
||||
password: giTlinK0^827
|
||||
|
|
|
|||
|
|
@ -32,6 +32,34 @@
|
|||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<version>${springboot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
<!-- knife4j -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>${knife4j-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>2.0.1.Final</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
@ -39,6 +67,7 @@
|
|||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ package cn.org.gitlink.notification;
|
|||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@ComponentScan("cn.org.gitlink.notification.*")
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement
|
||||
@EnableDiscoveryClient
|
||||
public class WriterApiApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(WriterApiApplication.class, args);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,19 @@ logging:
|
|||
config: classpath:logback.xml
|
||||
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: microservices-gns-writer
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: nacos:8848
|
||||
# username: nacos
|
||||
# password: nacos
|
||||
kafka:
|
||||
producer:
|
||||
bootstrap_servers: kafka1:9092,kafka2:9092
|
||||
|
|
@ -30,7 +43,7 @@ spring:
|
|||
timeout: 1000
|
||||
|
||||
datasource:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://mysql:3306/gitlink_notification?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2B8&allowMultiQueries=true&useSSL=false
|
||||
username: gitlink
|
||||
password: giTlinK0^827
|
||||
|
|
|
|||
Loading…
Reference in New Issue