O'Reilly logo

Hands-On Enterprise Java Microservices with Eclipse MicroProfile by Scott Stark, Antoine Sabot-Durand, Pavol Loffay, Jeff Mesnil, Heiko W. Rupp, Cesar Saavedra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Simplifying configuration keys

Since the default MP Config property names for a CDI interface can be quite long due to the inclusion of the interface package name, the MP-RC specification supports a way to simplify the property name prefix using the configKey attribute of the @RegisterRestClient annotation:

@Path("/api/json")@RegisterRestClient(baseUri = WorldClockApi.BASE_URL, configKey = "worldClock")public interface WorldClockApi { static final String BASE_URL = "http://worldclockapi.com/api/json";...}

With the worldClock configKey, the previous list of property names simplifies to the following:

  • worldClock/mp-rest/url
  • worldClock/mp-rest/uri
  • worldClock/mp-rest/scope
  • worldClock/mp-rest/providers
  • worldClock/mp-rest/providers/com.mycompany.MyProvider/priority ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required