I am currently finding the process of adding Spring and Hibernate to an existing application, but after reading a lot of tutorials there are a couple more (or many things) that seem strange to me or I'm missing something ...
All the training materials that I found are direct (like most tutorials), as shown in Example A , one controller for query processing (JSP or WS) and an autowire manager class for interacting with the database.
In my case, this does not apply, because the application has a class for processing requests, and then creates an instance of the handler class, which, in turn, creates a new class to handle something else, creating a new class for processing (....) * , and then processes the database connection, as shown in Example B.

My question is how can I make my business logic class n "Springable", i.e. able to make an internal database manager inside it?
Of all the examples I saw, I came up with these alternatives:
- Create autwire for ALL DbManager inside the Controller, and then IoC for all business classes until it reaches the Business Logic n class. This will follow Spring standards, but will involve most code refactoring
- Convert ALL business logic classes to beans
- Add SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext (this); to business logic class n and use @Autowire to access DbManager
Am I missing something or is there another alternative?
java spring spring-mvc hibernate
Gonรงalo cardoso
source share