in shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/main/java/org/apache/shenyu/client/springmvc/register/SpringMvcApiMetaRegister.java [111:156]
protected List<MetaDataRegisterDTO> parse(final ApiBean.ApiDefinition apiDefinition) {
ShenyuSpringMvcClient methodAnnotation = apiDefinition.getAnnotation(ShenyuSpringMvcClient.class);
String methodPath = Objects.isNull(methodAnnotation) ? StringUtils.EMPTY : methodAnnotation.path()[0];
if (StringUtils.isEmpty(methodPath)) {
methodPath = apiDefinition.getMethodPath();
}
ShenyuSpringMvcClient classAnnotation = apiDefinition.getApiBean()
.getAnnotation(ShenyuSpringMvcClient.class);
String beanPath = Objects.isNull(classAnnotation) || StringUtils.isBlank(classAnnotation.path()[0])
? apiDefinition.getBeanPath() : classAnnotation.path()[0];
String apiPath = PathUtils.pathJoin(clientRegisterConfig.getContextPath(), beanPath, methodPath);
String pathDesc = Objects.isNull(methodAnnotation) ? classAnnotation.desc() : methodAnnotation.desc();
boolean enabled = (Objects.isNull(classAnnotation) || classAnnotation.enabled())
&& (Objects.isNull(methodAnnotation) || methodAnnotation.enabled());
String ruleName = Objects.isNull(methodAnnotation) || StringUtils.isEmpty(methodAnnotation.ruleName())
? apiPath : methodAnnotation.ruleName();
boolean registerMetaData = (Objects.isNull(classAnnotation) || classAnnotation.registerMetaData())
&& (Objects.isNull(methodAnnotation) || methodAnnotation.registerMetaData());
return Lists.newArrayList(MetaDataRegisterDTO.builder()
.contextPath(clientRegisterConfig.getContextPath())
.addPrefixed(addPrefixed)
.appName(appName)
.host(host)
.port(port)
.serviceName(apiDefinition.getBeanClass().getName())
.methodName(apiDefinition.getApiMethodName())
.path(apiPath)
.pathDesc(pathDesc)
.parameterTypes(apiDefinition.getParameterTypes())
.rpcType(RpcTypeEnum.HTTP.getName())
.enabled(enabled)
.ruleName(ruleName)
.registerMetaData(registerMetaData)
.build());
}