I'm implementing an API for creating digital signatures using Java spring boot. The problem that I have is that I would like to add implementations of newer versions of the API in the future, so I would like to create a factory that allows to change the implementation depending of the API version specified in a configuration file.
I have a .yaml with the metadata of the API. One of the fields that we can find is the version of the API. What I would like to do is to read this field and, by using a factory, associate the implementation of the respective version to the application. The problem that I find is that in java spring boot you don't associate any controller to the application, instead of that Java spring boot automatically detects them and so any endpoint handler that you have in any controller is detected. So i don't know how to achieve associating concrete controllers and services to the app depending on the version of the API. Probably I am wrong in the way of thinking how it should be done.