From 8b53505af06d5fd042d41735c1df96310ac99583 Mon Sep 17 00:00:00 2001 From: Parker Date: Sun, 13 Sep 2020 10:21:49 +0800 Subject: [PATCH] first commit --- .gitignore | 31 ++ README.md | 5 + opsli-common/README.md | 8 + opsli-common/pom.xml | 16 + .../org/opsli/common/conf/SwaggerConfig.java | 107 +++++ .../org/opsli/common/print/StartPrint.java | 43 ++ opsli-common/src/main/resources/banner.txt | 10 + opsli-modulars/README.md | 4 + opsli-modulars/opsli-modulars-test/pom.xml | 16 + opsli-plugins/README.md | 5 + opsli-plugins/opsli-plugins-mail/pom.xml | 16 + .../java/org/opsli/plugins/mail/MailUtil.java | 22 + opsli-web/README.md | 6 + opsli-web/pom.xml | 52 +++ .../main/java/org/opsli/OpsliApplication.java | 22 + .../src/main/resources/application-beta.yaml | 103 +++++ .../src/main/resources/application-dev.yaml | 104 +++++ .../main/resources/application-release.yaml | 103 +++++ opsli-web/src/main/resources/application.yaml | 54 +++ pom.xml | 401 ++++++++++++++++++ 20 files changed, 1128 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 opsli-common/README.md create mode 100644 opsli-common/pom.xml create mode 100644 opsli-common/src/main/java/org/opsli/common/conf/SwaggerConfig.java create mode 100644 opsli-common/src/main/java/org/opsli/common/print/StartPrint.java create mode 100644 opsli-common/src/main/resources/banner.txt create mode 100644 opsli-modulars/README.md create mode 100644 opsli-modulars/opsli-modulars-test/pom.xml create mode 100644 opsli-plugins/README.md create mode 100644 opsli-plugins/opsli-plugins-mail/pom.xml create mode 100644 opsli-plugins/opsli-plugins-mail/src/main/java/org/opsli/plugins/mail/MailUtil.java create mode 100644 opsli-web/README.md create mode 100644 opsli-web/pom.xml create mode 100644 opsli-web/src/main/java/org/opsli/OpsliApplication.java create mode 100644 opsli-web/src/main/resources/application-beta.yaml create mode 100644 opsli-web/src/main/resources/application-dev.yaml create mode 100644 opsli-web/src/main/resources/application-release.yaml create mode 100644 opsli-web/src/main/resources/application.yaml create mode 100644 pom.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..a2a3040a --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/** +!**/src/test/** + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ + +### VS Code ### +.vscode/ diff --git a/README.md b/README.md new file mode 100644 index 00000000..3ce07446 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +## opsli 快速开发平台 + + + + diff --git a/opsli-common/README.md b/opsli-common/README.md new file mode 100644 index 00000000..4333a8c9 --- /dev/null +++ b/opsli-common/README.md @@ -0,0 +1,8 @@ +## opsli 公共模块 + 1. core 核心 + 2. utils 工具类 + 3. api 统一RestFul返回API + 4. base 基础类 + 5. conf 配置类 + 6. constant 常量类 + 7. excption 异常类 diff --git a/opsli-common/pom.xml b/opsli-common/pom.xml new file mode 100644 index 00000000..f84f7070 --- /dev/null +++ b/opsli-common/pom.xml @@ -0,0 +1,16 @@ + + + + opsli-boot-parent + org.opsliframework.boot + 1.0.0 + + + + 4.0.0 + opsli-common + ${project.parent.version} + + \ No newline at end of file diff --git a/opsli-common/src/main/java/org/opsli/common/conf/SwaggerConfig.java b/opsli-common/src/main/java/org/opsli/common/conf/SwaggerConfig.java new file mode 100644 index 00000000..88ed056d --- /dev/null +++ b/opsli-common/src/main/java/org/opsli/common/conf/SwaggerConfig.java @@ -0,0 +1,107 @@ +package org.opsli.common.conf; + +import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +/** + * @Author parker + * + * swagger配置 + */ +@Slf4j +@Configuration +@EnableSwagger2 +@EnableSwaggerBootstrapUI +@ConditionalOnProperty(name = "swagger.enable", havingValue = "true") +public class SwaggerConfig implements WebMvcConfigurer { + + /** + * + * 显示swagger-ui.html文档展示页,还必须注入swagger资源: + * + * @param registry + */ + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); + registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/"); + registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); + } + + /** + * swagger2的配置文件,这里可以配置swagger2的一些基本的内容,比如扫描的包等等 + * + * @return Docket + */ + @Bean + public Docket createRestApi() { + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + //此包路径下的类,才生成接口文档 + .apis(RequestHandlerSelectors.basePackage("org.opsli.modulars")) + //加了ApiOperation注解的类,才生成接口文档 + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + .paths(PathSelectors.any()) + .build(); + //.securitySchemes(Collections.singletonList(securityScheme())); + //.globalOperationParameters(setHeaderToken()); + } + + /*** + * oauth2配置 + * 需要增加swagger授权回调地址 + * http://localhost:8888/webjars/springfox-swagger-ui/o2c.html + * @return + */ +// @Bean +// SecurityScheme securityScheme() { +// return new ApiKey(DefContants.X_ACCESS_TOKEN, DefContants.X_ACCESS_TOKEN, "header"); +// } + /** + * JWT token + * @return + */ +// private List setHeaderToken() { +// ParameterBuilder tokenPar = new ParameterBuilder(); +// List pars = new ArrayList<>(); +// tokenPar.name(DefContants.X_ACCESS_TOKEN).description("token").modelRef(new ModelRef("string")).parameterType("header").required(false).build(); +// pars.add(tokenPar.build()); +// return pars; +// } + + /** + * api文档的详细信息函数,注意这里的注解引用的是哪个 + * + * @return + */ + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + // //大标题 + .title("Opsli-Boot 后台服务API接口文档") + // 版本号 + .version("1.0") +// .termsOfServiceUrl("NO terms of service") + // 描述 + .description("后台API接口") + // 作者 + .contact("Parker") + .license("The Apache License, Version 2.0") + .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") + .build(); + } + +} diff --git a/opsli-common/src/main/java/org/opsli/common/print/StartPrint.java b/opsli-common/src/main/java/org/opsli/common/print/StartPrint.java new file mode 100644 index 00000000..5d5e8be3 --- /dev/null +++ b/opsli-common/src/main/java/org/opsli/common/print/StartPrint.java @@ -0,0 +1,43 @@ +package org.opsli.common.print; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.core.env.Environment; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +/** + * @BelongsProject: opsli-boot + * @BelongsPackage: org.opsli.core.print + * @Author: Parker + * @CreateTime: 2020-09-12 17:54 + * @Description: 打印启动日志 + */ +@Slf4j +public enum StartPrint { + + /** 实例对象 */ + INSTANCE; + + /** + * 打印启动日志 + */ + public void print(Environment env){ + String ip = "localhost"; + try { + ip = InetAddress.getLocalHost().getHostAddress(); + }catch (UnknownHostException e){ + log.error("网卡IP 获得失败"); + } + String port = env.getProperty("server.port"); + String path = env.getProperty("server.servlet.context-path"); + log.info("\n----------------------------------------------------------\n\t" + + "Application opsli-boot is running! Access URLs:\n\t" + + "Local: \t\thttp://" + ip + ":" + port + path + "/\n\t" + + "External: \thttp://" + ip + ":" + port + path + "/\n\t" + + "swagger-ui: \thttp://" + ip + ":" + port + path + "/swagger-ui.html\n\t" + + "Doc: \t\thttp://" + ip + ":" + port + path + "/doc.html\n" + + "----------------------------------------------------------"); + } + +} diff --git a/opsli-common/src/main/resources/banner.txt b/opsli-common/src/main/resources/banner.txt new file mode 100644 index 00000000..586ad8f6 --- /dev/null +++ b/opsli-common/src/main/resources/banner.txt @@ -0,0 +1,10 @@ + + ${AnsiColor.GREEN} ____ ____ ${AnsiColor.CYAN}_____ __ ____ + ${AnsiColor.GREEN} / __ \ / __ \ ${AnsiColor.CYAN}/ ___/ / / / _/ + ${AnsiColor.GREEN} / / / / / /_/ / ${AnsiColor.CYAN}\__ \ / / / / + ${AnsiColor.GREEN}/ /_/ / / ____/ ${AnsiColor.CYAN}___/ / / /___ _/ / + ${AnsiColor.GREEN}\____/ /_/ ${AnsiColor.CYAN}/____/ /_____//___/ + + +${AnsiColor.BRIGHT_BLUE}:: opsli :: Running Spring Boot ${spring-boot.version} :: +:: https://www.opsli.com ::${AnsiColor.DEFAULT} diff --git a/opsli-modulars/README.md b/opsli-modulars/README.md new file mode 100644 index 00000000..c3060593 --- /dev/null +++ b/opsli-modulars/README.md @@ -0,0 +1,4 @@ +## opsli 业务模块 + +> 可扩展业务模块 + diff --git a/opsli-modulars/opsli-modulars-test/pom.xml b/opsli-modulars/opsli-modulars-test/pom.xml new file mode 100644 index 00000000..4f07a19e --- /dev/null +++ b/opsli-modulars/opsli-modulars-test/pom.xml @@ -0,0 +1,16 @@ + + + + org.opsliframework.boot + opsli-boot-parent + 1.0.0 + ../../pom.xml + + + 4.0.0 + opsli-modulars-test + ${project.parent.version} + + \ No newline at end of file diff --git a/opsli-plugins/README.md b/opsli-plugins/README.md new file mode 100644 index 00000000..a84bc943 --- /dev/null +++ b/opsli-plugins/README.md @@ -0,0 +1,5 @@ +## opsli 插件类 + 1. mail 邮件插件 + + + diff --git a/opsli-plugins/opsli-plugins-mail/pom.xml b/opsli-plugins/opsli-plugins-mail/pom.xml new file mode 100644 index 00000000..fdc62cc5 --- /dev/null +++ b/opsli-plugins/opsli-plugins-mail/pom.xml @@ -0,0 +1,16 @@ + + + + opsli-boot-parent + org.opsliframework.boot + 1.0.0 + ../../pom.xml + + + 4.0.0 + opsli-plugins-mail + ${project.parent.version} + + \ No newline at end of file diff --git a/opsli-plugins/opsli-plugins-mail/src/main/java/org/opsli/plugins/mail/MailUtil.java b/opsli-plugins/opsli-plugins-mail/src/main/java/org/opsli/plugins/mail/MailUtil.java new file mode 100644 index 00000000..f174eecc --- /dev/null +++ b/opsli-plugins/opsli-plugins-mail/src/main/java/org/opsli/plugins/mail/MailUtil.java @@ -0,0 +1,22 @@ +package org.opsli.plugins.mail; + +/** + * @BelongsProject: opsli-boot + * @BelongsPackage: org.opsli.plugins.mail + * @Author: Parker + * @CreateTime: 2020-09-12 22:51 + * @Description: 邮件工具 + */ +public enum MailUtil { + + /** 实例*/ + INSTANCE; + + /** + * 发送邮件 + */ + public void send(){ + + } + +} diff --git a/opsli-web/README.md b/opsli-web/README.md new file mode 100644 index 00000000..6f07ef3c --- /dev/null +++ b/opsli-web/README.md @@ -0,0 +1,6 @@ +## opsli 核心启动类 + +> 需要启动、打包、发布的模块都需要添加到opsli-web的依赖中,opsli-web下运行install,打包发布时,该模块不会被打进jar中。 + + + diff --git a/opsli-web/pom.xml b/opsli-web/pom.xml new file mode 100644 index 00000000..82868add --- /dev/null +++ b/opsli-web/pom.xml @@ -0,0 +1,52 @@ + + + + opsli-boot-parent + org.opsliframework.boot + 1.0.0 + + + + 4.0.0 + opsli-web + ${project.parent.version} + + + + + + org.opsliframework.boot + opsli-common + ${project.parent.version} + + + + + org.opsliframework.boot + opsli-plugins-mail + ${project.parent.version} + + + + + + org.opsliframework.boot + opsli-modulars-test + ${project.parent.version} + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/opsli-web/src/main/java/org/opsli/OpsliApplication.java b/opsli-web/src/main/java/org/opsli/OpsliApplication.java new file mode 100644 index 00000000..9132f4c1 --- /dev/null +++ b/opsli-web/src/main/java/org/opsli/OpsliApplication.java @@ -0,0 +1,22 @@ +package org.opsli; + +import org.opsli.common.print.StartPrint; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.context.ConfigurableApplicationContext; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + + +@EnableSwagger2 +@SpringBootApplication() +public class OpsliApplication { + + public static void main(String[] args){ + ConfigurableApplicationContext application = SpringApplication.run(OpsliApplication.class, args); + // 打印启动日志 + StartPrint.INSTANCE.print(application.getEnvironment()); + } + +} \ No newline at end of file diff --git a/opsli-web/src/main/resources/application-beta.yaml b/opsli-web/src/main/resources/application-beta.yaml new file mode 100644 index 00000000..7cc0f42a --- /dev/null +++ b/opsli-web/src/main/resources/application-beta.yaml @@ -0,0 +1,103 @@ +## ---- 测试环境 ---- ## + + +# 端口设置 +server: + port: 91 + +spring: + # 邮件设置 + mail: + host: smtp.qq.com + username: meet.parker@foxmail.com + password: ?? + properties: + mail: + smpt: + auth: true + starttls: + enable: true + required: true +# ## quartz定时任务,采用数据库方式 +# quartz: +# job-store-type: jdbc + + #redis 配置 + redis: + database: 0 + host: 127.0.0.1 + lettuce: + pool: + max-active: 8 #最大连接数据库连接数,设 0 为没有限制 + max-idle: 8 #最大等待连接中的数量,设 0 为没有限制 + max-wait: -1ms #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。 + min-idle: 0 #最小等待连接中的数量,设 0 为没有限制 + shutdown-timeout: 100ms + password: '123456' + port: 6379 + + + # 数据库配置 + datasource: + # 数据库连接池监控 + druid: + stat-view-servlet: + # 数据库监控开关 + enabled: true + # 登录用户名/密码 + login-username: admin + login-password: 123456 + # IP 白名单,没有配置或者为空,则允许所有访问 + allow: + # IP 黑名单,若白名单也存在,则优先使用 + deny: + web-stat-filter: + enabled: true + url-pattern: /* + exclusions: .js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/* + # 多数据源 + dynamic: + druid: + # 连接池的配置信息 + # 初始化大小,最小,最大 + initial-size: 5 + min-idle: 5 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + # 打开PSCache,并且指定每个连接上PSCache的大小 + poolPreparedStatements: true + maxPoolPreparedStatementPerConnectionSize: 20 + # 配置监控统计拦截的 Filter,去掉后监控界面 SQL 无法统计,wall 用于防火墙 + filters: stat,wall,slf4j + # 通过connectProperties属性来打开mergeSql功能;慢SQL记录 + connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 + datasource: + master: + url: jdbc:mysql://127.0.0.1:3306/opsli-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false + username: root + password: 12345678 + driver-class-name: com.mysql.jdbc.Driver + # 多数据源配置 + #multi-datasource1: + #url: jdbc:mysql://localhost:3306/opsli-boot?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true + #username: root + #password: root + #driver-class-name: com.mysql.jdbc.Driver + +#Mybatis输出sql日志 +logging: + level: + org.opsli.modulars.system.mapper : debug + +# swagger 配置 +swagger: + production: true \ No newline at end of file diff --git a/opsli-web/src/main/resources/application-dev.yaml b/opsli-web/src/main/resources/application-dev.yaml new file mode 100644 index 00000000..b81978fc --- /dev/null +++ b/opsli-web/src/main/resources/application-dev.yaml @@ -0,0 +1,104 @@ +## ---- 开发环境 ---- ## + + +# 端口设置 +server: + port: 8080 + +spring: + # 邮件设置 + mail: + host: smtp.qq.com + username: meet.parker@foxmail.com + password: pamjnijkjkqdbbea + properties: + mail: + smpt: + auth: true + starttls: + enable: true + required: true +# ## quartz定时任务,采用数据库方式 +# quartz: +# job-store-type: jdbc + + #redis 配置 + redis: + database: 0 + host: 127.0.0.1 + lettuce: + pool: + max-active: 8 #最大连接数据库连接数,设 0 为没有限制 + max-idle: 8 #最大等待连接中的数量,设 0 为没有限制 + max-wait: -1ms #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。 + min-idle: 0 #最小等待连接中的数量,设 0 为没有限制 + shutdown-timeout: 100ms + password: '123456' + port: 6379 + # 数据库配置 + datasource: + # 数据库连接池监控 + druid: + stat-view-servlet: + # 数据库监控开关 + enabled: true + # 登录用户名/密码 + login-username: admin + login-password: 123456 + # IP 白名单,没有配置或者为空,则允许所有访问 + allow: + # IP 黑名单,若白名单也存在,则优先使用 + deny: + web-stat-filter: + enabled: true + url-pattern: /* + exclusions: .js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/* + # 多数据源 + dynamic: + druid: + # 连接池的配置信息 + # 初始化大小,最小,最大 + initial-size: 5 + min-idle: 5 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + # 打开PSCache,并且指定每个连接上PSCache的大小 + poolPreparedStatements: true + maxPoolPreparedStatementPerConnectionSize: 20 + # 配置监控统计拦截的 Filter,去掉后监控界面 SQL 无法统计,wall 用于防火墙 + filters: stat,wall,slf4j + # 通过connectProperties属性来打开mergeSql功能;慢SQL记录 + connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 + #主数据源 + #设置默认的数据源或者数据源组,默认值即为master,如果你主从默认下主库的名称就是master可不定义此项。 + #primary: master + datasource: + master: + url: jdbc:mysql://127.0.0.1:3306/opsli-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false + username: root + password: 12345678 + driver-class-name: com.mysql.jdbc.Driver + # 多数据源配置 + #multi-datasource1: + #url: jdbc:mysql://localhost:3306/opsli-boot?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true + #username: root + #password: 12345678 + #driver-class-name: com.mysql.jdbc.Driver + +#Mybatis输出sql日志 +logging: + level: + org.opsli.modulars.system.mapper : debug + +# swagger 配置 +swagger: + production: false \ No newline at end of file diff --git a/opsli-web/src/main/resources/application-release.yaml b/opsli-web/src/main/resources/application-release.yaml new file mode 100644 index 00000000..de089cdf --- /dev/null +++ b/opsli-web/src/main/resources/application-release.yaml @@ -0,0 +1,103 @@ +## ---- 正式环境 ---- ## + + +# 端口设置 +server: + port: 81 + +spring: + # 邮件设置 + mail: + host: smtp.qq.com + username: meet.parker@foxmail.com + password: ?? + properties: + mail: + smpt: + auth: true + starttls: + enable: true + required: true +# ## quartz定时任务,采用数据库方式 +# quartz: +# job-store-type: jdbc + + #redis 配置 + redis: + database: 0 + host: 127.0.0.1 + lettuce: + pool: + max-active: 8 #最大连接数据库连接数,设 0 为没有限制 + max-idle: 8 #最大等待连接中的数量,设 0 为没有限制 + max-wait: -1ms #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。 + min-idle: 0 #最小等待连接中的数量,设 0 为没有限制 + shutdown-timeout: 100ms + password: '123456' + port: 6379 + + + # 数据库配置 + datasource: + # 数据库连接池监控 + druid: + stat-view-servlet: + # 数据库监控开关 + enabled: true + # 登录用户名/密码 + login-username: admin + login-password: SQL!@#0p9o8i7u + # IP 白名单,没有配置或者为空,则允许所有访问 + allow: + # IP 黑名单,若白名单也存在,则优先使用 + deny: + web-stat-filter: + enabled: true + url-pattern: /* + exclusions: .js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/* + # 多数据源 + dynamic: + druid: + # 连接池的配置信息 + # 初始化大小,最小,最大 + initial-size: 5 + min-idle: 5 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + # 打开PSCache,并且指定每个连接上PSCache的大小 + poolPreparedStatements: true + maxPoolPreparedStatementPerConnectionSize: 20 + # 配置监控统计拦截的 Filter,去掉后监控界面 SQL 无法统计,wall 用于防火墙 + filters: stat,wall,slf4j + # 通过connectProperties属性来打开mergeSql功能;慢SQL记录 + connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 + datasource: + master: + url: jdbc:mysql://127.0.0.1:3306/opsli-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false + username: root + password: 12345678 + driver-class-name: com.mysql.jdbc.Driver + # 多数据源配置 + #multi-datasource1: + #url: jdbc:mysql://localhost:3306/opsli-boot?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true + #username: root + #password: root + #driver-class-name: com.mysql.jdbc.Driver + +#Mybatis输出sql日志 +logging: + level: + org.opsli.modulars.system.mapper : debug + +# swagger 配置 +swagger: + production: true \ No newline at end of file diff --git a/opsli-web/src/main/resources/application.yaml b/opsli-web/src/main/resources/application.yaml new file mode 100644 index 00000000..987376c6 --- /dev/null +++ b/opsli-web/src/main/resources/application.yaml @@ -0,0 +1,54 @@ +# tomcat 配置 +server: + tomcat: + max-swallow-size: -1 + servlet: + context-path: /opsli-boot + compression: + enabled: true + min-response-size: 1024 + mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/* + +# actuator 暴露端点 +management: + endpoints: + web: + exposure: + include: metrics,httptrace + +#mybatis plus 设置 +mybatis-plus: + mapper-locations: classpath*:org/opsli/modulars/**/xml/*Mapper.xml + global-config: + # 关闭MP3.0自带的banner + banner: false + db-config: + #主键类型 0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)"; + id-type: 4 + # 默认数据库表下划线命名 + table-underline: true + configuration: + # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用 + #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + # 返回类型为Map,显示null对应的字段 + call-setters-on-nulls: true + +spring: + servlet: + multipart: + max-file-size: 10MB + max-request-size: 10MB + #json 时间戳统一转换 + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 + #开启aop + aop: + proxy-target-class: true + # 自动注入 + autoconfigure: + exclude: + - com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure + profiles: + #此处由maven的环境选择决定 + active: "@spring.active@" diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..be084d93 --- /dev/null +++ b/pom.xml @@ -0,0 +1,401 @@ + + + + + opsli-boot-parent + + https://www.opsli.com + + 一个基于springboot、vue、ant design、集成代码生成器的Java开源快速开发框架,微服务平台。 + + + + + + parker + + Parker Chou + + meet.parker@foxmail.com + + https://www.opsli.com + + + Project Manager + Architect + + + personal + + + + + + org.springframework.boot + spring-boot-starter-parent + 2.3.3.RELEASE + + + + + 4.0.0 + org.opsliframework.boot + opsli-boot-parent + 1.0.0 + pom + + + + opsli-web + opsli-common + opsli-modulars/opsli-modulars-test + opsli-plugins/opsli-plugins-mail + + + + + UTF-8 + UTF-8 + 1.8 + 2.3.0.RELEASE + 1.2.73 + 3.4.0 + 1.1.17 + 2.5.4 + 0.9.1 + 3.11 + 2.8.0 + 29.0-jre + 5.4.2 + + + + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-mail + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-starter-aop + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + + + + + org.apache.shiro + shiro-spring-boot-starter + 1.6.0 + + + + + org.crazycake + shiro-redis + 3.3.0 + + + org.apache.shiro + shiro-core + + + + + + + + + com.baomidou + mybatis-plus-boot-starter + ${mybatis-plus.version} + + + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + + + com.baomidou + dynamic-datasource-spring-boot-starter + ${dynamic.version} + + + + + mysql + mysql-connector-java + 8.0.20 + runtime + + + + com.microsoft.sqlserver + sqljdbc4 + 4.0 + runtime + + + + com.oracle + ojdbc6 + 11.2.0.3 + runtime + + + + org.postgresql + postgresql + 42.2.6 + runtime + + + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + org.apache.commons + commons-pool2 + + + + + + + io.springfox + springfox-swagger2 + 2.9.2 + + + io.springfox + springfox-swagger-ui + 2.9.2 + + + com.github.xiaoymin + swagger-bootstrap-ui + 1.9.3 + + + io.springfox + springfox-bean-validators + 2.9.2 + + + + io.swagger + swagger-annotations + 1.5.22 + + + io.swagger + swagger-models + 1.5.22 + + + + + + + commons-io + commons-io + ${commons.io.version} + + + org.apache.commons + commons-lang3 + ${commons.lang3.version} + + + + + com.google.guava + guava + ${guava.version} + + + + + org.projectlombok + lombok + + + + + + com.alibaba + fastjson + ${fastjson.version} + + + + + cn.hutool + hutool-all + ${hutool.version} + + + + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + + + + + + aliyun + aliyun Repository + http://maven.aliyun.com/nexus/content/groups/public + + false + + + + uk + uk Repository + http://uk.maven.org/maven2/ + + false + + + + ibiblio + ibiblio Repository + http://mirrors.ibiblio.org/pub/mirrors/maven2 + + false + + + + + + + + + + dev + + dev + + + + true + + + + + release + + release + + + + + beta + + beta + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + UTF-8 + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + org.apache.maven.plugins + maven-resources-plugin + + + woff + woff2 + eot + ttf + svg + + + + + + + src/main/resources + true + + + src/main/java + + **/*.xml + **/*.json + **/*.ftl + + + + + +