Skip to content

Commit 85c56cd

Browse files
authored
Merge pull request #18 from opensabre/0.0.9
0.0.9
2 parents 43a8d00 + 1039068 commit 85c56cd

File tree

43 files changed

+469
-198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+469
-198
lines changed

opensabre-base-dependencies/pom.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
<spring-boot-maven-plugin.version>2.7.5</spring-boot-maven-plugin.version>
2525
<dockerfile-maven-plugin.version>1.4.13</dockerfile-maven-plugin.version>
2626
<!-- 依赖 -->
27-
<spring.boot.version>2.7.5</spring.boot.version>
28-
<spring.cloud.version>2021.0.4</spring.cloud.version>
29-
<spring.cloud.alibaba.version>2021.0.4.0</spring.cloud.alibaba.version>
30-
<spring-boot-starter-data-redis.version>2.7.5</spring-boot-starter-data-redis.version>
31-
<jetcache-starter-redis.version>2.7.3</jetcache-starter-redis.version>
27+
<spring.boot.version>2.7.18</spring.boot.version>
28+
<spring.cloud.version>2021.0.9</spring.cloud.version>
29+
<spring.cloud.alibaba.version>2021.0.5.0</spring.cloud.alibaba.version>
30+
<spring-boot-starter-data-redis.version>2.7.18</spring-boot-starter-data-redis.version>
31+
<jetcache-starter-redis.version>2.7.5</jetcache-starter-redis.version>
3232
<springdoc-openapi-ui.version>1.6.12</springdoc-openapi-ui.version>
3333
<swagger-annotations.version>2.2.4</swagger-annotations.version>
3434
<mysql-connector-j.version>8.0.31</mysql-connector-j.version>
@@ -38,16 +38,16 @@
3838
<commons-pool2.version>2.11.1</commons-pool2.version>
3939
<commons-lang3.version>3.12.0</commons-lang3.version>
4040
<hutool.version>5.8.18</hutool.version>
41-
<spring-webmvc.version>5.3.23</spring-webmvc.version>
41+
<spring-webmvc.version>5.3.31</spring-webmvc.version>
4242
<feign-interceptors>1.1.2</feign-interceptors>
4343
<guava.version>31.1-jre</guava.version>
44-
<jackson-databind.version>2.13.4.2</jackson-databind.version>
45-
<jackson-annotations.version>2.13.4</jackson-annotations.version>
44+
<jackson-databind.version>2.13.5</jackson-databind.version>
45+
<jackson-annotations.version>2.13.5</jackson-annotations.version>
4646
<jasypt-springboot.version>3.0.5</jasypt-springboot.version>
4747
<!-- 测试 -->
4848
<junit-jupiter.version>5.9.1</junit-jupiter.version>
49-
<spring-test.version>5.3.23</spring-test.version>
50-
<spring-boot-starter-test.version>2.7.5</spring-boot-starter-test.version>
49+
<spring-test.version>5.3.31</spring-test.version>
50+
<spring-boot-starter-test.version>2.7.18</spring-boot-starter-test.version>
5151
<httpclient5.version>5.2.1</httpclient5.version>
5252
</properties>
5353

opensabre-starter-boot/src/main/java/io/github/opensabre/boot/config/OpensabreBootConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
import io.github.opensabre.common.web.rest.RestResponseBodyAdvice;
55
import org.springframework.boot.autoconfigure.AutoConfiguration;
66
import org.springframework.context.annotation.Import;
7+
import org.springframework.context.annotation.PropertySource;
78

89
/**
910
* 初使化全局报文和全局异常配置
1011
*/
1112
@AutoConfiguration
13+
@PropertySource(value = "classpath:opensabre-boot.properties", encoding = "UTF8")
1214
@Import({DefaultGlobalExceptionHandlerAdvice.class, RestResponseBodyAdvice.class})
1315
public class OpensabreBootConfig {
1416
}
Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
package io.github.opensabre.boot.config;
22

3+
import io.github.opensabre.boot.entity.SwaggerInfo;
34
import io.swagger.v3.oas.models.ExternalDocumentation;
45
import io.swagger.v3.oas.models.OpenAPI;
56
import io.swagger.v3.oas.models.info.Info;
67
import io.swagger.v3.oas.models.info.License;
78
import org.springframework.boot.autoconfigure.AutoConfiguration;
9+
import org.springframework.boot.context.properties.ConfigurationProperties;
10+
import org.springframework.boot.context.properties.EnableConfigurationProperties;
811
import org.springframework.context.annotation.Bean;
912

