Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5049

Spring java config - create list of beans also created in runtime

$
0
0

I have a list of gaming rooms which is created by Spring. Each rooms corresponds some rules (which is enum), and the code is:

@BeanList<Room> rooms() {    return Arrays.stream(Rules.values())        .map(rule -> new Room(rule))        .collect(Collectors.toList());}

But now I need the rooms to be @Beans too: I want Spring to process @EventListener annotation in them. However, I don't want to declare them manually in config as the Rules enum can be updated in the future. How can I solve this problem? Thanks.


Viewing all articles
Browse latest Browse all 5049

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>