简体   繁体   中英

Spring Boot multi module project and bean creation order

I have a main module named core and other modules that defines Spring beans of type Job .

I'd like to have a List<Job> in my main module.

The problem is that the creation of the @Service class that contains the @Autowired List<Jobs> is happening prior to the creation of the Jobs in the other modules (which are a maven dependency in core ).

How can I direct Spring to gather all Jobs into a list in the main module?

I tried to use @Order but it doesn't seem to make any affect.

Try creating Job bean under configuration file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM