I am trying to build a shared platform library (streaming-client.jar), which will be used in Spring Boot applications.
That library (streaming-client.jar) internally uses a dependency (nats-spring), which provides auto configuration,
so whenever it finds some properties in application.properties like serverUrl, maxConnection it will automatically connects to server and does all the configuration server so we can just simply use @Autowired to get those connection objects.
This is working as expected in as standalone jar file.
Now, my usecase is that I want to add this lib (straming-client.jar) in some spring boot microserivice, and I want, this jar file to read props from client microservice application.properties and create objects, which should be available by using @Autowired
I want to do in two ways
If
streaming-client.jarfinds certains props in clientapplication.propertiesit should auto configure and create required objects.Client service should provide some sort of properties object
StreamingProperties.javaa simple POJO with all required properties in it. and inject that to thestreaming-client.jarcontext. and it should automatically create objects.
I am stuck on how to approach this.
Your guidance is very much appreciated.