xiaoyong931011
2020-06-08 c326372b71da84c449b6097af5e281cd6fb46e2c
src/main/java/com/xcong/excoin/configurations/WebMvcConfig.java
@@ -1,5 +1,8 @@
package com.xcong.excoin.configurations;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.xcong.excoin.configurations.properties.AliOssProperties;
import com.xcong.excoin.configurations.security.UserAuthenticationArgumentResolver;
import com.xcong.excoin.utils.SpringContextHolder;
import lombok.extern.slf4j.Slf4j;
@@ -10,6 +13,7 @@
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import javax.annotation.Resource;
import java.util.List;
/**
@@ -19,6 +23,10 @@
@SpringBootConfiguration
@Slf4j
public class WebMvcConfig implements WebMvcConfigurer {
    @Resource
    private AliOssProperties aliOssProperties;
    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
@@ -38,6 +46,11 @@
                .allowCredentials(true).maxAge(3600);
    }
    @Bean
    public OSS ossClient() {
        return new OSSClientBuilder().build(aliOssProperties.getEndPoint(), aliOssProperties.getAccessKeyId(), aliOssProperties.getAccessKeySecret());
    }
//    @Bean
//    public SpringContextHolder springContextHolder() {
//        return new SpringContextHolder();