20 November 2023

#Spring_Framework

#Spring_Framework

Key Concepts




Topic Sub-Topics (comma separated) Basic Intermediate Advanced Expert
Core Container Beans, BeanFactory, ApplicationContext, Bean Scopes, Bean Lifecycle, Dependency Injection (DI), Inversion of Control (IoC)
Configuration XML Configuration, Java-based Configuration, Annotation-based Configuration, Environment Profiles, Externalized Configuration
Spring Context ApplicationContext, MessageSource, Internationalization (i18n), Event Handling, ApplicationListener
Spring AOP AOP Concepts, Join Points, Pointcuts, Advice, Aspects, Proxying, AspectJ Integration
Data Access (DAO) JDBC Template, DataSource, Transaction Management, Exception Translation, ORM Integration
Spring ORM Hibernate Integration, JPA Support, EntityManager, SessionFactory, Transactional Annotations
Spring Transactions Programmatic Transactions, Declarative Transactions, Propagation, Isolation Levels, Rollback Rules
Spring MVC DispatcherServlet, Controllers, HandlerMapping, ViewResolver, ModelAndView, Form Handling, Validation
Spring REST REST Controllers, @RestController, @RequestBody, @ResponseBody, Content Negotiation, Exception Handling
Spring WebFlux Reactive Programming, Mono, Flux, Functional Endpoints, Reactive Repositories
Spring Security Authentication, Authorization, Security Filters, UserDetailsService, Password Encoding, JWT, OAuth2
Spring Boot Auto-Configuration, Starters, Actuator, Spring Boot CLI, Spring Initializr, Properties & YAML
Spring Data Spring Data JPA, Spring Data MongoDB, PagingAndSortingRepository, CrudRepository, Custom Queries
Spring Cloud Config Server, Eureka, Zuul/Gateway, Ribbon, Feign, Hystrix, Sleuth, Cloud Bus
Spring Batch Job, Step, Tasklet, ItemReader, ItemWriter, JobLauncher, Retry & Skip Logic
Spring Integration Messaging, Channels, Transformers, Routers, Adapters, Gateways, Enterprise Integration Patterns
Spring Testing Unit Testing with JUnit, MockMvc, @SpringBootTest, Test Slices, Embedded Database Testing
Spring Messaging JMS, AMQP, STOMP, WebSockets, MessageConverters, RabbitMQ/Kafka Integration
Spring Reactive Reactive Streams, Reactive Data Access, Backpressure, Reactor Core, WebFlux Security
Spring GraphQL Spring for GraphQL, DataFetchers, Schema Mapping, Subscriptions, GraphQL + WebFlux
Topic Annotation Description
Application Setup @SpringBootApplication Marks the main class of a Spring Boot application; combines @Configuration, @EnableAutoConfiguration, and @ComponentScan.
@EnableAutoConfiguration Enables Spring Boot?s auto-configuration mechanism.
@Configuration Indicates that a class declares one or more @Bean methods.
@ComponentScan Configures component scanning directives for Spring.
Dependency Injection @Autowired Automatically injects dependent beans.
@Inject JSR-330 annotation for dependency injection.
@Qualifier Specifies which bean to inject when multiple candidates exist.
@Value Injects values from properties or environment variables.
Component Stereotypes @Component Generic stereotype for any Spring-managed component.
@Service Marks a service layer component.
@Repository Marks a DAO component and enables exception translation.
@Controller Marks a web controller in Spring MVC.
@RestController Specialized controller returning JSON/XML responses.
Web / REST @RequestMapping Maps HTTP requests to handler methods.
@GetMapping Shortcut for @RequestMapping(method = RequestMethod.GET).
@PostMapping Shortcut for @RequestMapping(method = RequestMethod.POST).
@PutMapping Shortcut for @RequestMapping(method = RequestMethod.PUT).
@DeleteMapping Shortcut for @RequestMapping(method = RequestMethod.DELETE).
@PathVariable Binds a method parameter to a URI template variable.
@RequestParam Binds a method parameter to a query parameter.
@RequestBody Binds the HTTP request body to a method parameter.
@ResponseBody Indicates a method return value should be serialized to the response body.
Configuration / Properties @PropertySource Specifies the location of properties files.
@ConfigurationProperties Binds external properties to a POJO.
@EnableConfigurationProperties Enables support for @ConfigurationProperties classes.
Aspect-Oriented Programming @Aspect Marks a class as an aspect.
@Before Advice to run before a matched method.
@After Advice to run after a matched method.
@Around Advice to run around a matched method.
Scheduling / Async @EnableScheduling Enables Spring?s scheduled task execution capability.
@Scheduled Declares a scheduled task.
@EnableAsync Enables asynchronous method execution.
@Async Marks a method to be executed asynchronously.
Transactions @EnableTransactionManagement Enables Spring?s annotation-driven transaction management.
@Transactional Declares transactional behavior on a class or method.
Testing @SpringBootTest Boots up the full Spring application context for integration tests.
@WebMvcTest Tests only the web layer (controllers).
@DataJpaTest Tests only JPA repositories.
@MockBean Adds a Mockito mock to the Spring context.

Interview question

