In the Spring framework reference I found this:
The ApplicationContext interface has a few other methods for retrieving beans, but ideally your application code should never use them. Indeed, your application code should have no calls to the getBean method at all, and thus no dependency on Spring APIs at all.
but I have no idea to realize this.
After a lot of search I found this
avoid to use getBean in your application code, try to write a single class with one or more getBean() calls, this bootstrap class must be executed at the startup of your webapplication
is this a more recommended way?