add
This commit is contained in:
@ -1,11 +1,8 @@
|
||||
package com.qiaoba.application;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.qiaoba.api.system.entity.SysMenu;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
@ -1,37 +0,0 @@
|
||||
package com.qiaoba.application.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
|
||||
/**
|
||||
* 全局跨域配置
|
||||
*
|
||||
* @author ailanyin
|
||||
* @version 1.0
|
||||
* @since 2021/10/15 0015 下午 16:43
|
||||
*/
|
||||
@Configuration
|
||||
public class GlobalCorsConfig {
|
||||
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
config.setAllowCredentials(true);
|
||||
// 设置访问源地址
|
||||
config.addAllowedOriginPattern("*");
|
||||
// 设置访问源请求头
|
||||
config.addAllowedHeader("*");
|
||||
// 设置访问源请求方法
|
||||
config.addAllowedMethod("*");
|
||||
// 有效期 半小时
|
||||
config.setMaxAge(1800L);
|
||||
// 添加映射路径,拦截一切请求
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
source.registerCorsConfiguration("/**" , config);
|
||||
// 返回新的CorsFilter
|
||||
return new CorsFilter(source);
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
qiaoba:
|
||||
file-upload-path: C:/${spring.application.name}/uploadPath/
|
||||
datasource:
|
||||
master:
|
||||
driver: com.mysql.cj.jdbc.Driver
|
||||
|
44
qiaoba-application/src/main/resources/application-prod.yml
Normal file
44
qiaoba-application/src/main/resources/application-prod.yml
Normal file
@ -0,0 +1,44 @@
|
||||
qiaoba:
|
||||
file-upload-path: /opt/${spring.application.name}/uploadPath/
|
||||
datasource:
|
||||
master:
|
||||
driver: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/qiaoba-boot?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowMultiQueries=true
|
||||
username: root
|
||||
password: root
|
||||
pool:
|
||||
init: 5 #连接池初始化大小
|
||||
min: 10 #最小空闲连接数
|
||||
max: 20 #最大连接数
|
||||
slaves:
|
||||
- driver: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://121.5.136.69:3306/qiaoba-boot-1?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowMultiQueries=true
|
||||
username: root
|
||||
password: LpYN7LUoL?l0OSpR2
|
||||
pool:
|
||||
init: 5
|
||||
min: 10
|
||||
max: 20
|
||||
weight: 2 #权重 默认 1
|
||||
is-use: true #是否使用 默认 true
|
||||
- driver: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/qiaoba-boot?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowMultiQueries=true
|
||||
username: root
|
||||
password: root
|
||||
pool:
|
||||
init: 5
|
||||
min: 10
|
||||
max: 20
|
||||
is-use: false # 不使用该库
|
||||
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
# 自动驼峰命名规则(camel case)映射
|
||||
mapUnderscoreToCamelCase: true
|
||||
# MyBatis 自动映射策略
|
||||
# NONE:不启用 PARTIAL:只对非嵌套 resultMap 自动映射 FULL:对所有 resultMap 自动映射
|
||||
autoMappingBehavior: PARTIAL
|
||||
# MyBatis 自动映射时未知列或未知属性处理策
|
||||
# NONE:不做处理 WARNING:打印相关警告 FAILING:抛出异常和详细信息
|
||||
autoMappingUnknownColumnBehavior: NONE
|
@ -44,6 +44,9 @@ springdoc:
|
||||
- group: '系统管理'
|
||||
paths-to-match: '/**'
|
||||
packages-to-scan: com.qiaoba.module.system.controller
|
||||
- group: '文件管理'
|
||||
paths-to-match: '/**'
|
||||
packages-to-scan: com.qiaoba.module.file.controller
|
||||
|
||||
# knife4j的增强配置,不需要增强可以不配
|
||||
knife4j:
|
||||
@ -54,7 +57,7 @@ knife4j:
|
||||
enable-footer-custom: true
|
||||
footer-custom-content: create by ailanyin
|
||||
|
||||
# mybatis-plus:
|
||||
# mybatis-plus:
|
||||
# 对应的 XML 文件位置
|
||||
# mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
# 实体扫描,多个package用逗号或者分号分隔
|
||||
|
Reference in New Issue
Block a user