13+
import javax.annotation.Resource;
14+
1015
/**
1116
* Swagger配置类
1217
*/
1318
@AutoConfiguration
19+
@EnableConfigurationProperties(SwaggerInfo.class)
1420
public class OpensabreSwaggerConfig {
21+
22+
@Resource
23+
private SwaggerInfo swaggerInfo;
24+
1525
/**
1626
* Swagger配置对象初使化
1727
*
@@ -20,12 +30,12 @@ public class OpensabreSwaggerConfig {
2030
@Bean
2131
public OpenAPI openAPI() {
2232
return new OpenAPI()
23-
.info(new Info().title("Opensabre API")
24-
.description("Opensabre rest API")
25-
.version("v0.0.1")
26-
.license(new License().name("Apache 2.0").url("https://github.com/opensabre/opensabre-framework")))
33+
.info(new Info().title(swaggerInfo.getTitle())
34+
.description(swaggerInfo.getDescription())
35+
.version(swaggerInfo.getVersion())
36+
.license(new License().name(swaggerInfo.getLicenseName()).url(swaggerInfo.getLicenseUrl())))
2737
.externalDocs(new ExternalDocumentation()
28-
.description("Opensabre Wiki Documentation")
29-
.url("https://github.com/opensabre/opensabre-framework"));
38+
.description(swaggerInfo.getWikiDocumentation())
39+
.url(swaggerInfo.getWikiUrl()));
3040
}
3141
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package io.github.opensabre.boot.config;
2+
3+
import lombok.NonNull;
4+
import org.springframework.boot.env.YamlPropertySourceLoader;
5+
import org.springframework.core.env.PropertySource;
6+
import org.springframework.core.io.support.DefaultPropertySourceFactory;
7+
import org.springframework.core.io.support.EncodedResource;
8+
9+
import java.io.IOException;
10+
11+
/**
12+
* 加载yaml的Factory
13+
*/
14+
public class YamlPropertyLoaderFactory extends DefaultPropertySourceFactory {
15+
16+
@Override
17+
public @NonNull PropertySource<?> createPropertySource(String name, EncodedResource resource) throws IOException {
18+
return new YamlPropertySourceLoader().load(resource.getResource().getFilename(), resource.getResource()).get(0);
19+
}
20+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package io.github.opensabre.boot.entity;
2+
3+
import lombok.Data;
4+
import org.springframework.boot.context.properties.ConfigurationProperties;
5+
6+
@Data
7+
@ConfigurationProperties(prefix = "opensabre.rest.swagger")
8+
public class SwaggerInfo {
9+
private String version;
10+
private String title;
11+
private String description;
12+
private String licenseUrl;
13+
private String licenseName;
14+
private String wikiUrl;
15+
private String wikiDocumentation;
16+
}

opensabre-starter-boot/src/main/resources/application.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#==============日志===============#
2+
logging.level.io.github.opensabre=info
3+
logging.logback.rollingpolicy.max-file-size=1GB
4+
logging.file.path=logs/

opensabre-starter-boot/src/main/resources/logback-opensabre.xml renamed to opensabre-starter-boot/src/main/resources/logback-spring.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
<configuration scan="true" scanPeriod="90 seconds">
77
<contextName>opensabre</contextName>
88
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 -->
9-
<springProperty scope="opensabre" name="log.path" source="logging.file.path"/>
9+
<springProperty scope="opensabre" name="log.path" source="logging.file.path" defaultValue="logs"/>
10+
/>
1011
<!--0. 日志格式和颜色渲染 -->
1112
<!-- 彩色日志依赖的渲染类 -->
1213
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#==============springboot相关配置===============#
2+
spring.sleuth.sampler.probability=1
3+
spring.mvc.format.date-time=yyyy-MM-dd HH:mm:ss
4+
spring.mvc.format.date=yyyy-MM-dd
5+
spring.servlet.multipart.max-request-size=2MB
6+
spring.servlet.multipart.max-file-size=5MB
7+
spring.jackson.time-zone=GMT+8
8+
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
9+
spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:8000
10+
spring.security.oauth2.resourceserver.jwt.jwk-set-uri=http://localhost:8000/oauth2/jwks
11+
#==============server相关配置===============#
12+
server.shutdown=graceful
13+
#==============敏感信息加密配置===============#
14+
jasypt.encryptor.password=${JASYPT_ENCRYPTOR_PASSWORD:Pa55w0rd@opensabre}
15+
#==============管理端点===============#
16+
#启用配置里的info开头的变量
17+
management.info.env.enabled=true
18+
info.name=${spring.application.name}
19+
info.version=${application.formatted-version}
20+
info.java.version=${java.version}
21+
info.opensabre.version=${opensabre.version}
22+
info.opensabre.cloud.az=${opensabre.cloud.az}
23+
info.opensabre.cloud.region=${opensabre.cloud.region}
24+
#==============脱敏===============#
25+
opensabre.sensitive.log.enabled=false
26+
opensabre.sensitive.log.rules=mobile,idCard,phone
27+
#==============Rest报文===============#
28+
# 统一报文排除的包名,该包下的rest不使用统一报文,框架内置
29+
opensabre.rest.result.framework.excludes=org.springdoc
30+
# 统一报文排除的包名,该包下的rest不使用统一报文,应用级配置
31+
opensabre.rest.result.excludes=
32+
#==============Rest Swagger文档===============#
33+
opensabre.rest.swagger.version=v0.0.1
34+
opensabre.rest.swagger.title=Opensabre API
35+
opensabre.rest.swagger.description=Opensabre REST API
36+
opensabre.rest.swagger.licenseUrl=https://github.com/opensabre/opensabre-framework
37+
opensabre.rest.swagger.licenseName=Apache 2.0
38+
opensabre.rest.swagger.wikiUrl=https://opensabre.github.io/docs
39+
opensabre.rest.swagger.wikiDocumentation=Opensabre Wiki Documentation

opensabre-starter-boot/src/test/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ logging:
4545
max-file-size: 1GB
4646
file:
4747
path: logs/
48-
config: classpath:logback-opensabre.xml
48+
config: classpath:logback-spring.xml

0 commit comments

Comments
 (0)