I am using application.yml and setting eureka.environment=prod property, but it shows up blank on the eureka console. However, it works when I use archaius.deployment.environment=prod Executing as jar on port 80.
application.yml
spring:
application:
name: eureka
server:
port: 80
#archaius:
# deployment:
# datacenter: Main
# environment: prod
eureka:
datacenter: Main
environment: prod
instance:
hostname: localhost
client:
serviceUrl:
defaultZone: http://localhsot:80/
registerWithEureka: false
fetchRegistry: false
EurekaServerMain.java
@SpringBootApplication
@EnableEurekaServer
@EnableDiscoveryClient
public class EurekaServerMain extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(EurekaServerMain.class, args);
}
}
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>ws_eureka</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>eureka</name>
<description>Eureka Service Directory</description>
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>Brixton.M4</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
I think you mean archaius.deployment.environment=prod works? What does it do? What is the expected outcome of setting eureka.environment (in Spring Cloud we never did anything with that)?
@dsyer it's supposed to populate the field Environment on the main eureka landing page (top left section), just like eureka.datacenter populates Datacenter field (which works). The default behaviour without any of these props set is it shows the value test But when I set it as above as eureka.environmenr it replaces that with empty string. If it's not used anywhere by Spring Cloud, then why does it clear out the default value? The EurekaServerBootstrap supposed to do it from what I can tell, no?
I see. Looks like it was just never quite finished. I'm not sure why we need it, but we might as well have it working if the code is going to be there.