zhoushihao
2024-04-17 2fd327d2d6ad0ae7561542c51b79b28ea405ddb9
fixbug:解决引入多数据源后项目启动失败的问题
3个文件已修改
1 文件已重命名
3个文件已删除
170 ■■■■ 已修改文件
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/InterceptorConfig.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/MyCorsConfig.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/interceptor/JwtInterceptor.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/springsecurity/src/main/java/com/mes/userinfo/controller/SysUserController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/gateway/src/main/java/com/mes/config/MyCorsConfig.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/application.yml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application.yml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/InterceptorConfig.java
File was deleted
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/MyCorsConfig.java
File was deleted
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/interceptor/JwtInterceptor.java
File was deleted
hangzhoumesParent/common/springsecurity/src/main/java/com/mes/userinfo/controller/SysUserController.java
@@ -16,7 +16,6 @@
 * @since 2024-04-11
 */
@RestController
@CrossOrigin
@RequestMapping("/userinfo")
public class SysUserController {
hangzhoumesParent/gateway/src/main/java/com/mes/config/MyCorsConfig.java
File was renamed from hangzhoumesParent/common/springsecurity/src/main/java/com/mes/common/config/MyCorsConfig.java
@@ -1,12 +1,10 @@
package com.mes.common.config;
package com.mes.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.reactive.CorsWebFilter;
import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
 * @Author : zhoush
@@ -15,32 +13,22 @@
 */
@Configuration
public class MyCorsConfig {
    @Bean
    public WebMvcConfigurer corsConfigurer() {
        return new WebMvcConfigurer() {
            @Override
            public void addCorsMappings(CorsRegistry registry) {
                registry.addMapping("/**");
            }
        };
    }
    public CorsWebFilter corsFilter() {
    @Bean
    public CorsWebFilter corsWebFilter() {
        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
        CorsConfiguration corsConfiguration = new CorsConfiguration();
        //1、配置跨域
        //允许哪些头跨域
        corsConfiguration.addAllowedHeader("*");
        // 允许哪些方式跨域   get  post  delete 等方式
        corsConfiguration.addAllowedMethod("*");
        //允许哪些请求来源跨域    *  任意来源
        corsConfiguration.addAllowedOrigin("*");
        // 是否允许携带cooker跨域
        corsConfiguration.setAllowCredentials(true);
        //注册跨越配置       /**配置请求路径
        source.registerCorsConfiguration("/**", corsConfiguration);
        return new CorsWebFilter(source);
    }
}
hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/application.yml
@@ -2,10 +2,15 @@
  port: 8081
spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false
    username: root
    password: beibo.123/
    dynamic:
      primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master
      strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源.
      datasource:
        hangzhoumes:
          url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8
          username: root
          password: beibo.123/
          driver-class-name: com.mysql.cj.jdbc.Driver
  cloud:
    nacos:
      discovery:
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application.yml
@@ -3,10 +3,15 @@
spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false
    username: root
    password: beibo.123/
    dynamic:
      primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master
      strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源.
      datasource:
        hangzhoumes:
          url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8
          username: root
          password: beibo.123/
          driver-class-name: com.mysql.cj.jdbc.Driver
  cloud:
    nacos:
      discovery: