feat:修复已知问题,提升系统稳定性

This commit is contained in:
dianjiu
2024-08-30 02:04:33 +08:00
parent e98052a69a
commit e821ba4858
568 changed files with 124666 additions and 13 deletions

View File

@@ -0,0 +1,53 @@
<?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>
<artifactId>remi-demo-api</artifactId>
<name>remi-demo-api</name>
<description>remi-demo-api</description>
<parent>
<groupId>ai.remi.cloud</groupId>
<artifactId>remi-demo</artifactId>
<version>3.1.0</version>
</parent>
<!-- 打包上传到私服, 需要和配置文件中的server节点配合使用 -->
<distributionManagement>
<repository>
<id>maven-releases</id>
<name>release</name>
<url>https://repository.njydsz.com/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>maven-snapshots</id>
<name>snapshot</name>
<url>https://repository.njydsz.com/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<!--remi-comm-feign-->
<dependency>
<groupId>ai.remi.comm</groupId>
<artifactId>remi-comm-feign</artifactId>
</dependency>
<!--remi-demo-domain-->
<dependency>
<groupId>ai.remi.cloud</groupId>
<artifactId>remi-demo-domain</artifactId>
</dependency>
<!--servlet-api-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<!--lombok-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,14 @@
package ai.remi.boot.api.client;
import ai.remi.boot.api.factory.FeignClientFactory;
import ai.remi.comm.feign.aspect.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(value = "remi-demo-web", configuration = FeignAutoConfiguration.class, fallbackFactory = FeignClientFactory.class)
public interface FeignClientApi {
@GetMapping("/books/findByBooksId")
String findById(@RequestParam("booksId") int booksId);
}

View File

@@ -0,0 +1,18 @@
package ai.remi.boot.api.factory;
import ai.remi.boot.api.client.FeignClientApi;
import ai.remi.boot.api.fallback.FeignClientFallback;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
@Component
public class FeignClientFactory implements FallbackFactory<FeignClientApi> {
@Override
public FeignClientApi create(Throwable cause) {
FeignClientFallback fallback = new FeignClientFallback();
fallback.setCause(cause);
return fallback;
}
}

View File

@@ -0,0 +1,17 @@
package ai.remi.boot.api.fallback;
import ai.remi.boot.api.client.FeignClientApi;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class FeignClientFallback implements FeignClientApi {
@Setter
private Throwable cause;
@Override
public String findById(int goodsId) {
log.error("findById = {}", cause.getMessage());
return null;
}
}