This is the 3rd part of Java Interview Questions series.
1st part is Core Java Interview Questions, 2nd part is Hibernate Interview Questions.
Spring interview questions is an important part of Java developer interview preparation.
As I said in 2nd part – Spring and Hibernate is a jentleman set of Java programmer.
I’ve divided questions into 6 sections: Spring Core (IoC, AOP, configuration), Data Access Layer (Spring ORM, Spring-TX, and Spring Data-JPA), Web (Spring MVC, Spring WEB), Spring Security, Spring Boot and Spring Cloud (microservices).
My Spring Interview Question List
I don’t know if it’s really necessary to add interview question level filter (basic, medium, advanced) like I did in previous 2 parts because I’m still not sure does anybody use it.
So if you think that it’s would be useful to mark questions for junior, middle and senior developers – leave a comment and I’ll add it.
Let’s check out my Top-150 Spring Interview Questions.
Spring Core (IoC & AOP)
- What is Inversion of Control (IoC)?
- What is a difference between Inversion of Control (IoC) and Dependency Injection (DI)?
- What are advantages of using DI?
- What IoC containers do you know?
- What Spring modules do you know?
- List few design patterns implemented in Spring Framework
- What are the main benefits of using Spring?
- What types of DI do you know in Spring?
- What is AOP?
- How AOP connected to IoC?
- What are Aspect, Advice, PointCut, and JoinCut?
- What is a difference between Spring AOP and AspectJ?
- What is Spring IOC container?
- What is Spring Bean?
- What ways to configure Spring Beans do you know?
- What scopes of bean do you know?
- What is a singleton bean?
- What is a prototype bean?
- How does prototype work?
- How to define bean’s scope?
- How to inject prototype in the singleton bean?
- How to inject a collection of beans?
- What is bean lifecycle?
- What is BeanFactory and how does it work?
- What is BeanPostProcessor?
- Describe Spring bean initialization steps
- What annotations to inject bean do you know?
- What injection modes do you know?
- What is a lazy loading bean?
- What is a difference between @Component, @Service, and @Repository?
- What configuration types is it possible to use?
- Is it possible to have few configuration files?
- Is Spring Bean thread-safe?
- What is ApplicationContext?
- How to create ApplicationContext?
- What implementations of ApplicationContext do you know?
- What is a @Repeatable annotation? When was it introduced?
- What is a difference between @Autowired, @Resource, and @Inject?
- How to execute a piece of code after bean initialization?
- What is @Qualifier annotation?
- What are application events?
- What standard application events do you know?
- How to override already defined bean?
- What’s new in Spring 4?
- What’s new in Spring 5?
- What do you prefer more properties class or @Value annotations?
- What are advantages of properties class?
Data Access Layer (Spring ORM, Spring-TX and Spring Data-JPA)
- How to manage transaction using Spring?
- How @Transactional annotation works?
- What transaction propagation types do you know?
- What is DAO and how Spring Framework supports it?
- What is JdbcTemplate?
- What is a Spring Repository?
- How to create a JPA repository?
- How to execute a custom query in JPA repository?
- Is it possible to execute a native query in JPA?
- What is a Spring Data Specification?
- How to customize return type of JPA repository?
Web (Spring MVC, Spring WEB)
- What is Spring MVC?
- What are advantages of Spring MVC?
- How to add Spring to the web application?
- How to get instance ServletContext and ServletConfig in Spring Bean?
- What is MVC pattern?
- What is Controller?
- What is a difference between @Controller and @RestController?
- What is a DispatcherServlet?
- What is a ContextLoaderListener?
- What is a ViewResolver?
- What is a MultipartResolver?
- What is a BindingResult?
- How to load a file in Spring MVC?
- How to handle exceptions in Spring MVC Framework?
- What is REST?
- How to implement REST endpoint using Spring MVC?
- How to validate input data?
- What is a Spring MVC Interceptor and how to use it?
- What are bean scopes available in Spring MVC?
- How to manage error messages?
- Explain Spring MVC request flow
- What is a difference between @RequestParam, @RequestBody, and @PathVariable?
- How to write integration tests for controllers?
- What is Spring Security?
- How to enable Spring Security?
- How Spring Security works internally?
- What ways to add security restrictions do you know?
- How to test security restrictions?
- What is the DelegatingFilterProxy?
- What is the security filter chain?
- What is URL interceptor?
- Why do we need method security?
- What is a security context?
- How to obtain current security context?
- What is a Principal and how to retrieve it?
- What is a UserDetails and how to get it?
- What is a difference between authentication and authorization?
- Does Spring Security provide a mechanism to secure passwords?
- What is password salting?
- What is the role of @PreFilter and @PostFilter in spring security?
- What is a Web Reactive Framework?
- What is a Flux?
- What is a Mono?
- What is Spring Boot?
- What are Spring Boot advantages?
- How does it work?
- How can I build a war?
- Should I build a war at all or maybe jar is more than enough?
- Who said: “Make jar, not war”?
- What embedded containers Spring Boot provides?
- What are Spring Boot starters?
- What starters do you know?
- How to define your own starter project?
- What is AutoConfiguration?
- What is Spring Boot Actuator?
- Describe standard application events in Spring Boot
- How can I integrate it in my maven project if I already have a parent pom definition?
- What is spring.factories?
- What is a difference between @SpringBootApplication and @EnableAutoConfiguration?
- How can I manage configuration files for different profiles?
- What do you prefer more properties or yaml configuration and why?
- How to start Spring Boot application on a custom port?
- How to add web to Spring Boot application?
- How to add security to Spring Boot application?
- How to reload my changes (hot reload) without restarting the server manually?
- What annotation Spring Boot provides for tests?
- What is a CommandLineRunner?
Spring Cloud and Microservices
- What is Spring Cloud?
- What are advantages of Spring Cloud?
- What is microservice?
- What advantages and disadvantages of microservices?
- What is a difference between microservice and SOA?
- How can we monitor all the Spring Boot Microservices?
- What is a service discovery?
- What is a service registration?
- What is a client-side service registration?
- What is a server-side service registration?
- What’s a Eureka?
- What is a Load Balancer? How does it work in Spring Cloud?
- What is a Fault Tolerance? How is it implemented?
- What is a Feign?
- What is Hystrix Circuit Breaker?
- Explain request flow when you’re making a request to another microservice
- How to perform cross-service data migration scripts?
- What is a better single database for all service or database for each service? Why?
- What is an API Gateway?
- How to secure microservices?
- What is a JWT token?
- How to collect logs from all microservices?
- How to test microservices?
- What is a Spring Cloud Contracts?
- How to reliably/atomically publish events whenever the state changes?
If you know any interesting questions related to Spring, Hibernate and Java – please, leave a comment and I’ll update my lists.
Let’s collect the best interview question collection together!