-
Choerodon平台版本:0.6.0
-
运行环境(如localhost或k8s):localhost
-
遇到问题时的前置条件:
按照猪齿鱼后端开发手册尝试创建todo-service并发布至swagger
-
问题描述:
todo-service 正常运行,eureka 可以发现该服务,但swagger-ui中查不到任何与todo-service有关的api
所有的相关的服务均在本地已启动:
docker-compose ps
Name Command State Ports
---------------------------------------------------------------------------------------------------------------------------------------------
c7n-backend_api-gateway_1 /bin/sh -c exec java $JAVA ... Up 0.0.0.0:8080->8080/tcp
c7n-backend_eureka-server_1 /bin/sh -c exec java $JAVA ... Up 0.0.0.0:8000->8000/tcp
c7n-backend_gateway-helper_1 /bin/sh -c exec java $JAVA ... Up 0.0.0.0:9180->9180/tcp
c7n-backend_iam-service_1 /bin/sh -c exec java $JAVA ... Up 0.0.0.0:8030->8030/tcp
c7n-backend_kafka-0_1 sh -c /opt/kafka/bin/kafka ... Up 0.0.0.0:9092->9092/tcp
c7n-backend_manager-service_1 /bin/sh -c exec java $JAVA ... Up 0.0.0.0:8963->8963/tcp
c7n-backend_mysql_1 docker-entrypoint.sh mysqld Up 0.0.0.0:3306->3306/tcp
c7n-backend_oauth-server_1 /bin/sh -c exec java $JAVA ... Up 0.0.0.0:8020->8020/tcp
c7n-backend_redis_1 docker-entrypoint.sh redis ... Up 0.0.0.0:6379->6379/tcp
c7n-backend_zookeeper-0_1 /opt/zookeeper/entrypoint. ... Up 0.0.0.0:2181->2181/tcp, 0.0.0.0:2888->2888/tcp,
0.0.0.0:3888->3888/tcp
swagger-ui:
todo-service 启动入口:
package io.choerodon.todo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import io.choerodon.resource.annoation.EnableChoerodonResourceServer;
@SpringBootApplication
// 是否允许注册到注册中心,暂时注释掉
@EnableEurekaClient
// 是否开启猪齿鱼资源服务器
@EnableChoerodonResourceServer
public class TodoServiceApplication {
public static void main(String[] args) {
SpringApplication.run(TodoServiceApplication.class, args);
}
}
CustomExtraDataManager
package io.choerodon.todo.infra.config;
import io.choerodon.core.swagger.ChoerodonRouteData;
import io.choerodon.swagger.annotation.ChoerodonExtraData;
import io.choerodon.swagger.custom.extra.ExtraData;
import io.choerodon.swagger.custom.extra.ExtraDataManager;
@ChoerodonExtraData
public class CustomExtraDataManager implements ExtraDataManager {
@Override
public ExtraData getData() {
ChoerodonRouteData choerodonRouteData = new ChoerodonRouteData();
choerodonRouteData.setName("todo");
choerodonRouteData.setPath("/todo/**");
choerodonRouteData.setServiceId("choerodon-todo-service");
extraData.put(ExtraData.ZUUL_ROUTE_DATA, choerodonRouteData);
return extraData;
}
}
另外,请问一下 CustomExtraDataManager 的具体用法和作用是什么?不是很懂,谢谢!