Java Code Examples for org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean#setIpAddress()
The following examples show how to use
org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean#setIpAddress() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EurekaStubsRegistrar.java From spring-cloud-contract with Apache License 2.0 | 6 votes |
private EurekaInstanceConfigBean registration( Map.Entry<StubConfiguration, Integer> entry) { EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(this.inetUtils); String appName = name(entry.getKey()); config.setInstanceEnabledOnit(true); InetAddress address = this.inetUtils.findFirstNonLoopbackAddress(); config.setIpAddress(address.getHostAddress()); config.setHostname(StringUtils.hasText(hostName(entry)) ? hostName(entry) : address.getHostName()); config.setAppname(appName); config.setVirtualHostName(appName); config.setSecureVirtualHostName(appName); int port = port(entry); config.setNonSecurePort(port); config.setInstanceId(address.getHostAddress() + ":" + entry.getKey().getArtifactId() + ":" + port); config.setLeaseRenewalIntervalInSeconds(1); return config; }
Example 2
Source File: WebClientEurekaHttpClientTest.java From spring-cloud-netflix with Apache License 2.0 | 6 votes |
@Before public void setup() { eurekaHttpClient = new WebClientTransportClientFactory() .newClient(new DefaultEndpoint(serviceUrl)); EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(inetUtils); String appname = "customapp"; config.setIpAddress("127.0.0.1"); config.setHostname("localhost"); config.setAppname(appname); config.setVirtualHostName(appname); config.setSecureVirtualHostName(appname); config.setNonSecurePort(4444); config.setSecurePort(8443); config.setInstanceId("127.0.0.1:customapp:4444"); info = new EurekaConfigBasedInstanceInfoProvider(config).get(); }
Example 3
Source File: RestTemplateEurekaHttpClientTest.java From spring-cloud-netflix with Apache License 2.0 | 6 votes |
@Before public void setup() { eurekaHttpClient = new RestTemplateTransportClientFactory() .newClient(new DefaultEndpoint(serviceUrl)); EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(inetUtils); String appname = "customapp"; config.setIpAddress("127.0.0.1"); config.setHostname("localhost"); config.setAppname(appname); config.setVirtualHostName(appname); config.setSecureVirtualHostName(appname); config.setNonSecurePort(4444); config.setSecurePort(8443); config.setInstanceId("127.0.0.1:customapp:4444"); info = new EurekaConfigBasedInstanceInfoProvider(config).get(); }
Example 4
Source File: EurekaSampleApplication.java From spring-cloud-netflix with Apache License 2.0 | 6 votes |
@RequestMapping(path = "/register", method = POST) public String register() { EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(inetUtils); String appname = "customapp"; config.setIpAddress("127.0.0.1"); config.setHostname("localhost"); config.setAppname(appname); config.setVirtualHostName(appname); config.setSecureVirtualHostName(appname); config.setNonSecurePort(4444); config.setInstanceId("127.0.0.1:customapp:4444"); this.registration = EurekaRegistration.builder(config) .with(this.clientConfig, this.context).build(); this.serviceRegistry.register(this.registration); return config.getInstanceId(); }