update 升级 springboot 2.7.2 重构使用最新自动配置方式

This commit is contained in:
疯狂的狮子li
2022-07-22 12:27:12 +08:00
parent 52826f9081
commit 03e1d25afb
51 changed files with 66 additions and 87 deletions

View File

@@ -1,10 +1,9 @@
package com.ruoyi.common.web.config;
import com.ruoyi.common.web.core.I18nLocaleResolver;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.LocaleResolver;
/**
@@ -12,8 +11,7 @@ import org.springframework.web.servlet.LocaleResolver;
*
* @author Lion Li
*/
@Configuration(proxyBeanMethods = false)
@AutoConfigureBefore(WebMvcAutoConfiguration.class)
@AutoConfiguration(before = WebMvcAutoConfiguration.class)
public class I18nConfig {
@Bean

View File

@@ -7,25 +7,24 @@ import com.alibaba.cloud.nacos.discovery.NacosDiscoveryAutoConfiguration;
import com.alibaba.cloud.nacos.discovery.NacosDiscoveryClientConfiguration;
import com.alibaba.cloud.nacos.discovery.NacosWatch;
import com.ruoyi.common.web.nacos.CustomNacosWatch;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.client.ConditionalOnBlockingDiscoveryEnabled;
import org.springframework.cloud.client.ConditionalOnDiscoveryEnabled;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 自定义 nacos 监听 解决与 Undertow 整合报错问题
*
* @author Lion Li
*/
@Configuration(proxyBeanMethods = false)
@AutoConfiguration(
before = NacosDiscoveryClientConfiguration.class,
after = NacosDiscoveryAutoConfiguration.class
)
@ConditionalOnDiscoveryEnabled
@ConditionalOnBlockingDiscoveryEnabled
@ConditionalOnNacosDiscoveryEnabled
@AutoConfigureBefore(NacosDiscoveryClientConfiguration.class)
@AutoConfigureAfter(NacosDiscoveryAutoConfiguration.class)
public class NacosConfig {
@Bean

View File

@@ -2,16 +2,16 @@ package com.ruoyi.common.web.config;
import io.undertow.server.DefaultByteBufferPool;
import io.undertow.websockets.jsr.WebSocketDeploymentInfo;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.context.annotation.Configuration;
/**
* Undertow 自定义配置
*
* @author Lion Li
*/
@Configuration(proxyBeanMethods = false)
@AutoConfiguration
public class UndertowConfig implements WebServerFactoryCustomizer<UndertowServletWebServerFactory> {
/**

View File

@@ -1,4 +0,0 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.ruoyi.common.web.config.I18nConfig,\
com.ruoyi.common.web.config.UndertowConfig,\
com.ruoyi.common.web.config.NacosConfig

View File

@@ -0,0 +1,3 @@
com.ruoyi.common.web.config.I18nConfig
com.ruoyi.common.web.config.UndertowConfig
com.ruoyi.common.web.config.NacosConfig