Using lombok
Although DiVine removes a huge chunk of boilerplate code that would be used for your initialization processes. Your getters, setters and constructors could still take up a lot of space. It is generally recommended to use Lombok to get rid of those code overheads from the source code.
The code above will generate a constructor for UserController
, which will take in repository
and apiToken
as parameters. This will be fully compatible with DiVine.
Your code might need multiple constructors, where DiVine should use a generated one. You can still put @ConstructWith
on these generated constructors.
You may explicitly specify null assertations for your injected fields. DiVine will guarantee to always create an instance for your services.
Last updated