Deep dive into PureConfig types in Scala

Reading Time: 2 minutes

Folks, I am back with some more exploration on PureConfig. This time we will talk about the types. For types, we have following two things to discuss:

  • New supported types
  • Override behaviour for types


In this blog, we will discuss only the first one i.e. New supported types

New supported types: PureConfig does not support all kind of types. For ex, classes that are not case classes are not supported out-of-the-box

In order to read an instance of a given type T from a config, PureConfig needs to have in scope in implicit instance of ConfigReader[T] for that type.

You can see above that Year is not a case class. Therefore, this won’t compile because there’s no ConfigReader instance for Year:

PureConfig can be extended to support those types. To do so, an instance for the ConfigReader type class must be provided.

First, define a ConfigReader instance in implicit scope:

Now when we load the config, it will be loaded successfully :

You can check the list of supported types here. For more details on custom supported types, visit here.

You can get the full code here.

We will discuss the second point i.e. Override behaviour for types in next blog. Stay tuned for the same.

I hope you will enjoy the reading and will have worth for you.

Happy Blogging !!!

Happy Coding !!!


Written by 

Rishi is a Lead Consultant, with experience of more than 7 years. Rishi is product focused developer who loves developing both front-end user interfaces and scalable back-end infrastructure. He is a good team player, quick learner and a humble person. He has good time management skills, aimed to give best results and fully dedicated towards his work & responsibilities. He is able to work as individual and as well as in team. He loves to share his knowledge, therefore he often writes technical blogs.

1 thought on “Deep dive into PureConfig types in Scala2 min read

Comments are closed.

%d bloggers like this: