|
|
@ -38,31 +38,30 @@ import static com.google.common.collect.Maps.newHashMap;
|
|
|
|
@Aspect
|
|
|
|
@Aspect
|
|
|
|
public class UserCachingOperationNameGenerator {
|
|
|
|
public class UserCachingOperationNameGenerator {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final Map<String, Integer> generated = Maps.newHashMap();
|
|
|
|
|
|
|
|
|
|
|
|
private final Map<String, Integer> generated = Maps.newHashMap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Pointcut("execution(* springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator.startingWith(String))")
|
|
|
|
@Pointcut("execution(* springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator.startingWith(String))")
|
|
|
|
public void c() {
|
|
|
|
public void c() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Around("c()")
|
|
|
|
@Around("c()")
|
|
|
|
public Object a(ProceedingJoinPoint point) {
|
|
|
|
public Object a(ProceedingJoinPoint point) {
|
|
|
|
Object[] args = point.getArgs();
|
|
|
|
Object[] args = point.getArgs();
|
|
|
|
return startingWith(String.valueOf(args[0]));
|
|
|
|
return startingWith(String.valueOf(args[0]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private String startingWith(String prefix) {
|
|
|
|
private String startingWith(String prefix) {
|
|
|
|
if (generated.containsKey(prefix)) {
|
|
|
|
if (generated.containsKey(prefix)) {
|
|
|
|
generated.put(prefix, generated.get(prefix) + 1);
|
|
|
|
generated.put(prefix, generated.get(prefix) + 1);
|
|
|
|
//log.warn("组件中存在相同的方法名称,自动生成组件方法唯一名称进行替换: {}", nextUniqueOperationName);
|
|
|
|
//log.warn("组件中存在相同的方法名称,自动生成组件方法唯一名称进行替换: {}", nextUniqueOperationName);
|
|
|
|
return String.format("%s_%s", prefix, generated.get(prefix));
|
|
|
|
return String.format("%s_%s", prefix, generated.get(prefix));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
generated.put(prefix, 0);
|
|
|
|
generated.put(prefix, 0);
|
|
|
|
return prefix;
|
|
|
|
return prefix;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|