mirror of
https://github.com/RemainderTime/spring-boot-base-demo.git
synced 2026-03-06 20:20:44 +08:00
初始化项目
This commit is contained in:
13
src/main/java/cn/xf/basedemo/BaseDemoApplication.java
Normal file
13
src/main/java/cn/xf/basedemo/BaseDemoApplication.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package cn.xf.basedemo;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class BaseDemoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(BaseDemoApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
126
src/main/java/cn/xf/basedemo/common/utils/JwtTokenUtils.java
Normal file
126
src/main/java/cn/xf/basedemo/common/utils/JwtTokenUtils.java
Normal file
@@ -0,0 +1,126 @@
|
||||
package cn.xf.basedemo.common.utils;
|
||||
|
||||
import com.auth0.jwt.JWT;
|
||||
import com.auth0.jwt.JWTVerifier;
|
||||
import com.auth0.jwt.algorithms.Algorithm;
|
||||
import com.auth0.jwt.exceptions.TokenExpiredException;
|
||||
import com.auth0.jwt.interfaces.Claim;
|
||||
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Description: JwtToken
|
||||
*
|
||||
* @author rsh
|
||||
* @date 2021/9/17 2:00 下午
|
||||
*/
|
||||
@Slf4j
|
||||
public class JwtTokenUtils {
|
||||
|
||||
private String tokenSecret;
|
||||
private int tokenExpire;
|
||||
|
||||
public JwtTokenUtils(String tokenSecret, int tokenExpire) {
|
||||
this.tokenSecret = StringUtils.isNotEmpty(tokenSecret) ? tokenSecret : "remaindertime";
|
||||
this.tokenExpire = tokenExpire > 0 ? tokenExpire : 14400;
|
||||
}
|
||||
|
||||
public String getTokenSecret() {
|
||||
return tokenSecret;
|
||||
}
|
||||
|
||||
public int getTokenExpire() {
|
||||
return tokenExpire;
|
||||
}
|
||||
|
||||
private final static String USER_ID = "userId";
|
||||
|
||||
/**
|
||||
* JWT生成Token.<br/>
|
||||
* <p>
|
||||
* JWT构成: header, payload, signature
|
||||
*
|
||||
* @param userId 用户id
|
||||
*/
|
||||
public String createToken(int userId) {
|
||||
try {
|
||||
Date iatDate = new Date();
|
||||
// expire time
|
||||
// Date expiresDate = DateUtils.getByDateAfterMin(iatDate, tokenExpire);
|
||||
|
||||
// header Map
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("alg", "HS256");
|
||||
map.put("typ", "JWT");
|
||||
|
||||
// build token
|
||||
// param backups {iss:Service, aud:APP}
|
||||
String token = JWT.create().withHeader(map)
|
||||
.withClaim("iss", "ll-app-business")
|
||||
.withClaim("aud", "APP")
|
||||
.withClaim(USER_ID, String.valueOf(userId))
|
||||
.withIssuedAt(iatDate)
|
||||
// .withExpiresAt(expiresDate)
|
||||
.sign(Algorithm.HMAC256(tokenSecret));
|
||||
|
||||
return token;
|
||||
} catch (Exception e) {
|
||||
log.error("生成token异常", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密Token
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, Claim> verifyToken(String token) {
|
||||
if (token == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
JWTVerifier verifier = JWT.require(Algorithm.HMAC256(tokenSecret)).build();
|
||||
DecodedJWT jwt = verifier.verify(token);
|
||||
return jwt.getClaims();
|
||||
} catch (Exception e) {
|
||||
if (e instanceof TokenExpiredException) {
|
||||
// token 已过期
|
||||
}
|
||||
log.error("解密Token异常", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据Token获取userId
|
||||
*
|
||||
* @param token
|
||||
* @return userId
|
||||
*/
|
||||
public Integer getUserId(String token) {
|
||||
Map<String, Claim> claims = verifyToken(token);
|
||||
if (claims != null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Claim claim = claims.get(USER_ID);
|
||||
if (null == claim || StringUtils.isEmpty(claim.asString())) {
|
||||
return null;
|
||||
}
|
||||
return Integer.parseInt(claim.asString());
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
JwtTokenUtils jwtTokenUtils = new JwtTokenUtils("124235rfwe234", 100000);
|
||||
System.out.println(jwtTokenUtils.createToken(1));
|
||||
}
|
||||
|
||||
}
|
||||
44
src/main/java/cn/xf/basedemo/config/GlobalCorsConfig.java
Normal file
44
src/main/java/cn/xf/basedemo/config/GlobalCorsConfig.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package cn.xf.basedemo.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Description: 全局跨域配置
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
public class GlobalCorsConfig {
|
||||
|
||||
@ConditionalOnMissingBean
|
||||
@Bean
|
||||
public FilterRegistrationBean<CorsFilter> corsFilter() {
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
// 放行哪些原始域
|
||||
//config.addAllowedOrigin("*");
|
||||
// 放行哪些原始域,SpringBoot2.4.4下低版本使用.allowedOrigins("*")
|
||||
config.addAllowedOriginPattern("*");
|
||||
// 放行哪些原始请求头部信息
|
||||
config.addAllowedHeader("*");
|
||||
// 放行全部请求
|
||||
config.addAllowedMethod("*");
|
||||
// 是否发送Cookie
|
||||
config.setAllowCredentials(true);
|
||||
|
||||
UrlBasedCorsConfigurationSource configSource = new UrlBasedCorsConfigurationSource();
|
||||
configSource.registerCorsConfiguration("/**", config);
|
||||
|
||||
FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(configSource));
|
||||
// 这个顺序很重要哦,为避免麻烦请设置在最前
|
||||
bean.setOrder(0);
|
||||
return bean;
|
||||
}
|
||||
|
||||
}
|
||||
23
src/main/java/cn/xf/basedemo/config/InterceptorConfig.java
Normal file
23
src/main/java/cn/xf/basedemo/config/InterceptorConfig.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package cn.xf.basedemo.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* @program: spring-boot-base-demo
|
||||
* @ClassName InterceptorConfig
|
||||
* @description:
|
||||
* @author: xiongfeng
|
||||
* @create: 2022-06-16 13:59
|
||||
**/
|
||||
@Configuration
|
||||
public class InterceptorConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(new TokenInterceptor()) //登录逻辑拦截类
|
||||
.addPathPatterns("/**") //需要拦截的请求(设置的全部拦截)
|
||||
.excludePathPatterns("`/user/login","/user/register`"); //忽略的请求
|
||||
}
|
||||
}
|
||||
53
src/main/java/cn/xf/basedemo/config/MybatisPlusConfig.java
Normal file
53
src/main/java/cn/xf/basedemo/config/MybatisPlusConfig.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package cn.xf.basedemo.config;
|
||||
|
||||
import com.baomidou.dynamic.datasource.plugin.MasterSlaveAutoRoutingPlugin;
|
||||
import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@Configuration
|
||||
@MapperScan("cn.xf.basedemo.mappers")
|
||||
@EnableTransactionManagement
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
/**
|
||||
* 分页插件
|
||||
*
|
||||
* @return PaginationInterceptor
|
||||
*/
|
||||
@Bean
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
|
||||
// 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求 默认false
|
||||
paginationInterceptor.setOverflow(false);
|
||||
// 设置最大单页限制数量,默认 500 条,-1 不受限制
|
||||
paginationInterceptor.setLimit(500);
|
||||
// 开启 count 的 join 优化,只针对部分 left join
|
||||
paginationInterceptor.setCountSqlParser(new JsqlParserCountOptimize(true));
|
||||
return paginationInterceptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读写分离
|
||||
*
|
||||
* @return MasterSlaveAutoRoutingPlugin
|
||||
*/
|
||||
@Bean
|
||||
public MasterSlaveAutoRoutingPlugin masterSlaveAutoRoutingPlugin() {
|
||||
return new MasterSlaveAutoRoutingPlugin();
|
||||
}
|
||||
|
||||
/**
|
||||
* 乐观锁插件
|
||||
*
|
||||
* @return OptimisticLockerInterceptor
|
||||
*/
|
||||
@Bean
|
||||
public OptimisticLockerInterceptor optimisticLockerInterceptor() {
|
||||
return new OptimisticLockerInterceptor();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package cn.xf.basedemo.config;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.web.CorsEndpointProperties;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
|
||||
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementPortType;
|
||||
import org.springframework.boot.actuate.endpoint.ExposableEndpoint;
|
||||
import org.springframework.boot.actuate.endpoint.web.*;
|
||||
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier;
|
||||
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier;
|
||||
import org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.oas.annotations.EnableOpenApi;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @program: spring-boot-base-demo
|
||||
* @ClassName SpringFoxSwaggerConfig
|
||||
* @description:
|
||||
* @author: xiongfeng
|
||||
* @create: 2022-06-16 16:44
|
||||
**/
|
||||
@EnableOpenApi
|
||||
@Configuration
|
||||
public class SpringFoxSwaggerConfig {
|
||||
|
||||
/**
|
||||
* 配置基本信息
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("Swagger Test App Restful API")
|
||||
.description("swagger test app restful api")
|
||||
.termsOfServiceUrl("https://github.com/RemainderTime")
|
||||
.contact(new Contact("君燕尾","https://blog.csdn.net/qq_39818325","fairy_xingyun@hotmail.com"))
|
||||
.version("1.0")
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置文档生成最佳实践
|
||||
* @param apiInfo
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public Docket createRestApi(ApiInfo apiInfo) {
|
||||
return new Docket(DocumentationType.OAS_30)
|
||||
.apiInfo(apiInfo)
|
||||
.groupName("SwaggerGroupOneAPI")
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加如下配置可解决Spring Boot 6.x 与Swagger 3.0.0 不兼容问题
|
||||
**/
|
||||
@Bean
|
||||
public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(WebEndpointsSupplier webEndpointsSupplier, ServletEndpointsSupplier servletEndpointsSupplier, ControllerEndpointsSupplier controllerEndpointsSupplier, EndpointMediaTypes endpointMediaTypes, CorsEndpointProperties corsProperties, WebEndpointProperties webEndpointProperties, Environment environment) {
|
||||
List<ExposableEndpoint<?>> allEndpoints = new ArrayList();
|
||||
Collection<ExposableWebEndpoint> webEndpoints = webEndpointsSupplier.getEndpoints();
|
||||
allEndpoints.addAll(webEndpoints);
|
||||
allEndpoints.addAll(servletEndpointsSupplier.getEndpoints());
|
||||
allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints());
|
||||
String basePath = webEndpointProperties.getBasePath();
|
||||
EndpointMapping endpointMapping = new EndpointMapping(basePath);
|
||||
boolean shouldRegisterLinksMapping = this.shouldRegisterLinksMapping(webEndpointProperties, environment, basePath);
|
||||
return new WebMvcEndpointHandlerMapping(endpointMapping, webEndpoints, endpointMediaTypes, corsProperties.toCorsConfiguration(), new EndpointLinksResolver(allEndpoints, basePath), shouldRegisterLinksMapping, null);
|
||||
}
|
||||
private boolean shouldRegisterLinksMapping(WebEndpointProperties webEndpointProperties, Environment environment, String basePath) {
|
||||
return webEndpointProperties.getDiscovery().isEnabled() && (StringUtils.hasText(basePath) || ManagementPortType.get(environment).equals(ManagementPortType.DIFFERENT));
|
||||
}
|
||||
}
|
||||
34
src/main/java/cn/xf/basedemo/config/TokenInterceptor.java
Normal file
34
src/main/java/cn/xf/basedemo/config/TokenInterceptor.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package cn.xf.basedemo.config;
|
||||
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @program: spring-boot-base-demo
|
||||
* @ClassName TokenInterceptor
|
||||
* @description:
|
||||
* @author: xiongfeng
|
||||
* @create: 2022-06-16 14:17
|
||||
**/
|
||||
public class TokenInterceptor implements HandlerInterceptor {
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
|
||||
String requestURI = request.getRequestURI();
|
||||
|
||||
//登录处理
|
||||
String authorization = request.getHeader("Authorization");
|
||||
|
||||
|
||||
return HandlerInterceptor.super.preHandle(request, response, handler);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||
HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
|
||||
}
|
||||
}
|
||||
197
src/main/resources/application-dev.yml
Normal file
197
src/main/resources/application-dev.yml
Normal file
@@ -0,0 +1,197 @@
|
||||
#spring:
|
||||
# datasource:
|
||||
# dynamic:
|
||||
# primary: master
|
||||
# strict: true #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源.
|
||||
# hikari:
|
||||
# minimum-idle: 4
|
||||
# maximum-pool-size: 4
|
||||
# connection-init-sql: SELECT 1
|
||||
# connection-test-query: SELECT 1
|
||||
# datasource:
|
||||
# master:
|
||||
# url: jdbc:mysql://rm-2vcg431j388xlt5541o.mysql.cn-chengdu.rds.aliyuncs.com:3306/nearby_travel?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
# username: aliyun_test
|
||||
# password: testRootZby!2020@
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# slave:
|
||||
# url: jdbc:mysql://rm-2vcg431j388xlt5541o.mysql.cn-chengdu.rds.aliyuncs.com:3306/nearby_travel?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
# username: aliyun_test
|
||||
# password: testRootZby!2020@
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# cloud:
|
||||
# config:
|
||||
# enabled: false
|
||||
# consul:
|
||||
# host: 192.168.10.111 #139.224.207.104
|
||||
# port: 8500
|
||||
# config:
|
||||
# # 是否启用配置中心,默认值 true 开启
|
||||
# enabled: false
|
||||
# discovery:
|
||||
# register: false # 是否需要注册
|
||||
#grpc:
|
||||
# client:
|
||||
# GLOBAL:
|
||||
# security:
|
||||
# enable-keep-alive: true
|
||||
# keep-alive-without-calls: true
|
||||
# negotiation-type: plaintext
|
||||
# center-merchant:
|
||||
# address: 'discovery:///center-merchant'
|
||||
# # kdm 192.168.11.116
|
||||
# # gsj 192.168.10.43
|
||||
# # tc 192.168.9.62
|
||||
# # address: 'static://192.168.11.116:9999'
|
||||
# enableKeepAlive: true
|
||||
# keepAliveWithoutCalls: true
|
||||
# center-user:
|
||||
# address: 'discovery:///center-user'
|
||||
# # address: 'static://192.168.10.43:8888'
|
||||
# enableKeepAlive: true
|
||||
# keepAliveWithoutCalls: true
|
||||
# center-ocr:
|
||||
# address: 'discovery:///center-merchant'
|
||||
# # address: 'static://192.168.10.43:6566'
|
||||
# enableKeepAlive: true
|
||||
# keepAliveWithoutCalls: true
|
||||
# center-contract:
|
||||
# address: 'discovery:///center-contract'
|
||||
# enableKeepAlive: true
|
||||
# keepAliveWithoutCalls: true
|
||||
# center-dataapi:
|
||||
# address: 'static://192.168.8.126:9999'
|
||||
# enableKeepAlive: true
|
||||
# keepAliveWithoutCalls: true
|
||||
#
|
||||
#
|
||||
##redis
|
||||
#redis:
|
||||
# dynamic:
|
||||
# datasource:
|
||||
# token:
|
||||
# database: 1
|
||||
# host: 192.168.10.113
|
||||
# port: 6379
|
||||
# password: '123456'
|
||||
# lettuce:
|
||||
# pool:
|
||||
# max-active: 8
|
||||
# max-wait: -1ms
|
||||
# max-idle: 8
|
||||
# min-idle: 0
|
||||
# timeout: 3000ms
|
||||
# res:
|
||||
# database: 0
|
||||
# host: 192.168.10.113
|
||||
# port: 6379
|
||||
# password: '123456'
|
||||
# lettuce:
|
||||
# pool:
|
||||
# max-active: 8
|
||||
# max-wait: -1ms
|
||||
# max-idle: 8
|
||||
# min-idle: 0
|
||||
# timeout: 3000ms
|
||||
#oss:
|
||||
# name: alioss
|
||||
# endpoint: ll-oss-pre.lianlianlvyou.com
|
||||
# accessKey:
|
||||
# secretKey:
|
||||
# bucketName:
|
||||
# args:
|
||||
# expireTime: 3600 #过期时间
|
||||
# contentLengthRange: 2000 #大小限制
|
||||
##oss:
|
||||
## name: alioss
|
||||
## endpoint: ll-oss-pre.lianlianlvyou.com
|
||||
## accessKey:
|
||||
## secretKey:
|
||||
## bucketName:
|
||||
## args:
|
||||
## expireTime: 3600 #过期时间
|
||||
## contentLengthRange: 2000 #大小限制
|
||||
## redis分布式锁
|
||||
#redisson:
|
||||
# enabled: true
|
||||
# address: 'redis://192.168.10.113:6379'
|
||||
# password: '123456'
|
||||
# database: 5
|
||||
# connectionPoolSize: 4
|
||||
# connectionMinimumIdleSize: 4
|
||||
#
|
||||
## 阿里云rocketmq
|
||||
#aliyun:
|
||||
# rocketmq:
|
||||
# config:
|
||||
# AccessKey: 1
|
||||
# SecretKey: 1
|
||||
# NAMESRV_ADDR: 1
|
||||
# GROUP_ID: 1
|
||||
# producer:
|
||||
# enabled: true
|
||||
#
|
||||
#rabbitmq:
|
||||
# configs:
|
||||
# order: #实例名称
|
||||
# host: 192.168.10.111
|
||||
# port: 5672
|
||||
# virtualHost: ll-dev
|
||||
# username: zhangziheng
|
||||
# password: zhangziheng
|
||||
# producer:
|
||||
# enabled: true
|
||||
# exchange: order_status
|
||||
# routingKey: ORDER_COMPLETE
|
||||
# confirmCallback: orderMqConfirmCallback
|
||||
# commonChange:
|
||||
# host: 192.168.10.111
|
||||
# port: 5672
|
||||
# virtualHost: ll-dev
|
||||
# username: zhangziheng
|
||||
# password: zhangziheng
|
||||
# producer:
|
||||
# enabled: false
|
||||
# consumer:
|
||||
# enabled: true
|
||||
# subscribeList:
|
||||
# - queue: 'app-business'
|
||||
# messageListener: commonChangeMessageListener
|
||||
#
|
||||
##应用可以默认使用的配置文件
|
||||
#global:
|
||||
# testCofnig: "aaa"
|
||||
# tokenSecret: '12435twefdsfsdt4tsdcqw43tregdsgd'
|
||||
# tokenExpire: 14400 #10天
|
||||
# smsMqTopic: 'topic_msg'
|
||||
# smsMqTag: 'tag-sms'
|
||||
# rsaPrivateKey: 'MIIEpQIBAAKCAQEAuAltXJI4kMQkucWCeLGK4Zyqw7VUp1JYS1GkJb0eJKCgxqJBzwjl8XpStA1hCv9BEX6SEsm/d2T6SDo+G6ySpfV0RQeZ7v32kE9+Eh0BK1Q8wU91nCa1CM9yfBhKXsQ3DKq2am5oLryNWXdKLXZPgoJbuIONG2G4oKakwUMX3aASp3Cj3rNXLea8ilXjFZ+OEp0DuZ4CsasO1MTaBS84mJhnzRNbuhHq5qyrVI02jw7Fim8siIBsmDDHgBd4l9hj6KAAr0jf9JOHaOp+KxfH76taqqaXI5lZIPG7lCP65iBuNNEqDSc21abcPhgvgK5K4xj9p5sG+V1FBISCE0dPrQIDAQABAoIBAG6dg/UTEhq5OhXKyDwBAqfOgbk2IVacoONMg+wG+rorLdeWKRXmlEcLLfB45i409Agu2l+ekY2SzPhiwXfixxYnLSZchkJmtS9SCEWc11oSvJ24Q8mCXmeYQIikFPdW2nurlA7uo4IL5K20jIo8xVd9QOHreAHQP6eX4gkjaZHUIOSJ2P6iffEQCHbXehoyCoTMLdK+1HTuZdO4C9r/S9f/Y1kLWfV5ogEi0DHJpUy37npinfqPp0LHbgpK2WBPOkQIhKvi/4OQ71EcYR5gyrA7nR+rQyPHdhFzTTyfTNTgmuNFuAYJODN5yd62RQd8i6chMx63tYDoYhCjI/ixv8UCgYEA9S1JTacLrFQP+2ryHnn6A3JOhbzj1Y552Nc1XixI9aJMxxCJGI0PvmzDb46BSLfoOz4yaqL1lBS2vyX4tc1rKL82JiokZhDlnFNS0yQgR03484BGPJ3D1+tTWQV0cXyq0nYOI+m9vPBciI1Lw07tJ5ZqJbTabtcu2aq8WrKMuFsCgYEAwCk0WB5TTQJQgjuuFXT/GU4cIl8/Pa3IgF7Ccd1WVkFr9uI6vBpToN+0i1zAb83Ss9maD3eH1Na/7GiKwzZOJj8Yas6b1UsbcHZA1Yt+cI2WUZf8L8QVYJrUtIkbKbG+jdg/KjjZt8mAO8IcXivUhfmj8XUIBClYCezEZmSIVpcCgYEAupHWmUfHo0Bo1QqB6l0pupuuUyj1OxprcG38B4itkHYL9OOJX+xgEalUYzzO9tYz23kuBmWxeRj2I6kyhK4noF85RnuFLUIoZ/gkK9Xu1jPogOuZByGK2XETAMgc3wteNj9t7Tg+kVtbHvJet+YEo75bUgw4uGX5GdxJ7r62RMcCgYEAgJfSaJm6oxFGcTCg+cj2oaeM2k+lEZCHWaiQNQSqr0ROjMOuDI0No92wg4aJXQh+1U5sc6dI5dzkSL9ZBPQFbkDRBUDINf9yGFt6Xa1g6s9FZcrwv8JXj/NtHneWDtvcqi2pb4bl48DbqKHou/hW22VJGd94gthsCxBACkmCl3cCgYEAp2/KJrDnLwAr4h6SVCufRRuNkZSRI+XITkE4xyQ/UDeL+iwCbX38Jcqa2lxCAXCLk++1xilSF/sJbBVkiDorBU9CC0tI5tPJFfHQodbePx1C0SQE8e0F+wtaeR9Z5m5KzHNs2Gciqw+2nJPU9uFQjUfGdXuIZF2bBvtXBWH+Prk='
|
||||
# rsaPublickey: 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuAltXJI4kMQkucWCeLGK4Zyqw7VUp1JYS1GkJb0eJKCgxqJBzwjl8XpStA1hCv9BEX6SEsm/d2T6SDo+G6ySpfV0RQeZ7v32kE9+Eh0BK1Q8wU91nCa1CM9yfBhKXsQ3DKq2am5oLryNWXdKLXZPgoJbuIONG2G4oKakwUMX3aASp3Cj3rNXLea8ilXjFZ+OEp0DuZ4CsasO1MTaBS84mJhnzRNbuhHq5qyrVI02jw7Fim8siIBsmDDHgBd4l9hj6KAAr0jf9JOHaOp+KxfH76taqqaXI5lZIPG7lCP65iBuNNEqDSc21abcPhgvgK5K4xj9p5sG+V1FBISCE0dPrQIDAQAB'
|
||||
# appDowloadUrl: 'http://llzby.cn/s/E9TTlQrJ'
|
||||
# pcAccessUrl: 'http://llzby.cn/s/E9TTlQrJ'
|
||||
# customServiceUrl: 'https://chaten.soboten.com/chat/h5/v2/index.html?sysnum=caf21f78c499463fbb54077f5c4a8efd&channelid=13&source=1&groupid=d16ef9bdcf3b46dc9726bbb00a7ee45b&partnerid=' #智齿客服 + biz_userId
|
||||
#
|
||||
#merchant:
|
||||
# personAuth-callback: http://lianlian.free.idcfengye.com/center/callback/personAuth/
|
||||
# enterpriseAuth-callback: http://lianlian.free.idcfengye.com/center/callback/enterpriseAuth/
|
||||
#consume:
|
||||
# third: http://lianlian.free.idcfengye.com/ll/api/order/internal/consumeOrder
|
||||
# douyin: http://127.0.0.1:8080/ll/byteDance/pay/order/writeOff
|
||||
#protocol:
|
||||
# user: https://debug.lianlianlvyou.com/businessapp/user-service-protocal.html # 用户服务协议
|
||||
# privacy: https://debug.lianlianlvyou.com/businessapp/user-privacy-protocal.html # 用户隐私协议
|
||||
#guest:
|
||||
# username: 18483679330 #游客 用户名
|
||||
# password: 123456 #游客 密码
|
||||
# merchantId: 402936
|
||||
#amap:
|
||||
# key: 9e04c876425e1f9879e941ed6db8d9c4 #高德地图key
|
||||
# poiDetailUrl: https://restapi.amap.com/v3/place/detail # 详情url
|
||||
#withdraw:
|
||||
# termUrl: https://oasd.lianlianlvyou.com/finance/open/periodic # 周期性核销结款
|
||||
# termSpecialUrl: https://oasd.lianlianlvyou.com/finance/open/periodic/new # 周期性核销结款
|
||||
# preUrl: https://oasd.lianlianlvyou.com/finance/open/advance # 预付款
|
||||
# calc: https://oasd.lianlianlvyou.com/finance/open/apply/data/treasure #计算合同可提现
|
||||
#bankUrl:
|
||||
# branchName: https://oasd.lianlianlvyou.com/finance/open/search/bank/deposit #查询支行名称 GET bankName = ?
|
||||
#
|
||||
66
src/main/resources/application.yml
Normal file
66
src/main/resources/application.yml
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
server:
|
||||
port: 8080
|
||||
shutdown: graceful
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
application:
|
||||
name: spring-boot-base-demo
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 20MB
|
||||
max-request-size: 20MB
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
serialization:
|
||||
WRITE_DATES_AS_TIMESTAMPS: false
|
||||
FAIL_ON_EMPTY_BEANS: false
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
|
||||
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: false
|
||||
auto-mapping-behavior: full
|
||||
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #??SQL????
|
||||
mapper-locations: classpath*:mapper/**/*Mapper.xml
|
||||
global-config:
|
||||
# ??????
|
||||
db-config:
|
||||
update-strategy: IGNORED
|
||||
# ???
|
||||
logic-not-delete-value: 1
|
||||
# ???
|
||||
logic-delete-value: 0
|
||||
|
||||
knife4j:
|
||||
enable: true
|
||||
production: false # ?????????true
|
||||
basic:
|
||||
enable: false # ??Swagger?Basic????,???false
|
||||
username: lianlian # Basic?????
|
||||
password: lianlian123 # Basic????
|
||||
swagger:
|
||||
title: springboot基础框架
|
||||
description: springboot基础框架
|
||||
version: 1.0.0
|
||||
base-package: cn.xf.springbootbasedemo.controller
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "health"
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
|
||||
# 日志设置
|
||||
logging:
|
||||
level:
|
||||
root:
|
||||
Reference in New Issue
Block a user