增加sonar测试并修复sonar测试的问题

This commit is contained in:
zlt
2019-02-04 14:18:47 +08:00
parent e16d8f5d02
commit 110bdc5a84
58 changed files with 181 additions and 233 deletions
@@ -41,6 +41,7 @@ import java.util.stream.Collectors;
Swagger2Configuration.class
})
public class SwaggerAutoConfiguration implements BeanFactoryAware {
private static final String AUTH_KEY = "Authorization";
private BeanFactory beanFactory;
@@ -179,7 +180,7 @@ public class SwaggerAutoConfiguration implements BeanFactoryAware {
}
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
@@ -198,13 +199,13 @@ public class SwaggerAutoConfiguration implements BeanFactoryAware {
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
List<SecurityReference> references = new ArrayList<>(1);
references.add(new SecurityReference("Authorization", authorizationScopes));
references.add(new SecurityReference(AUTH_KEY, authorizationScopes));
return references;
}
private List<ApiKey> securitySchemes() {
List<ApiKey> apiKeys = new ArrayList<>(1);
ApiKey apiKey = new ApiKey("Authorization", "Authorization", "header");
ApiKey apiKey = new ApiKey(AUTH_KEY, AUTH_KEY, "header");
apiKeys.add(apiKey);
return apiKeys;
}
@@ -1,6 +1,8 @@
package com.central.common.swagger2;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.ArrayList;
@@ -51,7 +53,8 @@ public class SwaggerProperties {
/**全局参数配置**/
private List<GlobalOperationParameter> globalOperationParameters;
@Setter
@Getter
public static class GlobalOperationParameter{
/**参数名**/
private String name;
@@ -67,46 +70,6 @@ public class SwaggerProperties {
/**参数是否必须传**/
private String required;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getModelRef() {
return modelRef;
}
public void setModelRef(String modelRef) {
this.modelRef = modelRef;
}
public String getParameterType() {
return parameterType;
}
public void setParameterType(String parameterType) {
this.parameterType = parameterType;
}
public String getRequired() {
return required;
}
public void setRequired(String required) {
this.required = required;
}
}
@Data
@@ -139,7 +102,6 @@ public class SwaggerProperties {
@Data
public static class Contact {
/**联系人**/
private String name = "";
/**联系人url**/