Govt. Exams
Entrance Exams
The <bean> element is the standard XML element used in applicationContext.xml to define Spring beans.
@Autowired performs type-based dependency injection. Spring looks for a bean of the required type and injects it automatically.
Valid scopes are singleton, prototype, request, session, application, and websocket. 'eternal' is not a valid scope.
DI reduces coupling by injecting dependencies rather than creating them internally, making code more testable and maintainable.
@Component is a generic stereotype annotation for any Spring-managed component. @Bean is used on methods, while @Service and @Controller are specialized versions of @Component.