Posts in 2024
  • @RestController, @Service, @Repository, @Component

    Thursday, June 13, 2024 in Spring Interview Questions

    @RestController, @Service, @Repository, @Component Presentation Layer @RestController Marks a class as a Spring MVC controller Service Layer @Service Marks a class as a service layer component for defining business logic Persistence Layer @Repository …

    Read more

  • @Value

    Thursday, June 13, 2024 in Spring Interview Questions

    @Value @Value(”${key:default}”) on variable can get key-value pair’s value from application.properties

    Read more

  • @PostConstruct

    Thursday, June 13, 2024 in Spring Interview Questions

    @PostConstruct @PostConstruct allows to perform initialization tasks on a bean right after all its necessary dependencies have been injected by Spring but before the bean is put to use The method annotated with @PostConstruct must have no parameters, …

    Read more

  • @Autowired

    Thursday, June 13, 2024 in Spring Interview Questions

    @Autowired @Autowired is used for automatic dependency injection in Spring. It can be applied to constructors, methods, and fields @Component public class MyService { @Autowired private MyRepository myRepository; } Use @Autowired with @Qualifier can …

    Read more

  • @SpringBootApplication

    Thursday, June 13, 2024 in Spring Interview Questions

    @SpringBootApplication @SpringBootApplication on main class as an entry point @SpringBootApplication public class SpringLearningApplication { public static void main(String[] args) { SpringApplication.run(SpringLearningApplication.class, args); } } …

    Read more

  • Aspect-Oriented Programming (AOP)

    Thursday, June 13, 2024 in Spring Interview Questions

    Aspect-Oriented Programming (AOP) AOP in Spring allows you to separate cross-cutting concerns from your application logic eg. transaction management, logging, security, exception Use @Aspect with @Component on class can create a aspect bean …

    Read more

  • Inversion of Control (IoC) Container

    Thursday, June 13, 2024 in Spring Interview Questions

    Inversion of Control (IoC) Container IoC container in Spring manages the creation and lifecycle of application objects (beans) and their dependencies Type BeanFactory ApplicationContext Extends BeanFactory with more enterprise-specific functionality

    Read more

  • Bean

    Thursday, June 13, 2024 in Spring Interview Questions

    Bean A bean is a Java object managed by the Spring IoC container Bean Definition Type XML Configuration Define beans in applicationContext.xml Annotation-Based Configuration Define beans by using annotations like @Component on classes Java …

    Read more

  • Dependency Injection (DI)

    Thursday, June 13, 2024 in Spring Interview Questions

    Dependency Injection (DI) DI is one of the primary ways to implement IoC Through DI, components receive their dependencies from IoC container rather than creating them themselves Type Constructor Injection Method Injection Property Injection

    Read more

  • Inversion of Control (IoC)

    Thursday, June 13, 2024 in Spring Interview Questions

    Inversion of Control (IoC) IoC is a software design principle that decouples components and shifts control over program execution from the main application to a container Pros Components are loosely coupled

    Read more