ConsulProperties consulProperties = context.getBean(ConsulProperties.class);
if (!consulProperties.isEnabled())
return;
ApplicationProperties appProps = context.getBean(ApplicationProperties.class);
ServerProperties serverProperties = context.getBean(ServerProperties.class);
AgentClient agentClient = context.getBean(AgentClient.class);
Service service = new Service();
service.setName(appProps.getId());
Integer port = serverProperties.getPort();
if (port == null) {
port = 8080;
}
service.setPort(port);
service.setTags(consulProperties.getTags());