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

Using converters for high-level configuration

MicroProfile Config will read Java String objects from its ConfigSource. However, it provides facilities to convert these String objects into more specific types in your application.

For example, the myUrl field we described previously is a URL object. The corresponding property, my.url, is read as a String object and then converted into a URL object before it is injected.

If the application uses the Config object, the MicroProfile Config implementation will also convert the String object into the type passed as the second argument of the getValue and getOptionalValue methods. This conversion can be done using different converter types: built-in, automatic, and custom. We will talk about them ...

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