I want to have a map of @Component
instances of the same class. I init the instance like:
applicationContext.getBean(TorrentService.class)
TorrentService looks like this:
@Component
public class TorrentService {
@Autowired
private SimpMessagingTemplate template;
@Autowired
private TorrentRepository repository;
private BtClient client;
@Value("${refreshInterval}")
private int interval;
...
All @Autowired
properties are initialized, except property interval
.
When I initialize instance of TorrentService
using @Autowired
the property interval
is set correctly. It's supposed to be set to 1000
instead it's set to 0
.
application.properties:
refreshInterval=1000
Is it because applicationContext.getBean
is outside IoC?
What can be done?