Basic Level

  1. What is the Spring Framework?
  2. What are the main features of Spring?
  3. Explain Inversion of Control (IoC).
  4. What is Dependency Injection (DI)?
  5. Difference between BeanFactory and ApplicationContext.
  6. How do you define a bean in Spring?
  7. What are the different ways to configure Spring beans?
  8. Explain XML-based configuration in Spring.
  9. What is annotation-based configuration?
  10. What is Java-based configuration in Spring?
  11. What is the purpose of the @Component annotation?
  12. Difference between @Component, @Service, @Repository, and @Controller.
  13. What is @Autowired used for?
  14. How does constructor injection differ from setter injection?
  15. What are Spring bean scopes?
  16. What is the default scope of a Spring bean?
  17. What is the lifecycle of a Spring bean?
  18. What are the use cases of @PostConstruct and @PreDestroy?
  19. What is @Configuration annotation?
  20. What is @Bean annotation?
  21. How does Spring handle internationalization (i18n)?
  22. What is the role of applicationContext.xml?
  23. Difference between ApplicationContext and WebApplicationContext.
  24. What are the advantages of using Spring?
  25. How do you enable component scanning in Spring?

Intermediate Level

  1. What is Spring AOP (Aspect Oriented Programming)?
  2. Difference between cross-cutting concerns and core concerns.
  3. What are advice, pointcut, and join point in AOP?
  4. What are different types of advice in Spring AOP?
  5. How do you configure AOP using annotations?
  6. Difference between Spring AOP and AspectJ.
  7. What is proxy in Spring AOP?
  8. Explain Spring MVC architecture.
  9. What is DispatcherServlet in Spring MVC?
  10. Difference between Model, View, and Controller in Spring MVC.
  11. How do you define request mappings in Spring MVC?
  12. What is the use of @RequestMapping annotation?
  13. Difference between @RequestParam and @PathVariable.
  14. What is @ModelAttribute used for?
  15. How does Spring handle form data binding?
  16. What are Spring Validators?
  17. Explain the concept of exception handling in Spring MVC.
  18. What is @ControllerAdvice annotation?
  19. How do you configure view resolvers in Spring MVC?
  20. Difference between InternalResourceViewResolver and BeanNameViewResolver.
  21. How does Spring support RESTful services?
  22. What is @RestController annotation?
  23. How do you consume REST services using RestTemplate?
  24. What is Content Negotiation in Spring MVC?
  25. Difference between ResponseEntity and @ResponseBody.

Advanced Level

  1. What is Spring Security? Why is it used?
  2. How do you secure REST APIs using Spring Security?
  3. Difference between authentication and authorization in Spring Security.
  4. What is method-level security? How do you enable it?
  5. What is CSRF protection in Spring Security?
  6. How do you implement JWT authentication with Spring Security?
  7. What is OAuth2 and how does Spring Security support it?
  8. Difference between stateful and stateless authentication.
  9. What are Spring Profiles? How are they used?
  10. How do you configure multiple environments (dev, test, prod) in Spring?
  11. What is Spring Transaction Management?
  12. Explain propagation types in Spring transactions.
  13. Explain isolation levels in Spring transactions.
  14. Difference between declarative and programmatic transaction management.
  15. What is @EnableTransactionManagement?
  16. How do you configure DataSource in Spring?
  17. Difference between JDBC Template and HibernateTemplate in Spring.
  18. How do you use NamedParameterJdbcTemplate?
  19. Explain caching support in Spring.
  20. How do you implement EhCache or Redis with Spring?
  21. What is Spring Batch?
  22. How do you configure jobs and steps in Spring Batch?
  23. What is Spring Integration?
  24. How do you implement messaging using Spring Integration?
  25. How does Spring support reactive programming?

Expert Level

  1. How do you design a large-scale enterprise application using Spring?
  2. What are microservices and how does Spring support them?
  3. Difference between Spring Framework and Spring Boot.
  4. How do you integrate Spring with Spring Cloud?
  5. How does Spring handle distributed transactions?
  6. Explain Event-Driven architecture with Spring.
  7. How do you implement Saga pattern in Spring?
  8. How to integrate Spring with Kafka or RabbitMQ?
  9. What is Spring WebFlux? How is it different from Spring MVC?
  10. Explain reactive streams in Spring WebFlux.
  11. How do you handle backpressure in reactive programming?
  12. What are functional endpoints in Spring WebFlux?
  13. How do you achieve observability in Spring applications?
  14. How to integrate Spring with Micrometer, Prometheus, Grafana.
  15. How do you design CI/CD pipelines for Spring apps?
  16. What is Spring Native and its use cases?
  17. How to build cloud-native applications with Spring?
  18. Explain polyglot persistence in Spring applications.
  19. How do you implement API Gateway pattern with Spring?
  20. How do you secure microservices using Spring Security and OAuth2?
  21. What are common pitfalls of using Spring in production?
  22. How do you implement distributed caching in Spring?
  23. What is the role of Spring in serverless architecture?
  24. How does Spring integrate with Kubernetes?
  25. How would you combine Spring with Domain-Driven Design (DDD)?

Related Topics


   Spring_Boot   
   Spring_Cloud   
   Spring_AOP   
   Spring_Rest   
   Spring_Batch   
   Spring_MVC   
   Spring_Security   
   Spring_JPA   
   Spring_AI