com.nepxion.discovery.console.configuration.ConsoleAutoConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of discovery-console Show documentation
Show all versions of discovery-console Show documentation
Nepxion Discovery is an enhancement for Spring Cloud Discovery
package com.nepxion.discovery.console.configuration;
/**
* Title: Nepxion Discovery
* Description: Nepxion Discovery
* Copyright: Copyright (c) 2017-2050
* Company: Nepxion
* @author Haojun Ren
* @version 1.0
*/
import org.springframework.boot.actuate.endpoint.Endpoint;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.client.RestTemplate;
import com.nepxion.discovery.common.constant.DiscoveryConstant;
import com.nepxion.discovery.common.handler.RestErrorHandler;
import com.nepxion.discovery.console.authentication.AuthenticationResource;
import com.nepxion.discovery.console.authentication.AuthenticationResourceImpl;
import com.nepxion.discovery.console.endpoint.ConsoleEndpoint;
@Configuration
@Import(SwaggerConfiguration.class)
public class ConsoleAutoConfiguration {
static {
String logoShown = System.getProperty("nepxion.logo.shown", "true");
if (Boolean.valueOf(logoShown)) {
System.out.println("");
System.out.println("╔═══╗");
System.out.println("╚╗╔╗║");
System.out.println(" ║║║╠╦══╦══╦══╦╗╔╦══╦═╦╗ ╔╗");
System.out.println(" ║║║╠╣══╣╔═╣╔╗║╚╝║║═╣╔╣║ ║║");
System.out.println("╔╝╚╝║╠══║╚═╣╚╝╠╗╔╣║═╣║║╚═╝║");
System.out.println("╚═══╩╩══╩══╩══╝╚╝╚══╩╝╚═╗╔╝");
System.out.println(" ╔═╝║");
System.out.println(" ╚══╝");
System.out.println("Nepxion Discovery - Console v" + DiscoveryConstant.DISCOVERY_VERSION);
System.out.println("");
}
}
@ConditionalOnClass(Endpoint.class)
protected static class ConsoleEndpointConfiguration {
@Bean
public ConsoleEndpoint consoleEndpoint() {
return new ConsoleEndpoint();
}
@Bean
public RestTemplate consoleRestTemplate() {
RestTemplate restTemplate = new RestTemplate();
restTemplate.setErrorHandler(new RestErrorHandler());
return restTemplate;
}
@Bean
@ConditionalOnMissingBean
public AuthenticationResource authenticationResource() {
return new AuthenticationResourceImpl();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy