EPAM Systems Interview Question

How Spring prepare context? How we can add some custom logic at the very beginning of loading beans?