提交 2da376e7 编写于 作者: 如梦技术's avatar 如梦技术 🐛

完善 mica-lite

上级 790d4447
/*
* Copyright (c) 2019-2029, Dreamlu 卢春梦 (596392912@qq.com & www.dreamlu.net).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.dreamlu.mica.lite.config;
import net.dreamlu.mica.core.spring.SpringContextUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* mica lite 配置
*
* @author L.cm
*/
@Configuration(proxyBeanMethods = false)
public class MicaLiteConfiguration {
@Bean
public SpringContextUtil springContextUtil() {
return new SpringContextUtil();
}
}
......@@ -17,6 +17,7 @@
package net.dreamlu.mica.lite.upload;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.config.ResourceHandlerRegistry;
......@@ -29,6 +30,12 @@ import org.springframework.web.reactive.config.WebFluxConfigurer;
*/
@RequiredArgsConstructor
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(
prefix = MicaUploadProperties.PREFIX,
name = "enabled",
havingValue = "true",
matchIfMissing = true
)
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
public class MicaReactiveUploadConfiguration implements WebFluxConfigurer {
private final MicaUploadProperties properties;
......
......@@ -17,6 +17,7 @@
package net.dreamlu.mica.lite.upload;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
......@@ -29,6 +30,12 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
*/
@RequiredArgsConstructor
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(
prefix = MicaUploadProperties.PREFIX,
name = "enabled",
havingValue = "true",
matchIfMissing = true
)
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
public class MicaServletUploadConfiguration implements WebMvcConfigurer {
private final MicaUploadProperties properties;
......
......@@ -31,8 +31,14 @@ import org.springframework.lang.Nullable;
@Getter
@Setter
@RefreshScope
@ConfigurationProperties("mica.upload")
@ConfigurationProperties(MicaUploadProperties.PREFIX)
public class MicaUploadProperties {
public static final String PREFIX = "mica.upload";
/**
* 是否启用本地的文件上传,默认:开启
*/
private boolean enable = true;
/**
* 上传的文件 路径匹配
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册