Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Spring - Interview Questions and Answers for 'L' - 43 question(s) found - Order By Newest | ||||
Very frequently asked. Among first few questions in almost all interviews. Among Top 5 frequently asked questions. Frequently asked in Indian service companies (HCL,TCS,Infosys,Capgemini etc based on multiple feedback ) and Epam Systems | ||||
| ||||
Ans. "equals" is the method of object class which is supposed to be overridden to check object equality, whereas "==" operator evaluate to see if the object handlers on the left and right are pointing to the same object in memory. x.equals(y) means the references x and y are holding objects that are equal. x==y means that the references x and y have same object. Sample code: String x = new String("str"); String y = new String("str"); System.out.println(x == y); // prints false System.out.println(x.equals(y)); // prints true | ||||
Sample Code for equals | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   string comparison   string   object class   ==   equals   object equality  operator   == vs equals   equals vs == Asked in 294 Companies basic   frequent | ||||
Try 6 Question(s) Test | ||||
Recently asked in TCS , Tech Mahindra, HCL , Accenture and Fidelity. | ||||
| ||||
Ans. The DispatcherServlet configured in web.xml file receives the request. The DispatcherServlet finds the appropriate Controller with the help of HandlerMapping and then invokes associated Controller. Then the Controller executes the logic business logic and then returns ModeAndView object to the DispatcherServlet. The DispatcherServlet determines the view from the ModelAndView object. Then the DispatcherServlet passes the model object to the View. The View is rendered and the Dispatcher Servlet sends the output to the Servlet container. Finally Servlet Container sends the result back to the user. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  j2ee   spring   mvc   frameworks   web applications   architecture Asked in 11 Companies Basic   frequent | ||||
| ||||
Ans. Spring enables developers to develop enterprise-class applications using POJOs. The benefit of using only POJOs is that you do not need an EJB container product. Spring is organized in a modular fashion. Even though the number of packages and classes are substantial, you have to worry only about ones you need and ignore the rest. Spring does not reinvent the wheel instead, it truly makes use of some of the existing technologies like several ORM frameworks, logging frameworks, JEE, Quartz and JDK timers, other view technologies. Testing an application written with Spring is simple because environment-dependent code is moved into this framework. Furthermore, by using JavaBean-style POJOs, it becomes easier to use dependency injection for injecting test data. Spring is web framework is a well-designed web MVC framework, which provides a great alternative to web frameworks such as Struts or other over engineered or less popular web frameworks. Spring provides a convenient API to translate technology-specific exceptions (thrown by JDBC, Hibernate, or JDO, for example) into consistent, unchecked exceptions. Lightweight IoC containers tend to be lightweight, especially when compared to EJB containers, for example. This is beneficial for developing and deploying applications on computers with limited memory and CPU resources. Spring provides a consistent transaction management interface that can scale down to a local transaction | ||||
Sample Code for spring | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   spring framework   mvc   spring container   architecture   technical architect   java architect   technical lead  ioc Asked in 2 Companies basic   frequent | ||||
Very frequently asked.Usually among first few questions. | ||||
| ||||
Ans. MVC is a Design Pattern that facilititates loose coupling by segregating responsibilities in a Web application 1. Controller receives the requests and handles overall control of the request 2. Model holds majority of the Business logic, and 3. View comprise of the view objects and GUI component | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  j2ee   mvc   mvc design pattern   design pattern   struts   spring   web application   web frameworks   ebay Asked in 60 Companies basic   frequent | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. Prototype scope - A new object is created each time it is injected/looked up. It will use new SomeClass() each time. Singleton scope - It is the default scope. The same object is returned each time it is injected/looked up. Here it will instantiate one instance of SomeClass and then return it each time. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Spring beans  singleton bean scope  prototype bean scope Asked in 1 Companies | ||||
| ||||
Ans. Within message.properties file. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  j2ee   web application   struts   spring Asked in 1 Companies | ||||
| ||||
Ans. The Spring Framework supports following five scopes - Singleton prototype request session global-session | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  j2ee   spring   mvc   frameworks   web applications   beans   beans scope   at&t  fidelity | ||||
| ||||
Ans. There are seven core modules in spring Spring MVC The Core container O/R mapping DAO Application context Aspect Oriented Programming or AOP Web module | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  j2ee   spring   mvc   frameworks   web applications | ||||
| ||||
Ans. Spring configuration file is an XML file. This file contains the classes information and describes how these classes are configured and introduced to each other. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  j2ee   spring   mvc   frameworks   web applications   spring configuration file Asked in 1 Companies | ||||
| ||||
Ans. The default scope of bean is Singleton. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  j2ee   spring   mvc   frameworks   web applications   bean | ||||
Very Frequently asked Spring question. | ||||
| ||||
Ans. The Spring container is able to autowire relationships between collaborating beans. This means that it is possible to automatically let Spring resolve collaborators (other beans) for your bean by inspecting the contents of the BeanFactory without using | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  j2ee   spring   mvc   frameworks   web applications   autowiring   beans   at&t   ge Asked in 9 Companies   frequent | ||||
Frequently asked in Phone Interviews. | ||||
| ||||
Ans. Singleton , Prototype , Request , Session , global-session | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  spring framework   bean scope   general electric   ge | ||||
Frequently asked in Phone Interviews. | ||||
| ||||
Ans. By Name , By Type and Constructor. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   spring   spring container   dependency injection   auto wiring   auto wiring types   general electric   ge | ||||
| ||||
Ans. We should use singleton scope for beans when they are stateless and prototype when they are stateful. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  spring   bean scope   general electric   ge  singleton | ||||
| ||||
Ans. I like Spring as it comes with inbuilt Dependency Injection framework. It has great online community and support and is proven to work well with ORMs like Hibernate. If we are not working with ORM and DI, Struts 2 is also good. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  spring   struts   project lead   technical lead   techical architect | ||||
| ||||
Ans. No, if required we should only have final variables.Bean scoped singleton means that only one instance of the bean will be created and will be shared among different requests and hence instance variables will get shared too. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   singleton   spring framework   spring beans | ||||
| ||||
Ans. ApplicationContextAware | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  spring   applicationcontext   application context   applicationcontextaware | ||||
| ||||
Ans. Spring Boot is Springs convention-over-configuration solution for creating stand-alone, production-grade Spring-based Applications. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Spring Boot Asked in 7 Companies | ||||
| ||||
Ans. Spring Security is a powerful and highly customizable authentication and access control framework. It is the de facto standard for securing Spring-based applications. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   Asked in 3 Companies | ||||
| ||||
Ans. Have worked on Java 7 and Java 8, In Java 8 , Worked with streams , lambda expression and default methods. Have worked on both Spring Mvc and Spring Boot, using Spring dependency injection, Rest services , AOP , JDBC and Hibernate integration. Have worked on Rest services using Spring and Spring Boot. Have worked on SOAP web services too. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  spring  web services Asked in 1 Companies | ||||
| ||||
Ans. No, there is no relationship between web.xml and spring.xml but you have to configure spring.xml in web.xml in order initialize beans when application starts up | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  spring  web.xml  spring.xml  deployment descriptor Asked in 1 Companies | ||||
| ||||
Ans. Spring Interceptor are Spring beans and hence they can inject other beans and can be used with other Spring frameworks concepts like AOP. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  interceptors  servlet filters  spring interceptors vs servlet filters | ||||
Frequently asked Spring interview question. | ||||
| ||||
Ans. Core: [Core, Bean, Context, Expression Language] Web: [Web, Portlet, Servlet, etc] Data Access [JMS, JDBC, etc] AOP, Aspect | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  spring  spring framework components Asked in 12 Companies | ||||
| ||||
Ans. setMaxUploadSize is used to set the maximum size of uploads that can be made in a request whereas setMaxUploadSizePerFile sets the maximum size per uploaded file. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  MultipartResolver | ||||
| ||||
Ans. Using Constructor and Setters. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  spring  dependency injection   inversion of control | ||||
| ||||
Ans. 1. In Setter Injection, partial injection of dependencies can possible, means if we have 3 dependencies like int, string, long, then its not necessary to inject all values if we use setter injection. If you are not inject it will takes default values for those primitives1. In constructor injection, partial injection of dependencies cannot possible, because for calling constructor we must pass all the arguments right, if not so we may get error 2. Setter Injection will overrides the constructor injection value, provided if we write setter and constructor injection for the same property [i already told regarding this, hope you remember ] But, constructor injection cannot overrides the setter injected values 3. If we have more dependencies for example 15 to 20 are there in our bean class then, in this case setter injection is not recommended as we need to write almost 20 setters right, bean length will increase. In this case, Constructor injection is highly recommended, as we can inject all the dependencies with in 3 to 4 lines [i mean, by calling one constructor] 4. Setter injection makes bean class object as mutable [We can change ] .Constructor injection makes bean class object as immutable [We cannot change ] | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  spring  dependency injection   inversion of control Asked in 3 Companies | ||||
| ||||
This question is still unanswered. Can you please provide an answer. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  ApplicationContext  BeanFactory   ApplicationContext vs BeanFactory   frequent | ||||
| ||||
Ans. For JPS we can use modelAttribute and ModelAndView object to share data between JPS and Controller. In case of Angular JS, the angular js always get data in form of JSON and it can be accessed by REST WS. So the angular js share data with controller in the form of JSON. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  angularjs  jsp  spring controller Asked in 1 Companies | ||||
| ||||
Ans. No, if required we should only have final variables. Bean scoped singleton means that only one instance of the bean will be created and will be shared among different requests and hence instance variables will get shared too. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  singleton Asked in 1 Companies | ||||
| ||||
Ans. Yes, But with interceptor it will remove the body from the request and then we will have to explicitly add the attributes to the session to forward it to the handler. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  interceptor  filter | ||||