Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.0.9 #18

Merged
merged 11 commits into from
Feb 8, 2024
20 changes: 10 additions & 10 deletions opensabre-base-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
<spring-boot-maven-plugin.version>2.7.5</spring-boot-maven-plugin.version>
<dockerfile-maven-plugin.version>1.4.13</dockerfile-maven-plugin.version>
<!-- 依赖 -->
<spring.boot.version>2.7.5</spring.boot.version>
<spring.cloud.version>2021.0.4</spring.cloud.version>
<spring.cloud.alibaba.version>2021.0.4.0</spring.cloud.alibaba.version>
<spring-boot-starter-data-redis.version>2.7.5</spring-boot-starter-data-redis.version>
<jetcache-starter-redis.version>2.7.3</jetcache-starter-redis.version>
<spring.boot.version>2.7.18</spring.boot.version>
<spring.cloud.version>2021.0.9</spring.cloud.version>
<spring.cloud.alibaba.version>2021.0.5.0</spring.cloud.alibaba.version>
<spring-boot-starter-data-redis.version>2.7.18</spring-boot-starter-data-redis.version>
<jetcache-starter-redis.version>2.7.5</jetcache-starter-redis.version>
<springdoc-openapi-ui.version>1.6.12</springdoc-openapi-ui.version>
<swagger-annotations.version>2.2.4</swagger-annotations.version>
<mysql-connector-j.version>8.0.31</mysql-connector-j.version>
Expand All @@ -38,16 +38,16 @@
<commons-pool2.version>2.11.1</commons-pool2.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<hutool.version>5.8.18</hutool.version>
<spring-webmvc.version>5.3.23</spring-webmvc.version>
<spring-webmvc.version>5.3.31</spring-webmvc.version>
<feign-interceptors>1.1.2</feign-interceptors>
<guava.version>31.1-jre</guava.version>
<jackson-databind.version>2.13.4.2</jackson-databind.version>
<jackson-annotations.version>2.13.4</jackson-annotations.version>
<jackson-databind.version>2.13.5</jackson-databind.version>
<jackson-annotations.version>2.13.5</jackson-annotations.version>
<jasypt-springboot.version>3.0.5</jasypt-springboot.version>
<!-- 测试 -->
<junit-jupiter.version>5.9.1</junit-jupiter.version>
<spring-test.version>5.3.23</spring-test.version>
<spring-boot-starter-test.version>2.7.5</spring-boot-starter-test.version>
<spring-test.version>5.3.31</spring-test.version>
<spring-boot-starter-test.version>2.7.18</spring-boot-starter-test.version>
<httpclient5.version>5.2.1</httpclient5.version>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
import io.github.opensabre.common.web.rest.RestResponseBodyAdvice;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;

