Relative Content

Tag Archive for springkotlindependency-injection

How to use spring bean in static methods?

I have such configuration where I defined headerHolder bean. But now it is impossible to use it in static methods, because in this case I always have anonymousUserId field equals null. But at the same time, when using autowiring, it is filled with value. Why does it work so? How can I fix it?