O'Reilly logo

Scala Design Patterns - Second Edition by Ivan Nikolov

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

Writing some code

Now that we know what we will be doing and what libraries we will be relying on, it's time to write some code. It is logical to start with things that don't have other internal dependencies.

One of these things is the application configuration. It is something that doesn't depend on anything, but many things depend on it. We decided to use the .conf files because they are simple, hierarchical, and similar to JSON. An example configuration file looks like the following code:


job-scheduler {  config-path="/etc/scheduler/conf.d"  config-extension="json"  workers=4  db {    connection-string="jdbc:h2:mem:test;DB_CLOSE_DELAY=-1"    username=""    password=""  }}

The options are clear and anyone can easily provide a new config that suits their ...

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