File Name: java spring interview questions and answers .zip
There are a lot of opportunities from many reputed companies in the world.
- Spring Interview Questions
- Top 80 Spring MVC Framework Interview Questions & Answers
- Spring interview questions and answers
What is Spring? Answer: Spring is an open source development framework for Enterprise Java. The core features of the Spring Framework can be used in developing any Java application, but there are extensions for building web applications on top of the Java EE platform. Spring framework targets to make Java EE development easier to use and promote good programming practice by enabling a POJO-based programming model.
Spring Interview Questions
What is Spring? Answer: Spring is an open source development framework for Enterprise Java. The core features of the Spring Framework can be used in developing any Java application, but there are extensions for building web applications on top of the Java EE platform.
Spring framework targets to make Java EE development easier to use and promote good programming practice by enabling a POJO-based programming model. What do you mean by Aspect? Answer: Aspect is modularization of concern which cuts across multiple objects.
Transaction management is a good example of a crosscutting concern in J2EE applications. Aspects are implemented using regular classes or regular classes annotated with the Aspect annotation in Spring Framework. What are Spring beans? A bean is an object that is instantiated, assembled, and otherwise managed by a Spring IoC container.
These beans are created with the configuration metadata that the users supply to the container. What is a MultipartResolver and when is it used? Answer: The MultipartResolver interface is used for uploading files. Using these, we can support file uploads in our web applications.
How would you enable transactions in Spring and what are their benefits? Answer: There are two distinct ways to configure Transactions — with annotations or by using Aspect-Oriented Programming AOP — each with their advantages. How do we implement DI in Spring Framework? For better understanding, please read Spring Dependency Injection example where you can learn both the ways with JUnit test case.
The post also contains a sample project zip file, that you can download and play around to learn more. What are the features of Spring? Answer: Lightweight: Spring is lightweight when it comes to size and transparency.
The basic version of the spring framework is around 1MB. And the processing overhead is also very negligible. The objects give their dependencies instead of creating or looking for dependent objects. Aspect-oriented AOP : Spring supports Aspect-oriented programming and enables cohesive development by separating application business logic from system services.
Container: Spring contains and manages the life cycle and configuration of application objects. Transaction Management: Spring framework provides a generic abstraction layer for transaction management. This allowing the developer to add the pluggable transaction managers, and making it easy to demarcate transactions without dealing with low-level issues. Describe the Spring Framework? Answer: The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications — on any kind of deployment platform.
What are the benefits of using Spring Tool Suite? However, STS comes with Eclipse with some other important stuff such as Maven support, Templates for creating different types of Spring projects and tc server for better performance with Spring applications. I like STS because it highlights the Spring components and if you are using AOP pointcuts and advice, then it clearly shows which methods will come under the specific pointcut.
So rather than installing everything on our own, I prefer using STS when developing Spring-based applications. Name some of the important Spring Modules? Answer: Some of the important Spring Framework modules are: Spring Context — for dependency injection. Spring AOP — for aspect-oriented programming. What is Aspect-Oriented Programming? Answer: Aspects enable the modularization of crosscutting concerns such as transaction management that span multiple types and objects by adding extra behavior to already existing code without modifying affected classes.
What is Weaving? Answer: According to the official docs, weaving is a process that links aspects with other application types or objects to create an advised object. This can be done at compile-time, load time, or at runtime. What is a Spring Framework? Spring is a powerful open source, application framework created to reduce the complexity of enterprise application development.
It is light-weighted and loosely coupled. It has layered architecture, which allows you to select the components to use, while also providing a cohesive framework for J2EE application development. Answer: Aspect: a class that implements cross-cutting concerns, such as transaction management Advice: the methods that get executed when a specific JoinPoint with matching Pointcut is reached in the application Pointcut: a set of regular expressions that are matched with JoinPoint to determine whether Advice needs to be executed or not JoinPoint: a point during the execution of a program, such as the execution of a method or the handling of an exception.
Answer: There are two ways to get Container specific objects in the spring bean. They will work only in the servlet container specific environment only though. Autowired ServletContext servlet context;. Name the exceptions thrown by the Spring DAO classes? What are the different types of Spring Bean auto wiring?
Answer: There are four types of autowiring in Spring framework. For more details about these options, please read Spring Bean Autowiring. What are Bean wiring and Autowired annotation? Answer: The process of injection spring bean dependencies while initializing it called Spring Bean Wiring.
We can use Autowired annotation with fields or methods for autowiring byType. For this annotation to work, we also need to enable annotation-based configuration in spring bean configuration file. This can be done by context:annotation-config element. Describe Spring DAO support? This allows one to switch between the persistence technologies easily. It also allows you to code without worrying about catching exceptions that are specific to each of this technology.
How do you turn on annotation wiring? Answer: Annotation wiring is not turned on in the Spring container by default. In order to use annotation-based wiring, we must enable it in our Spring configuration file by configuring element. What do you understand by Required annotation? Answer: Required is applied to bean property setter methods. This annotation simply indicates that the affected bean property must be populated at the configuration time with the help of explicit property value in a bean definition or with auto wiring.
If the affected bean property has not been populated, the container will throw BeanInitializationException. Answer: Spring MVC Framework provides the following ways to help us achieving robust exception handling. Controller-Based — We can define exception handler methods in our controller classes. All we need is to annotate these methods with ExceptionHandler annotation.
Global Exception Handler — Exception Handling is a cross-cutting concern and Spring provides ControllerAdvice annotation that we can use with any class to define our global exception handler.
HandlerExceptionResolver implementation — For generic exceptions, most of the times we serve static pages. Spring Framework provides a HandlerExceptionResolver interface that we can implement to create a global exception handler.
The reason behind this additional way to define global exception handler is that Spring framework also provides default implementation classes that we can define in our spring bean configuration file to get spring framework exception handling benefits.
For a complete example, please read the Spring Exception Handling Example. What is a Proxy? Answer: A proxy is an object that is created after applying the advice to a target object. When you think of client objects the target object and the proxy object are the same. What is Spring Security? Answer: Spring security framework focuses on providing both authentication and authorization in Java applications.
It also takes care of most of the common security vulnerabilities such as CSRF attack. You should go through the following posts to learn how to use the Spring Security framework. How to inject a java. Properties into a Spring Bean? Answer: We need to define propertyConfigurer bean that will load the properties from the given property file. Then we can use Spring EL support to inject properties into other bean dependencies. For example; If you are using annotation to configure the spring bean, then you can inject property like below.
Answer: MultipartResolver interface is used for uploading files — CommonsMultipartResolver and StandardServletMultipartResolver are two implementations provided by spring framework for file uploading. Once configured, any multipart request will be resolved by the configured MultipartResolver and pass on a wrapped HttpServletRequest.
Name the types of transaction management that Spring supports? Answer: Two types of transaction management are supported by Spring. They are: Programmatic transaction management: In this, the transaction is managed with the help of programming. It provides you extreme flexibility, but it is very difficult to maintain. Declarative transaction management: In this, transaction management is separated from the business code. Only annotations or XML based configurations are used to manage the transactions.
What are the ways by which Hibernate can be accessed using Spring? What is Spring MVC framework?
Top 80 Spring MVC Framework Interview Questions & Answers
Spring is largely a redundancy. Java EE 6 provides what you are likely to need from Spring a standards compliant framework. If you are still doing J2EE development I can understand why you think Spring is the better framework, however. Thanks Thomas you like these spring questions, and thanks for explaining that point some how I completely missed that. Can you add some more Spring framework interview questions , especially from spring mvc part. I am going for spring interview and expecting spring mvc interview questions based on job description.
How does Spring resolves view returned by ModelAndView class? Some Spring MVC questions are tricky e. Struts and Spring integration and can be only answered by experienced Java program with 2 to 4 year experience in Spring MVC framework. Good questions Radhe. How do you fix this issue? Since during HTTP post, if checkbox is unchecked than HTTP does include a request parameter for checkbox, which means updated selection won't be picked up. ULBased View e.
Spring interview questions and answers
The canonical reference for building a production grade API with Spring. In this article, we're going to look at some of the most common Spring-related questions that might pop up during a job interview. Spring is the most broadly used framework for the development of Java Enterprise Edition applications. The core features of Spring can be used in developing any Java application. We can use its extensions for building various web applications on top of the Jakarta EE platform, or we may just use its dependency injection provisions in simple standalone applications.
I have tried to collect these spring interview questions which you may face into your next technical interview. For other spring modules, I will share interview questions and answers separately. I will really appreciate if you can suggest more similar spring interview questions which you have faced in your previous interviews and you consider them spring interview questions for experienced to be asked. I will add them in this list. This will be great help for fellow learners as well.
Spring interview questions and answers are frequently asked because it is now widely used framework to develop enterprise application in java. There are given a list of top 40 frequently asked spring interview questions. It is a lightweight, loosely coupled and integrated framework for developing enterprise applications in java. It removes the dependency from the program. Now, there is dependency between Employee and Address because Employee is forced to use the same address instance.
Отчаяние. Сожаление. Снова и снова тянется его рука, поблескивает кольцо, деформированные пальцы тычутся в лица склонившихся над ним незнакомцев.
Ангел заговорил: - Дэвид, я люблю. Внезапно он все понял. Сьюзан на экране тянулась к нему, плача и смеясь, захлестнутая волной эмоций. Вот она вытерла слезы. - Дэвид… я подумала… Оперативный агент Смит усадил Беккера на сиденье перед монитором.
Замечательный город. Я бы хотел задержаться. - Значит, вы видели башню. Гиральду.
- Наверное, увидел включенный монитор. - Черт возьми! - выругался коммандер. - Вчера вечером я специально позвонил дежурному лаборатории систем безопасности и попросил его сегодня не выходить на работу.