feat:springboot升级2.4.2,springcloud升级至2020.0.0

This commit is contained in:
hxrui 2021-01-26 20:17:51 +08:00
parent 9a437852f1
commit b22943cffc
9 changed files with 60 additions and 41 deletions

View File

@ -1,5 +1,5 @@
![](https://img.shields.io/badge/SpringBoot-2.3.6-brightgreen.svg)
![](https://img.shields.io/badge/SpringCloud-Hoxton.SR9-green.svg)
![](https://img.shields.io/badge/SpringBoot-2.4.2-brightgreen.svg)
![](https://img.shields.io/badge/SpringCloud-2020.0.0-green.svg)
## **项目简介**
@ -65,9 +65,9 @@ youlai-mall
| 后端技术 | 版本号
| -------------------- | -------------------- |
| SpringBoot|2.3.6
| SpringCloud|Hoxton.SR9
| SpringCloud Alibaba| 2.2.2.RELEASE
| SpringBoot|2.4.2
| SpringCloud|2020.0.0
| SpringCloud Alibaba| 2.2.4.RELEASE
| Spring Security OAuth2| 2.2.4.RELEASE
| MyBatis Plus|3.4.0
| Druid| 1.1.23

View File

@ -1,7 +1,7 @@
package com.youlai.mall.pms.search.utils;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import cn.hutool.json.JSONObject;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -134,7 +134,7 @@ public class ElasticsearchUtils {
return objectMapper.writeValueAsString(propertiesJson);
} catch (JsonProcessingException e) {
e.printStackTrace();
return propertiesJson.toJSONString();
return propertiesJson.toString();
}
}
@ -153,13 +153,13 @@ public class ElasticsearchUtils {
return null;
}
/**
/* *//**
* 批量新增文档
*
* @param indexName 索引名称
* @param docList elasticsearch文档集合; 文档需标注@Document注解包含@Id注解字段, @Id注解标注的文档ID字段值不能为空
* @return 文档ID
*/
*//*
public <T> List<String> bulkIndexDoc(String indexName, List<T> docList) {
if (existIndex(indexName) && docList != null && !docList.isEmpty()) {
List<IndexQuery> indexQueries = new ArrayList<>();
@ -170,7 +170,7 @@ public class ElasticsearchUtils {
return null;
}
/**
*//**
* 批量索引子文档
* 数量由外部控制; 单次bulk操作控制50条
*
@ -180,7 +180,7 @@ public class ElasticsearchUtils {
* 子文档需包含RelationModel.class字段且字段RelationModel.parent值不为null
* @param subRelationName 子文档关系名; 匹配subDocList中RelationModel.name值
* @return 索引文档ID集合
*/
*//*
public <T> List<String> bulkIndexSubDoc(String indexName, List<T> subDocList, String subRelationName) {
if (existIndex(indexName) && subDocList != null && !subDocList.isEmpty()) {
Map<String, List<T>> groupMap = groupByParentId(subDocList, subRelationName);
@ -200,7 +200,7 @@ public class ElasticsearchUtils {
return null;
}
/**
*//**
* 索引子文档
*
* @param indexName 索引名称
@ -209,7 +209,7 @@ public class ElasticsearchUtils {
* 子文档需包含RelationModel.class字段且字段RelationModel.parent值不为null
* @param subRelationName 子文档关系名; 匹配elasticsearchSubModel中RelationModel.name值
* @return 子文档ID
*/
*//*
public <T> String indexSubDoc(String indexName, T elasticsearchSubModel, String subRelationName) {
if (existIndex(indexName) && elasticsearchSubModel != null) {
List<IndexQuery> queries = Collections.singletonList(new IndexQueryBuilder().withId(getDocumentIdValue(elasticsearchSubModel))
@ -219,7 +219,7 @@ public class ElasticsearchUtils {
return result != null && !result.isEmpty() ? result.get(0) : null;
}
return null;
}
}*/
/**
* 根据父文档ID分组子文档

13
pom.xml
View File

@ -24,7 +24,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.6.RELEASE</version>
<version>2.4.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
@ -33,18 +33,17 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<lombok.version>1.18.12</lombok.version>
<spring-cloud.version>Hoxton.SR9</spring-cloud.version>
<spring-cloud-alibaba.version>2.2.2.RELEASE</spring-cloud-alibaba.version>
<hutool.version>5.3.2</hutool.version>
<spring-cloud.version>2020.0.0</spring-cloud.version>
<spring-cloud-alibaba.version>2.2.4.RELEASE</spring-cloud-alibaba.version>
<hutool.version>5.5.7</hutool.version>
<mysql.version>8.0.19</mysql.version>
<druid.version>1.1.23</druid.version>
<mybatis-plus.version>3.4.0</mybatis-plus.version>
<mybatis-plus.version>3.4.2</mybatis-plus.version>
<minio.version>7.1.0</minio.version>
<knife4j.version>2.0.4</knife4j.version>
<weixin-java-miniapp.version>3.9.4.B</weixin-java-miniapp.version>
<hibernate-validator.version>6.0.13.Final</hibernate-validator.version>
<seata.version>1.4.0</seata.version>
<seata.version>1.4.1</seata.version>
</properties>
<dependencies>

View File

@ -16,6 +16,16 @@
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.youlai</groupId>
<artifactId>ums-api</artifactId>
@ -58,10 +68,6 @@
<version>${youlai.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
@ -73,8 +79,8 @@
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-oauth2</artifactId>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
</dependency>
<dependency>
@ -91,6 +97,13 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -6,8 +6,8 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
@EnableDiscoveryClient
public class AuthApplication {
public static void main(String[] args) {
SpringApplication.run(AuthApplication.class);

View File

@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
@ -12,6 +14,7 @@ import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
@Configuration
@AutoConfigureBefore(RedisAutoConfiguration.class)
public class RedisConfig {
@Bean

View File

@ -12,6 +12,7 @@
</parent>
<artifactId>youlai-gateway</artifactId>
<packaging>jar</packaging>
<properties>
<youlai.version>1.0.0-SNAPSHOT</youlai.version>
@ -19,15 +20,8 @@
<dependencies>
<dependency>
<groupId>com.youlai</groupId>
<artifactId>common-core</artifactId>
<version>${youlai.version}</version>
</dependency>
<dependency>
<groupId>com.youlai</groupId>
<artifactId>common-redis</artifactId>
<version>${youlai.version}</version>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<dependency>
@ -61,6 +55,19 @@
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-jose</artifactId>
</dependency>
<dependency>
<groupId>com.youlai</groupId>
<artifactId>common-core</artifactId>
<version>${youlai.version}</version>
</dependency>
<dependency>
<groupId>com.youlai</groupId>
<artifactId>common-redis</artifactId>
<version>${youlai.version}</version>
</dependency>
</dependencies>

View File

@ -7,7 +7,6 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@EnableDiscoveryClient
public class GatewayApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayApplication.class, args);
}

View File

@ -2,10 +2,8 @@ server:
port: 9999
spring:
main:
allow-bean-definition-overriding: true
application:
name: youlai-gateway
name: youlai-gateway
cloud:
nacos:
discovery: