Spring boot configuration in a multi-Module maven project

I found the answer in another stack overflow question: How to add multiple application.properties files in spring-boot?

It turns out there can only be 1 application.properties file in the final jar that spring boot creates. To have multiple files you have to rename one of the files to something custom. I named the properties of the core module "core-application.properties".

Then in the API module I added this to the spring boot application class:

@SpringBootApplication
@PropertySource(value = {"core-application.properties", "application.properties"})

Doing this I can correctly use the base properties file and overwrite them in the more specific modules. Also you can still create profile-specific properties file (core-application-production.properties) with this setup, no need to add those to the propertysource manually). Note that @PropertySource does not work for yaml configuration files at this moment.