diff --git a/ldlz-admin/pom.xml b/ldlz-admin/pom.xml index 47c7719..cdae688 100644 --- a/ldlz-admin/pom.xml +++ b/ldlz-admin/pom.xml @@ -17,6 +17,19 @@ + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + 2.1.0.RELEASE + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + 2021.1 + + org.springframework.boot diff --git a/ldlz-admin/src/main/java/com/bns/LdlzApplication.java b/ldlz-admin/src/main/java/com/bns/LdlzApplication.java index 1b21831..1f3093b 100644 --- a/ldlz-admin/src/main/java/com/bns/LdlzApplication.java +++ b/ldlz-admin/src/main/java/com/bns/LdlzApplication.java @@ -3,6 +3,7 @@ package com.bns; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.scheduling.annotation.EnableScheduling; /** @@ -12,12 +13,13 @@ import org.springframework.scheduling.annotation.EnableScheduling; */ @EnableScheduling @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) +@EnableDiscoveryClient public class LdlzApplication { public static void main(String[] args) { // System.setProperty("spring.devtools.restart.enabled", "false"); SpringApplication.run(LdlzApplication.class, args); - System.out.println("(♥◠‿◠)ノ゙ 领导履职启动成功 ლ(´ڡ`ლ)゙"); + System.err.println("(♥◠‿◠)ノ゙ 领导履职启动成功 ლ(´ڡ`ლ)゙"); } } diff --git a/ldlz-admin/src/main/resources/application-druid.yml b/ldlz-admin/src/main/resources/application-druid.yml index b9ac321..6b4b10f 100644 --- a/ldlz-admin/src/main/resources/application-druid.yml +++ b/ldlz-admin/src/main/resources/application-druid.yml @@ -1,18 +1,33 @@ # 数据源配置 spring: + application: + name: bonus-ldlz + cloud: + nacos: + # nacos.core.auth.enabled=true 开启权限验证 + username: nacos + password: nacos + discovery: + # nacos地址 + server-addr: 127.0.0.1:8848 + namespace: 289db019-a290-4903-ac1a-5d341af8b272 + config: + server-addr: 127.0.0.1:8848 + namespace: 289db019-a290-4903-ac1a-5d341af8b272 + datasource: type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver druid: # 主库数据源 master: - url: jdbc:mysql://120.48.23.33:3307/ldlz?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - username: ldlz - password: E2GWTDG45FRRBSBt + url: jdbc:mysql://127.0.0.1:3306/ldlz?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: mroot + password: bonus@admin123 # 从库数据源 slave: # 从数据源开关/默认关闭 - enabled: true + enabled: false url: jdbc:mysql://120.48.23.33:3307/zyry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: ldlz password: E2GWTDG45FRRBSBt diff --git a/ldlz-admin/src/main/resources/application.yml b/ldlz-admin/src/main/resources/application.yml index 33a32c1..92e71ab 100644 --- a/ldlz-admin/src/main/resources/application.yml +++ b/ldlz-admin/src/main/resources/application.yml @@ -18,7 +18,7 @@ ldlz: server: # 服务器的HTTP端口,默认为8080 # port: 9001 - port: 8080 + port: 38080 servlet: # 应用的访问路径 context-path: / @@ -71,13 +71,13 @@ spring: # redis 配置 redis: # 地址 - host: 47.104.94.120 + host: 127.0.0.1 # 端口,默认为6379 - port: 6380 + port: 6379 # 数据库索引 database: 13 # 密码 - password: 1qazZAQ!1 + password: # 连接超时时间 timeout: 10s lettuce: diff --git a/ldlz-framework/src/main/java/com/bns/framework/config/ResourcesConfig.java b/ldlz-framework/src/main/java/com/bns/framework/config/ResourcesConfig.java index 67ab47d..e7c496d 100644 --- a/ldlz-framework/src/main/java/com/bns/framework/config/ResourcesConfig.java +++ b/ldlz-framework/src/main/java/com/bns/framework/config/ResourcesConfig.java @@ -57,7 +57,7 @@ public class ResourcesConfig implements WebMvcConfigurer CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); // 设置访问源地址 - config.addAllowedOriginPattern("*"); + config.addAllowedOrigin("*"); // 设置访问源请求头 config.addAllowedHeader("*"); // 设置访问源请求方法 diff --git a/pom.xml b/pom.xml index e5d4a31..439646e 100644 --- a/pom.xml +++ b/pom.xml @@ -29,21 +29,49 @@ 4.1.2 2.3 0.9.1 + Greenwich.SR1 + 2.1.0.RELEASE + 2.1.1.RELEASE - + + - org.springframework.boot - spring-boot-dependencies - 2.5.15 + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} pom import + + + com.alibaba.cloud + spring-cloud-alibaba-dependencies + ${spring-cloud-alibaba.version} + pom + import + + + org.springframework.plugin + spring-plugin-core + 2.0.0.RELEASE + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + + com.alibaba