This is a business logic class that uses attributes from the application.yml file (as shown in figure queueNum)
This is the configuration in the application.yml file
I expect this springboot application to output “maxCost = 5” at runtime, but in fact it outputs “maxCost = 0”. I think this may be due to the different instantiation and injection order of bean, but I have not found the relevant code. Does anyone know the reason? How can I solve this problem?
@AutowiredBelonging to setter injection, Spring creates objects (executes construction methods) before executing setter injection when equipping Bean.