A good practice is defining a service as an interface and its implementation on a class.
Assuming I have 2 classes which implement the same interface, and I'd like to differentiate them according a property (not to a profile). I mean, if I have @Autowire private MyServiceInterface myService;
I'd like to receive an instance of PotatoServiceImpl
if I have myproperty=potato
or an instance of TomatoServiceImpl
if I have myproperty=tomato
.
I'm not using profiles.
P.S. When I say a property,I mean a property in application.properties