Java Spring Boot - Spring Context and Beans - Access Spring Beans from Spring and non Spring classes

preview_player
Показать описание
In this video we will explore how to retrieve Spring Beans from the Spring Context. We will exercise two approaches. First one, where we will retrieve Bean in the regular way using Spring Context and get Bean method. We will also check out how to get a reference to the Spring Application Context. Second will be a little more challenging. We will implement special util class which will be aware of the context and will expose static methods. Thanks to the static methods we will be able to access Spring Context and retrieve Spring beans in non Spring classes and POJOs. Keep playing with code!

Follow //CodefForgeYT on:
Рекомендации по теме
Комментарии
Автор

Can I call getBean inside a static method? I am trying to call but getting context as null.

PintuKumar-xsny