Try to define messageFilePath
and cacheInSeconds
with their @Value
as parameters of the bean creation method, so that they are not late initalized. Not sure it helps, but at least it would make the dependencies clear to Spring.
Of course it is a bad pattern to put dependencies in a static field...