how to set value to @Order annotation in spring boot from a propertyfile

Viewed 1312

I need to autowire the following beans to a List, and I need my List to be ordered. This is how I'm doing it:

@Service
@Order(1)
public class Slave1 implements Slave {}

@Service
@Order(2) //instead of hardcoding I need the value to be picked up externally
public class Slave2 implements Slave {}

@Autowire
List<Slave> slaves;

But I want the order value to be fetched from the application.properties file. Is this possible? Can I set a value for the @Order annotation from a property file?

1 Answers
Related