refactor: 升级 springboot 版本.
This commit is contained in:
@@ -15,7 +15,7 @@ public class WebsocketAuthorizeRequestsCustomizer extends AuthorizeRequestsCusto
|
||||
@Override
|
||||
public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) {
|
||||
// websocket 允许匿名访问
|
||||
registry.antMatchers("/keep-alive/**").permitAll();
|
||||
registry.antMatchers("/orion/keep-alive/**").permitAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ import java.util.Optional;
|
||||
*/
|
||||
@Profile({"dev"})
|
||||
@ConditionalOnClass({OpenAPI.class})
|
||||
@EnableConfigurationProperties(SwaggerProperties.class)
|
||||
@EnableConfigurationProperties(SwaggerConfig.class)
|
||||
@ConditionalOnProperty(prefix = "springdoc.api-docs", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
@AutoConfiguration
|
||||
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_SWAGGER)
|
||||
@@ -53,7 +53,7 @@ public class OrionSwaggerAutoConfiguration {
|
||||
* @return OpenAPI
|
||||
*/
|
||||
@Bean
|
||||
public OpenAPI openApi(SwaggerProperties properties) {
|
||||
public OpenAPI openApi(SwaggerConfig properties) {
|
||||
Map<String, SecurityScheme> securitySchemas = this.buildSecuritySchemes();
|
||||
OpenAPI api = new OpenAPI()
|
||||
// 接口信息
|
||||
@@ -68,7 +68,7 @@ public class OrionSwaggerAutoConfiguration {
|
||||
/**
|
||||
* api 摘要信息
|
||||
*/
|
||||
private Info buildInfo(SwaggerProperties properties) {
|
||||
private Info buildInfo(SwaggerConfig properties) {
|
||||
return new Info()
|
||||
.title(properties.getTitle())
|
||||
.description(properties.getDescription())
|
||||
@@ -117,7 +117,7 @@ public class OrionSwaggerAutoConfiguration {
|
||||
*/
|
||||
@Bean
|
||||
public GroupedOpenApi allGroupedOpenApi(ConfigurableListableBeanFactory beanFactory,
|
||||
SwaggerProperties properties) {
|
||||
SwaggerConfig properties) {
|
||||
// 全部
|
||||
GroupedOpenApi all = this.buildGroupedOpenApi("全部", "*");
|
||||
// 注册模块分组 api
|
||||
|
||||
@@ -6,13 +6,15 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* swagger 配置
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/6/21 11:13
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties("orion.swagger")
|
||||
public class SwaggerProperties {
|
||||
public class SwaggerConfig {
|
||||
|
||||
/**
|
||||
* 标题
|
||||
@@ -2,8 +2,8 @@
|
||||
"groups": [
|
||||
{
|
||||
"name": "orion.swagger",
|
||||
"type": "com.orion.ops.framework.swagger.config.SwaggerProperties",
|
||||
"sourceType": "com.orion.ops.framework.swagger.config.SwaggerProperties"
|
||||
"type": "com.orion.ops.framework.swagger.config.SwaggerConfig",
|
||||
"sourceType": "com.orion.ops.framework.swagger.config.SwaggerConfig"
|
||||
}
|
||||
],
|
||||
"properties": [
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.orion.ops.framework.websocket.config;
|
||||
|
||||
import com.orion.ops.framework.common.constant.AutoConfigureOrderConst;
|
||||
import com.orion.ops.framework.websocket.core.WebsocketContainerConfig;
|
||||
import com.orion.ops.framework.websocket.interceptor.UserHandshakeInterceptor;
|
||||
import com.orion.ops.framework.websocket.core.interceptor.UserHandshakeInterceptor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
@@ -21,14 +20,14 @@ import org.springframework.web.socket.server.standard.ServletServerContainerFact
|
||||
@EnableWebSocket
|
||||
@AutoConfiguration
|
||||
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_WEBSOCKET)
|
||||
@EnableConfigurationProperties(WebsocketContainerConfig.class)
|
||||
@EnableConfigurationProperties(WebsocketConfig.class)
|
||||
public class OrionWebsocketAutoConfiguration {
|
||||
|
||||
/**
|
||||
* @return websocket 缓冲区大小配置
|
||||
*/
|
||||
@Bean
|
||||
public ServletServerContainerFactoryBean servletServerContainerFactoryBean(WebsocketContainerConfig config) {
|
||||
public ServletServerContainerFactoryBean servletServerContainerFactoryBean(WebsocketConfig config) {
|
||||
ServletServerContainerFactoryBean factory = new ServletServerContainerFactoryBean();
|
||||
factory.setMaxBinaryMessageBufferSize(config.getBinaryBufferSize());
|
||||
factory.setMaxTextMessageBufferSize(config.getBinaryBufferSize());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.orion.ops.framework.websocket.core;
|
||||
package com.orion.ops.framework.websocket.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@@ -12,7 +12,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties("spring.websocket")
|
||||
public class WebsocketContainerConfig {
|
||||
public class WebsocketConfig {
|
||||
|
||||
/**
|
||||
* 二进制消息缓冲区大小 byte
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.orion.ops.framework.websocket.constant;
|
||||
package com.orion.ops.framework.websocket.core.constant;
|
||||
|
||||
/**
|
||||
* websocket 属性
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.orion.ops.framework.websocket.constant;
|
||||
package com.orion.ops.framework.websocket.core.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.orion.ops.framework.websocket.constant;
|
||||
package com.orion.ops.framework.websocket.core.constant;
|
||||
|
||||
/**
|
||||
* ws服务端关闭reason
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.orion.ops.framework.websocket.constant;
|
||||
package com.orion.ops.framework.websocket.core.constant;
|
||||
|
||||
import com.orion.lang.utils.Exceptions;
|
||||
import com.orion.lang.utils.Strings;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.orion.ops.framework.websocket.interceptor;
|
||||
package com.orion.ops.framework.websocket.core.interceptor;
|
||||
|
||||
import com.orion.ops.framework.common.security.SecurityHolder;
|
||||
import com.orion.ops.framework.websocket.constant.WsAttr;
|
||||
import com.orion.ops.framework.websocket.core.constant.WsAttr;
|
||||
import org.springframework.http.server.ServerHttpRequest;
|
||||
import org.springframework.http.server.ServerHttpResponse;
|
||||
import org.springframework.web.socket.WebSocketHandler;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.orion.ops.framework.websocket.utils;
|
||||
package com.orion.ops.framework.websocket.core.utils;
|
||||
|
||||
import com.orion.lang.exception.AuthenticationException;
|
||||
import com.orion.lang.exception.ConnectionRuntimeException;
|
||||
@@ -6,7 +6,7 @@ import com.orion.lang.exception.DisabledException;
|
||||
import com.orion.lang.exception.TimeoutException;
|
||||
import com.orion.lang.utils.Exceptions;
|
||||
import com.orion.lang.utils.Urls;
|
||||
import com.orion.ops.framework.websocket.constant.WsCloseCode;
|
||||
import com.orion.ops.framework.websocket.core.constant.WsCloseCode;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.server.ServerHttpRequest;
|
||||
import org.springframework.web.socket.CloseStatus;
|
||||
Reference in New Issue
Block a user