Hi! Sorry for the late response, somehow your "@" mention didn't work and I didn't get notified about your answer.
The XML/Text files you refer to would replace the classpath scan. Instead of scanning all classes, you'll read a predefined list of service class names from a file, typically XML. Let's simplify it a bit and use plain text, for example:
This would tell you that the interface "MyServiceA" is implemented by a class "MyServiceAImpl". To find the classes, you'd simply have to use Class.forName(className). Use those interface/class pairs instead of the classpath scan.
@martin Hausler, thanks for this post. Please how can I make this program accept configuration files (XML or text files)? Thanks for your time.
Hi! Sorry for the late response, somehow your "@" mention didn't work and I didn't get notified about your answer.
The XML/Text files you refer to would replace the classpath scan. Instead of scanning all classes, you'll read a predefined list of service class names from a file, typically XML. Let's simplify it a bit and use plain text, for example:
(left is interface, right is implementation)
This would tell you that the interface "MyServiceA" is implemented by a class "MyServiceAImpl". To find the classes, you'd simply have to use
Class.forName(className)
. Use those interface/class pairs instead of the classpath scan.Thanks a lot, I'm very grateful.