13693261870
2025-07-02 8a8aff34125e2874005d0f9c3ac8ec4ac6354f42
解决gateway启动异常
已修改5个文件
34 ■■■■■ 文件已修改
se-common/pom.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-common/src/main/java/com/terra/common/service/RedisService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-gateway/src/main/java/com/terra/gateway/SeGatewayApplication.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-gateway/src/main/java/com/terra/gateway/filter/XssFilter.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-gateway/src/main/resources/bootstrap.yml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-common/pom.xml
@@ -113,12 +113,6 @@
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <!-- SpringBoot Web -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <!-- SpringDoc webmvc -->
        <dependency>
            <groupId>org.springdoc</groupId>
se-common/src/main/java/com/terra/common/service/RedisService.java
@@ -1,6 +1,6 @@
package com.terra.common.service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import org.springframework.data.redis.core.BoundSetOperations;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
@@ -19,7 +19,7 @@
@Component
public class RedisService
{
    @Autowired
    @Resource
    public RedisTemplate redisTemplate;
    /**
se-gateway/src/main/java/com/terra/gateway/SeGatewayApplication.java
@@ -1,5 +1,6 @@
package com.terra.gateway;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@@ -10,10 +11,15 @@
 * @author admin
 */
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
public class SeGatewayApplication
{
    public static void main(String[] args)
    {
public class SeGatewayApplication {
    private static String TEST;
    @Value("${spring.test}")
    public void setTest(String test) {
        TEST = test;
    }
    public static void main(String[] args) {
        SpringApplication.run(SeGatewayApplication.class, args);
        System.out.println("----------网关模块启动成功----------  \n");
    }
se-gateway/src/main/java/com/terra/gateway/filter/XssFilter.java
@@ -1,7 +1,7 @@
package com.terra.gateway.filter;
import java.nio.charset.StandardCharsets;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
@@ -33,7 +33,7 @@
public class XssFilter implements GlobalFilter, Ordered
{
    // 跨站脚本的 xss 配置,nacos自行添加
    @Autowired
    @Resource
    private XssProperties xss;
    @Override
se-gateway/src/main/resources/bootstrap.yml
@@ -7,6 +7,8 @@
  application:
    # 应用名称
    name: se-gateway
  main:
    web-application-type: reactive
  profiles:
    # 环境配置
    active: dev
@@ -18,13 +20,15 @@
        # 服务注册地址
        server-addr: 127.0.0.1:8848
      config:
        group: JHS_GROUP
        # 配置中心地址
        server-addr: 127.0.0.1:8848
        # 配置文件格式
        file-extension: yml
        # 共享配置
        shared-configs:
          - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
          - data-id: application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
            group: JHS_GROUP
    sentinel:
      # 取消控制台懒加载
      eager: true