diff --git a/doc/show b/doc/show new file mode 100644 index 0000000..5c137d8 --- /dev/null +++ b/doc/show @@ -0,0 +1,3 @@ +https://github.com/alibaba/nacos/releases +在这个页面下载最新版的nacos +我的项目名称是muyu,所以我创建了两个配置文件muyu-dev.yml和muyu-test.yml diff --git a/doc/yaml/application.yml b/doc/yaml/application.yml new file mode 100644 index 0000000..97c47a9 --- /dev/null +++ b/doc/yaml/application.yml @@ -0,0 +1,97 @@ +# 项目相关配置 +ruoyi: + # 名称 + name: RuoYi + # 版本 + version: 3.8.6 + # 版权年份 + copyrightYear: 2023 + # 实例演示开关 + demoEnabled: true + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) + profile: D:/ruoyi/uploadPath + # 获取ip地址开关 + addressEnabled: false + # 验证码类型 math 数字计算 char 字符验证 + captchaType: math + +# 开发环境配置 +server: + # 服务器的HTTP端口,默认为8080 + port: 8080 + servlet: + # 应用的访问路径 + context-path: / + tomcat: + # tomcat的URI编码 + uri-encoding: UTF-8 + # 连接数满后的排队数,默认为100 + accept-count: 1000 + threads: + # tomcat最大线程数,默认为200 + max: 800 + # Tomcat启动初始化的线程数,默认值10 + min-spare: 100 + +# 日志配置 +logging: + level: + com.ruoyi: debug + org.springframework: warn + +# 用户配置 +user: + password: + # 密码最大错误次数 + maxRetryCount: 5 + # 密码锁定时间(默认10分钟) + lockTime: 10 + +# Spring配置 +spring: + # 资源信息 + messages: + # 国际化资源文件路径 + basename: i18n/messages + profiles: + active: dev + # 文件上传 + servlet: + multipart: + # 单个文件大小 + max-file-size: 10MB + # 设置总上传的文件大小 + max-request-size: 20MB + + +# token配置 +token: + # 令牌自定义标识 + header: Authorization + # 令牌密钥 + secret: abcdefghijklmnopqrstuvwxyz + # 令牌有效期(默认30分钟) + expireTime: 30 + +# MyBatis配置 +mybatis: + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath*:mapper/**/*Mapper.xml + # 加载全局的配置文件 + configLocation: classpath:mybatis/mybatis-config.xml + +# PageHelper分页插件 +pagehelper: + helperDialect: mysql + supportMethodsArguments: true + params: count=countSql + + +# 防止XSS攻击 +xss: + # 过滤开关 + enabled: true + # 排除链接(多个用逗号分隔) + excludes: /system/notice + # 匹配链接 + urlPatterns: /system/*,/monitor/*,/tool/* diff --git a/ruoyi-application/src/main/resources/application-dev.yml b/doc/yaml/muyu-dev.yml similarity index 100% rename from ruoyi-application/src/main/resources/application-dev.yml rename to doc/yaml/muyu-dev.yml diff --git a/ruoyi-application/src/main/resources/application-test.yml b/doc/yaml/muyu-test.yml similarity index 100% rename from ruoyi-application/src/main/resources/application-test.yml rename to doc/yaml/muyu-test.yml diff --git a/pom.xml b/pom.xml index a407a1d..ad4ef8d 100644 --- a/pom.xml +++ b/pom.xml @@ -31,6 +31,7 @@ 2.3 0.9.1 4.3.0 + 0.2.12 @@ -46,6 +47,13 @@ import + + + com.alibaba.boot + nacos-config-spring-boot-starter + ${nacos.config.version} + + com.github.xiaoymin diff --git a/ruoyi-application/pom.xml b/ruoyi-application/pom.xml index 8e1a3ed..fbc9a8f 100644 --- a/ruoyi-application/pom.xml +++ b/ruoyi-application/pom.xml @@ -80,6 +80,12 @@ org.springframework.boot spring-boot-starter-test + + + + com.alibaba.boot + nacos-config-spring-boot-starter + diff --git a/ruoyi-application/src/main/resources/application.yml b/ruoyi-application/src/main/resources/application.yml index 97c47a9..f076809 100644 --- a/ruoyi-application/src/main/resources/application.yml +++ b/ruoyi-application/src/main/resources/application.yml @@ -1,97 +1,34 @@ -# 项目相关配置 -ruoyi: - # 名称 - name: RuoYi - # 版本 - version: 3.8.6 - # 版权年份 - copyrightYear: 2023 - # 实例演示开关 - demoEnabled: true - # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) - profile: D:/ruoyi/uploadPath - # 获取ip地址开关 - addressEnabled: false - # 验证码类型 math 数字计算 char 字符验证 - captchaType: math - -# 开发环境配置 +# Tomcat server: - # 服务器的HTTP端口,默认为8080 - port: 8080 - servlet: - # 应用的访问路径 - context-path: / - tomcat: - # tomcat的URI编码 - uri-encoding: UTF-8 - # 连接数满后的排队数,默认为100 - accept-count: 1000 - threads: - # tomcat最大线程数,默认为200 - max: 800 - # Tomcat启动初始化的线程数,默认值10 - min-spare: 100 + port: 9200 -# 日志配置 -logging: - level: - com.ruoyi: debug - org.springframework: warn - -# 用户配置 -user: - password: - # 密码最大错误次数 - maxRetryCount: 5 - # 密码锁定时间(默认10分钟) - lockTime: 10 - -# Spring配置 +# Spring spring: - # 资源信息 - messages: - # 国际化资源文件路径 - basename: i18n/messages + application: + # 应用名称 + name: muyu profiles: + # 环境配置 active: dev - # 文件上传 - servlet: - multipart: - # 单个文件大小 - max-file-size: 10MB - # 设置总上传的文件大小 - max-request-size: 20MB - -# token配置 -token: - # 令牌自定义标识 - header: Authorization - # 令牌密钥 - secret: abcdefghijklmnopqrstuvwxyz - # 令牌有效期(默认30分钟) - expireTime: 30 - -# MyBatis配置 -mybatis: - # 配置mapper的扫描,找到所有的mapper.xml映射文件 - mapperLocations: classpath*:mapper/**/*Mapper.xml - # 加载全局的配置文件 - configLocation: classpath:mybatis/mybatis-config.xml - -# PageHelper分页插件 -pagehelper: - helperDialect: mysql - supportMethodsArguments: true - params: count=countSql - - -# 防止XSS攻击 -xss: - # 过滤开关 - enabled: true - # 排除链接(多个用逗号分隔) - excludes: /system/notice - # 匹配链接 - urlPatterns: /system/*,/monitor/*,/tool/* +nacos: + config: + bootstrap: + #开启系统启动时预读取nacos的配置,用于满足@Value注入数据的场景 + enable: true + # 配置中心地址 + server-addr: 127.0.0.1:8848 + # 配置文件ID + data-id: ${spring.application.name}-${spring.profiles.active}.${nacos.config.file-extension} + # 配置文件格式 + file-extension: yml + # 开启自动刷新nacos配置 + auto-refresh: true + # 配置文件类型,对应nacos配置页面的配置格式,默认是properties + type: yaml + # 针对配置项同名的情况,是否允许nacos的配置覆盖本地的配置 + remote-first: true + # 共享配置 + ext-config: + - data-id: application.${nacos.config.file-extension} + type: yaml diff --git a/ruoyi-basic/ruoyi-plugin/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java b/ruoyi-basic/ruoyi-plugin/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java index a09fe44..bcaa66b 100644 --- a/ruoyi-basic/ruoyi-plugin/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java +++ b/ruoyi-basic/ruoyi-plugin/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java @@ -13,6 +13,7 @@ import com.ruoyi.generator.service.GenTableService; import org.apache.commons.io.IOUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*;