mirror of
https://gitee.com/wangkang/udf.git
synced 2026-10-30 07:45:11 +00:00
rms配置修改
This commit is contained in:
@@ -6,11 +6,14 @@
|
||||
*/
|
||||
package com.egridcloud.udf.rms;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
|
||||
/**
|
||||
* 描述 : Config
|
||||
@@ -18,10 +21,15 @@ import org.springframework.web.client.RestTemplate;
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "com.egridcloud.rms.config")
|
||||
public class RmsConfig {
|
||||
|
||||
/**
|
||||
* 描述 : rms扫描路径
|
||||
*/
|
||||
private String rmsPathPatterns;
|
||||
|
||||
/**
|
||||
* 描述 : restTemplate
|
||||
*
|
||||
@@ -33,4 +41,49 @@ public class RmsConfig {
|
||||
return new RestTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述 : rmsAuthConfigurer
|
||||
*
|
||||
* @return WebMvcConfigurer
|
||||
*/
|
||||
@Bean
|
||||
public WebMvcConfigurer rmsAuthConfigurer() { //NOSONAR
|
||||
return new WebMvcConfigurerAdapter() {
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
String[] rmsPathPatternsArray = rmsPathPatterns.split(",");
|
||||
registry.addInterceptor(rmsAuthHandlerInterceptor()).addPathPatterns(rmsPathPatternsArray);
|
||||
super.addInterceptors(registry);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述 : RmsAuthHandlerInterceptor
|
||||
*
|
||||
* @return rmsAuthHandlerInterceptor
|
||||
*/
|
||||
@Bean
|
||||
public RmsAuthHandlerInterceptor rmsAuthHandlerInterceptor() {
|
||||
return new RmsAuthHandlerInterceptor();
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述 : 获取rmsPathPatterns
|
||||
*
|
||||
* @return the rmsPathPatterns
|
||||
*/
|
||||
public String getRmsPathPatterns() {
|
||||
return rmsPathPatterns;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述 : 设置rmsPathPatterns
|
||||
*
|
||||
* @param rmsPathPatterns the rmsPathPatterns to set
|
||||
*/
|
||||
public void setRmsPathPatterns(String rmsPathPatterns) {
|
||||
this.rmsPathPatterns = rmsPathPatterns;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.egridcloud.udf.rms.mate.PathMate;
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "com.egridcloud.rms.config")
|
||||
@ConfigurationProperties(prefix = "com.egridcloud.rms.properties")
|
||||
public class RmsProperties {
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user