October 2017
Intermediate to advanced
442 pages
12h 33m
English
Resolving services by logical names already eliminates a lot of configuration in the application. Since the same container image is being used in all environments, potentially different configuration needs to be inserted from the orchestration environment. As shown in the previous example, Kubernetes config maps tackle this situation. The hello-cloud application expects that at runtime a properties file will reside under /opt/config/application.properties. The project code will therefore access this location. The following demonstrates the integration of the properties file using a CDI producer:
public class HelloGreeter {
@Inject
@Config("hello.greeting")
String greeting;
@Inject
@Config("hello.name") ...Read now
Unlock full access