SpringFramework
SpringFramework
1. What is Spring?
- Open source framework, light weight
- Layer architecture
- Support java enterprise application
2. What are features of Spring?
- Lightweight
- IOC
- AOP
- Container
- MVC
- Transaction management
- JDBC Exception Handling
3. What is IOC? Dependency Injection?
- IOC:
Inversion of Control
Invert control of creating object from new operator to container
- DI:
Dependency Injection
Implementation of IOC
All dependencies of an object are injected into it by framework
4. What is AOP?
- Aspect Oriented Programming
- Modularizes cross-cutting concerns (logging, security, transaction
management..)
5. Explain Aspect, Advice, Joint Point, Pointcut?
- Aspect:
a modularization of a concern
cuts across multiple classes
Eg: transaction management
- Join point:
a point during the execution of a program
in Spring AOP: represents a method execution
- Advice:
action taken by an aspect at a particular join point
Different types: "around," "before" and "after" advice
- Pointcut:
Collection of Joint Points
6. What are different types of DI?
- Constructor injection
- Setter injection
- Interface injection
- Spring support Constructor Injection & Setter Injection
7. What are the benefits of DI?
- Minimize amount of code
- Make application more testable
- Loose coupling
- Eager instatiation + lazy loading
- Flexible, security
8. Could you decribe the life cycle of Spring beans?
- Bean Container finds definition of bean
- Create a instance of bean
- Depending on the interface, the properties of the bean -> setter method will be
called
9. What is BeanFactory?
- Base on Factory pattern and IOC design
- Support 2 bean scopes: singleton + prototype
10. What is ApplicationContext? What is the different between BeanFactory and
ApplicationContext?
- ApplicationContext Derives from BeanFactory
- Has all functionality of BeanFactory + support:
Internationalization messsages
Many enterprise service(EJB, JNDI...)
Access to resource (URL + file)
Application life-cycle events
Publish events to bean registered as listenter
Loading mutiple context
11. How many types of bean scopes supported by Spring? And explain them.
- 5 types:
Singleton: default scope of Spring, 1 object instance per Spring container
Prototype: new object is created + returned whenever you get the bean
Request: new object for each HTTP request
Session: new session is created -> new instance object of bean
Global session: same as HTTP session scope, applicable in portlet-based web
app
12. What are some of the important features and advantages of Spring
Framework?
13. What do you understand by Dependency Injection?
14. How do we implement DI in Spring Framework?
15. Name some of the important Spring Modules?
16. What do you understand by Aspect Oriented Programming?
17. What is Spring IoC Container?
18. What is a Spring Bean?
19. What is the importance of Spring bean configuration file?
20. What are different ways to configure a class as Spring Bean?
21. What are different scopes of Spring Bean?
22. What is Spring Bean life cycle?
23. How to get ServletContext and ServletConfig object in a Spring Bean?
24. What is Bean wiring and @Autowired annotation?
25. What are different types of Spring Bean autowiring?
26. Does Spring Bean provide thread safety?
27. What is a Controller in Spring MVC?
28. What’s the difference between @Component, @Repository & @Service
annotations in
Spring?
29. What is DispatcherServlet and ContextLoaderListener?
30. What is ViewResolver in Spring?
31. What is a MultipartResolver and when its used?
32. How to handle exceptions in Spring MVC Framework?
33. How to create ApplicationContext in a Java Program?
34. Can we have multiple Spring configuration files?
35. What is ContextLoaderListener?
36. What are the minimum configurations needed to create Spring MVC
application?
37. How would you relate Spring MVC Framework to MVC architecture?
38. What are some of the important Spring annotations you have used?
39. Can we send an Object as the response of Controller handler method?
40. How to upload file in Spring MVC Application?
41. How to validate form data in Spring Web MVC Framework?
42. What is Spring MVC Interceptor and how to use it?
43. What is Spring JdbcTemplate class and how to use it?
44. What is Spring DAO?
45. How to integrate Spring and Hibernate Frameworks?
46. What is Spring Security?
47. Name some of the design patterns used in Spring Framework?
48. What are some of the best practices for Spring Framework?
49. What is the delegating filter proxy?
50. What is the security filter chain?