/**
* 初使化全局报文和全局异常配置
*/
@AutoConfiguration
@PropertySource(value = "classpath:opensabre-boot.properties", encoding = "UTF8")
@Import({DefaultGlobalExceptionHandlerAdvice.class, RestResponseBodyAdvice.class})
public class OpensabreBootConfig {
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
package io.github.opensabre.boot.config;

import io.github.opensabre.boot.entity.SwaggerInfo;
import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

import javax.annotation.Resource;

/**
* Swagger配置类
*/
@AutoConfiguration
@EnableConfigurationProperties(SwaggerInfo.class)
public class OpensabreSwaggerConfig {

@Resource
private SwaggerInfo swaggerInfo;

/**
* Swagger配置对象初使化
*
Expand All @@ -20,12 +30,12 @@ public class OpensabreSwaggerConfig {
@Bean
public OpenAPI openAPI() {
return new OpenAPI()
.info(new Info().title("Opensabre API")
.description("Opensabre rest API")
.version("v0.0.1")
.license(new License().name("Apache 2.0").url("https://github.com/opensabre/opensabre-framework")))
.info(new Info().title(swaggerInfo.getTitle())
.description(swaggerInfo.getDescription())
.version(swaggerInfo.getVersion())
.license(new License().name(swaggerInfo.getLicenseName()).url(swaggerInfo.getLicenseUrl())))
.externalDocs(new ExternalDocumentation()
.description("Opensabre Wiki Documentation")
.url("https://github.com/opensabre/opensabre-framework"));
.description(swaggerInfo.getWikiDocumentation())
.url(swaggerInfo.getWikiUrl()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.github.opensabre.boot.config;

import lombok.NonNull;
import org.springframework.boot.env.YamlPropertySourceLoader;
import org.springframework.core.env.PropertySource;
import org.springframework.core.io.support.DefaultPropertySourceFactory;
import org.springframework.core.io.support.EncodedResource;

import java.io.IOException;

/**
* 加载yaml的Factory
*/
public class YamlPropertyLoaderFactory extends DefaultPropertySourceFactory {

@Override
public @NonNull PropertySource<?> createPropertySource(String name, EncodedResource resource) throws IOException {
return new YamlPropertySourceLoader().load(resource.getResource().getFilename(), resource.getResource()).get(0);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.github.opensabre.boot.entity;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

@Data
@ConfigurationProperties(prefix = "opensabre.rest.swagger")
public class SwaggerInfo {
private String version;
private String title;
private String description;
private String licenseUrl;
private String licenseName;
private String wikiUrl;
private String wikiDocumentation;
}
48 changes: 0 additions & 48 deletions opensabre-starter-boot/src/main/resources/application.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#==============日志===============#
logging.level.io.github.opensabre=info
logging.logback.rollingpolicy.max-file-size=1GB
logging.file.path=logs/
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<configuration scan="true" scanPeriod="90 seconds">
<contextName>opensabre</contextName>
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 -->
<springProperty scope="opensabre" name="log.path" source="logging.file.path"/>
<springProperty scope="opensabre" name="log.path" source="logging.file.path" defaultValue="logs"/>
/>
<!--0. 日志格式和颜色渲染 -->
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#==============springboot相关配置===============#
spring.sleuth.sampler.probability=1
spring.mvc.format.date-time=yyyy-MM-dd HH:mm:ss
spring.mvc.format.date=yyyy-MM-dd
spring.servlet.multipart.max-request-size=2MB
spring.servlet.multipart.max-file-size=5MB
spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:8000
spring.security.oauth2.resourceserver.jwt.jwk-set-uri=http://localhost:8000/oauth2/jwks
#==============server相关配置===============#
server.shutdown=graceful
#==============敏感信息加密配置===============#
jasypt.encryptor.password=${JASYPT_ENCRYPTOR_PASSWORD:Pa55w0rd@opensabre}
#==============管理端点===============#
#启用配置里的info开头的变量
management.info.env.enabled=true
info.name=${spring.application.name}
info.version=${application.formatted-version}
info.java.version=${java.version}
info.opensabre.version=${opensabre.version}
info.opensabre.cloud.az=${opensabre.cloud.az}
info.opensabre.cloud.region=${opensabre.cloud.region}
#==============脱敏===============#
opensabre.sensitive.log.enabled=false
opensabre.sensitive.log.rules=mobile,idCard,phone
#==============Rest报文===============#
# 统一报文排除的包名,该包下的rest不使用统一报文,框架内置
opensabre.rest.result.framework.excludes=org.springdoc
# 统一报文排除的包名,该包下的rest不使用统一报文,应用级配置
opensabre.rest.result.excludes=
#==============Rest Swagger文档===============#
opensabre.rest.swagger.version=v0.0.1
opensabre.rest.swagger.title=Opensabre API
opensabre.rest.swagger.description=Opensabre REST API
opensabre.rest.swagger.licenseUrl=https://github.com/opensabre/opensabre-framework
opensabre.rest.swagger.licenseName=Apache 2.0
opensabre.rest.swagger.wikiUrl=https://opensabre.github.io/docs
opensabre.rest.swagger.wikiDocumentation=Opensabre Wiki Documentation
2 changes: 1 addition & 1 deletion opensabre-starter-boot/src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ logging:
max-file-size: 1GB
file:
path: logs/
config: classpath:logback-opensabre.xml
config: classpath:logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.github.opensabre.cache.redis;

/**
* 默认缓存区域
* longTime 长时间缓存
* shortTime 短时缓存
*/
public interface DefaultCacheArea {
String LONG_TIME_AREA = "longTime";
String SHORT_TIME_AREA = "shortTime";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.github.opensabre.cache.redis;

import com.alicp.jetcache.autoconfigure.JetCacheAutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.PropertySource;

/**
* 打开Redis缓存配置类
*/
@AutoConfiguration(before = JetCacheAutoConfiguration.class)
@PropertySource(value = "classpath:opensabre-cache.properties", encoding = "UTF8")
public class JetCacheConfig {
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
io.github.opensabre.cache.redis.RedisConfig
io.github.opensabre.cache.redis.JetCacheConfig
64 changes: 0 additions & 64 deletions opensabre-starter-cache/src/main/resources/application.yml

This file was deleted.

Loading
Loading