I am new to Spring and very confused about Spring container management. Which classes need to be managed by the container and which classes do not?
Spring DI provides you with a flexible system for managing class dependencies, if previously you had to create and configure instances of classes yourself, now Spring can do this for you simply by defining a class as @component or defining @Bean in a @configuration class. this speeds up development quite well, since you can simply take the desired class from the container + this approach allows you to divide the application into separate components, the implementations of which can be quickly replaced or adjusted (which is quite convenient for testing). So which classes should be managed by the container? The answer is any that you don't want to manually configure, or that you need to access throughout the application.