Common Spring Interview Questions & Answers For Freshers | ACTE

Common Spring Interview Questions & Answers For Freshers

Last updated on 10th Jun 2020, Blog, Interview Questions

About author

Anwar (Sr Technical Project Manager )

He is a Proficient Technical Expert for Respective Industry Domain & Serving 11+ Years. Also, Dedicated to Imparts the Informative Knowledge's to Freshers. He Share's this Blogs for us.

(5.0) | 15212 Ratings 1145

Spring is the most popular application development framework for enterprise Java. Millions of developers around the world use Spring Framework to create high performing, easily testable, and reusable code. Spring framework is an open source Java platform. It was initially written by Rod Johnson and was first released under the Apache 2.0 license in June 2003. Spring is lightweight when it comes to size and transparency. The basic version of Spring framework is around 2MB.

1. List out the major features in the versions of spring framework

Ans:

The three (3) major features are as follows:

  • Spring 2.5
  • Spring 3.0
  • Spring 4.0

2. How will IOC containers create objects for Private constructor classes?

Ans:

Spring internally will use reflection API and it will modify the constructor Accessibility and it will create the object of private constructor class also ,  by using reflection only Spring is doing autowiring and setting the objects into another object.

3. What is the purpose of Bean Factory Post Processor?

Ans:

creating BeanFactory and before using the bean if we need to change in the bean or if we need to add into the metadata then we will use BeanFactoryPostProcessors and we will add the data to metadata.

4. In the Spring Bean Configuration file for the same class 2 beans are there with different Bean names.Some other bean uses Autowire ByType How will we replicate?

Ans:

 In Spring For the same class two objects is there and Another object used autowire ByType at that time we will use which bean don’t want to inject automatically for that bean we will add “autowire candidate=false”

5. What are all the AOP advice used in Spring Transaction internally?

Ans:

 In Spring transaction internally two Advices they used. Before starting the operation it will start the transaction and if operation is successful it will call commit operation . Here Spring transaction used “Around Advice” and When Saving the Data Error came at that time it  will call rollback operation here they used “throws Advice”

6. How many AOP implementations Spring support? Why?

Ans:

Spring supported Two types of AOP implementations it is provided:

  • Spring AOP
  • AspectJ

Because spring is an open source and non-invasive framework. When the programmer wants to go out of spring at that time if the programmer uses Spring AOP he is not able to go outside easily. That’s why spring provided AspectJ implementation also. AspectJ is third party implementation.

7. One-to-many relationship: how we will map objects in Spring JDBC?

Ans:

 In One-to-Many relational objects we need to implement “ResultSetExtractor” In Spring JDBC. It will get Result Set.inside that one we need to write our own logic to populate the data into objects and we need to give this ResultSetExtractor implemented class to JDBCTemplate class uery method.

8. What is Row Mapper? For which sake will we use Row Mapper?

Ans:

 Spring JDBC don’t know how to Map the ResultSet into Objects. That’s why  we need to write a class by implementing RowMapper class. It will get ResultSet inside the “mapRow” method we need to write populating logic and we need to give this RowMapper Object to “JDBCTemplate”  under the query “method”.

9. What are all the annotations used inside of @SpringBootApplication annotation?

Ans:

The @SpringBootApplication annotation is using internally 2 annotations are major.

Those are:

  • @EnableAutoConfiguration
  • @ComponentScan

10. What is CLI in SpringBoot? What is the use?

Ans:

CLI (Command Line Interface. it we need to download and install . If the programmer knows how to implement the logic they can write the program and they will run the program with the Spring Command Line Interface. It can download all jars and it can deploy the project into an internal Tomcat Embedded server.For very easy of developers they provided CLI.

11. Why does spring provide Starter Dependencies?

Ans:

 For the easy of Developers Spring provided Starter dependencies. Normally Programmers are more concentrating on Configuration rather than business logic. For decreasing time to programmers on configuration dependency jars they provided starter dependencies. Internally they configured all dependencies.

12. In Spring AOP with which Advice programmers have a control?

Ans:

With the Around Advice Programmer have a control of actual method execution.If the programmer did not call proceed(. method actual method will not call.instead of actual method Aspect only will execute.Thats why we will call Around Advice as instead of Actual method .

13. Limitations of Dependency Injection

Ans:

  • If we are using dependency injection it is good about managing the dependency between those components which are having the static references with each other.
  • If we have some dynamic dependency to be managed means the class whom I talk to will be decided by runtime instead of development time. Then dependency injection will not work.
  • We cannot use prototype scope beans into singleton scope, because that prototype class behaves like singleton only.

14. What is Bean Lifecycle?

Ans:

Object for my bean is being created by the IOC container so the IOC container has to provide the mechanism for managing the birth of a bean and managing the death of a bean, so spring bean has provided life cycle methods for post construct activity and pre destroy activity on every bean, so bean life cycle comes in to picture.

15. Spring Internationalization

Ans:

 Spring has provided better support for internationalization when compared with JEE internationalization. It has provided multiple classes “ReloadableResourceBundleMessagesource” to support Internationalization.

16. Why is spring integrated with AspectJ?

Ans:

By Using spring AOP,the application is losing Non-invasiveness. So by avoiding the non-invasiveness of spring people integrated Aspectj AOP with spring framework. Instead of using spring in implementing the AOP people started using the Aspectj classes as part of spring work with Aop. So that our application will become non–invasive.

17. How many times the static pointcut matches method will be called?

Ans:

Depends on the number of methods present in the target class to create the proxy. Once the proxy has created only the number of methods applied, that method has been called and also 2 times extra for equals and hashcode.

18. How to work with Spring JDBC?

Ans:

 If I wanted to work with accessing the data from the database using Spring JDBC. Spring JDBC has provided 5 approaches in working with Spring JDBC to access the data from the database.   JDBC Template  Named parameters JDBC Template  Simple JDBC template  Simple JDBC insert or Simple JDBC call  Mapping SL operations as sub classes.

19. Why Servlet called a Controller in spring?

Ans:

Whenever we send the request from the end user servlet container will receive the request but the servlet container will never act as a controller because he never manages to send a response back to the end user. Servlet container will dispatch the request to the servlet component then the servlet component will perform the operation. Always servlet will not do the same operation it depends on request URL, by looking at URL servlet will do the operation. Servlet will decide what it will do after getting the request from the end user, so it is called decision maker so it is called a servlet.

20. What is a Front Controller?

Ans:

What is the purpose of front controller? Front controller is a design pattern. Front controller acts as one entry point of our application. If I want to have a controller over the request that is coming into my application ,such a type of controlling request  can happen if I  have one single getaway.  If we have front controller we can have better controller over managing the request. If the entire request comes to one getaway then it is easy to apply any kind of services.

    Subscribe For Free Demo

    Like validating the request can be applied at one place because all the requests coming to the single entry point whether the request can be allowed or should not be allowed such a check or such kind of validation are easily acquired. Apart from that there could be some common mandatory system services there like form validating, request mapping etc… and plumbing services (optional. like the audit will be managed by the front controller. Rather than writing these logic in all the servlet Struts framework has provided a front controller to manage all the requests.

    21. What is the reason to create two injections with each other?

    Ans:

    First of all spring is the non programmer to create two IOC dispatcher-servlet.xml one for spring specific applicationContext.xml one is for Business layer component means in future if we don’t want to use spring mvc then we can get read out from spring mvc easily without disturbing the existing business tire logic and we can replace any web component easily.

    22. What is Handler Mapping? What is the purpose of Handler Mapping?

    Ans:

    First the user sends the request to the Application, Once the application gets deployed. Context Loader Listener creates an IOC container after that before executing a particular Dispatcher Servlet, init(. method gets called. And Dispactcher-servlet.xml file going to read by that init(. method and create another IOC container. Once it finishes Dispatcher Servlet takes the request and applies the common processing logic, system resources and plumbing logic and all once is finished it has to send to one of the controllers to handle the request processing. But Dispatcher Servlet doesn’t know which controller he has to send that particular request. So it is known to programmers that a programmer has to tell the Dispatcher Servlet to which controller he has to send that request .So to configure the number of controller Handler Mapping comes into picture .

    23. How does the dispatcher servlet know which Handler Mapping it has to go?

    Ans:

    It’s directly to the IOC because it has the ref of Web Application Context as an attribute .. Spring has provided an interface all the handler Mapping is implemented from, so it’s always looking for an Interface not the implementation class. Whatever you have written its search for Interface so we have to be flexible with our own  Handler Mapping also we are able to create. It is called polymorphism. Handler Mapping mapping=web Application Context.getBean ( SimpleUrlHandlerMapping.class.;

    24. When should we go for Abstract Wizard Controller?

    Ans:

    It is the controller which helps the developer to gather the data using multiple wizards. We cannot gather 100% of records or columns of data using jsp pages .It may load bad user experience to make good  and to gather the data mostly developers follow Wizard conversion and flow driven approach .

    25. What is the Use of support(Class class. method and validator class of Validator class?

    Ans:

     The support method holds the configured command class parameters and we can check whether the correct command class is configured or not using the  Class class type called Assignable Form(class. method. If configured correctly it returns true otherwise it returns false ,so the validate method will not execute. Due to  this we can avoid mis configuration in spring bean configuration files.

    26. What is a Handler interceptor?

    Ans:

     We have one more additional component to Handler Mapping that is an Interceptor . So that whenever the Dispatcher Servlet receives the request it forwards the request to Handler Mapping , sends the URl  , Handler Mapping  is trying to find if the URL is a relevant controller. If the controller is identified, the name of the controller along with that of the Interceptor that should execute  for this controller both should be passed as the input for the Dispatcher Servlet.  Now  Dispatcher Servlet creates a Handler Execution chain because we can add any number of Interceptor like security interceptor, http Monitoring interceptor and logging interceptor .So multiple interceptor can apply for a request. So all the interceptors add to handler mapping . Handler Mapping will identify the controller and the list of Interceptor that has to be executed in the order before the request will go to the controller it creates  a  handler Execution Chain.

    27. What are all the benefits of Spring ORM?

    Ans:

    • Easier Testing :  Spring IOC approach allows you to swap easily  the implementations and configuration location of Hibernate SessionFactory instances . so that you can point your configuration to various environments without modifying the source code.
    • Common data access Exception: Spring instead of exposing ORM specific checked exceptions to the top level tier’s of the application, It will wrap the technology specific exception into a common runtime DataAccessException Hierarchy.
    • Integrated Transaction Management: Instead of dealing with ORM technology related transactional related code ,It allows You to declaratively manage the transactionality using AOP Declarative Transaction management tags <tx:advice or Annotation driven @Transactional annotation

    28. Why Spring Security Authenticate Provider will not validate the username and password ?

    Ans:

    Validation logic must be rewritten in other classes when we switch from one Authentication Store to another Authentication Store.  Validating the credential is separate from fetching the credential from the Authentication Store . Authentication provider will access the details and pass the input to the Authentication Manager.

    Authentication Provider will fetch the username related record from the authentication store with which we need to compare the provider username and password is matching with the Authenticate username password . That means the Authenticate provider we need to pass  the login username .Then he is going to pass User Details Object…User Details Object means Username, password, Role of the user will pass the input to Authentication Manager.

    29. What does my Authenticate manager do?

    Ans:

    The authenticate manager will compare the user details with the login user. If it is valid then it takes the role of the user once it identifies the role of user then it is going to the configuration file resource-authority.xml which resource can access by which authorization role user has to configure by the programmer . What are the resources are there in our system, and their resources are accessed by which role user will configure by us . Which is not automatic which is manually configured because i am the owner i am deciding which page is accessed by whom.

    30. What is Spring Security?

    Ans:

    To perform dependency injection on servlet filter component it can’t be possible because its class must be maintained by IOC container as spring bean having configuration in spring bean configuration file. Due to this it can’t take requests from clients as the filter is not configured as a web component in web.xml file. To overcome this problem we configure a special proxy filter in web.xml file to take the request from the client to pass the request to the filter component that is there in IOC container as spring bean. The special filter is “org.spring framework.web.filter. Delegating ProxyFilter”. But we need to match logical name  of DelegatingProxyFilter with bean name of filter component.

    Course Curriculum

    Enhance Your Career with Java Spring Training from Real Time Experts

    • Instructor-led Sessions
    • Real-life Case Studies
    • Assignments
    Explore Curriculum

    31. @Bean Annotation in which scenario we will use.

    Ans:

    This annotation also we will use for creating the bean but we have another Stereotype annotations for creating bean. By using those annotation we will create a bean if we write the Source code.But some classes we will get from jars .class files. creating beans for .class files we will use @Bean annotation under JavaConfiguration class.

    32. What is the difference between Spring non Annotation and Spring Annotation MVC.

    Ans:

    Spring non annotation MVC flow programmer must and Should extends from Any implementation of the controller of he need to implement the controller interface and Must and Should return value could be “ModelandView ”. But Annotation flow programmers don’t need to implement any class. And we can return any value.

    33. What is view Resolver? How many types of view Resolvers are there?

    Ans:

    Dispatcher Servlet doesn’t know how to render the View page. That’s why Spring people provided View Resolver. The reason is if Spring provides an implementation for rendering view also in Dispatcher Servlet if they need to modify anything related to View they need to modify Dispatcher Servlet. Because the Dispatcher Servlet tightly couples with the View Resolver. That’s Why they provided different implementations. They Provided multiple implementations for View Resolver.

    • InternalResourceViewResolver
    • ResourceBundleViewResolver
    • XmlViewResolver
    • URLBasedViewResolver

    34. Spring ORM based on which design pattern it implemented?

    Ans:

     Spring ORM implemented Based on Template Design Pattern they implemented. This Template will support for All ORM frameworks like Spring JDBC , Hibernate , Ibattis in this way for every framework they implement Template for every ORM implementation.

    35. What is DataSource? What is the implementation spring provided for dataSource?

    Ans:

     DataSource is a java provided interface for DataBase Connectivity. For this Every Web Server provided an implementation like Apache Tomcat , Weblogic , WebSphere etc. In the same way Spring also provides an implementation  for DataSource that is called “DriverManagerDataSource”.

    36. What is Named ParameterJDBCTemplate?

    Ans:

     Normally writing Prepared statement programmers will confuse which value we need to pass in which Positional parameter(?. in which place exactly programmers need to remember. But in NamedParameterJDBCTemplate we will not give Positional parameters like(?. , we will give a proper name for that positional parameter(:name. like a programmer will not confuse and the ease of programmer implements NamedParameterJDBCTemplate.

    37. Why is the Bean Factory Removed?

    Ans:

    Spring provided two implementations for creating IOC containers:

    • BeanFactory
    • ApplicationContext

    BeanFactory for small scale applications they provided and ApplicationContext for Enterprise Applications. But Small scale applications have very less number of Applications only BeanFactory used. But Spring needs to Provide support for BeanFactory in everyRelease. That’s why in the Spring 3.3 release they removed BeanFactory from Spring.

    38. How many ways can we break the singleton?

    Ans:

    We can Break the Singleton in many ways those are:

    • MultiThreading
    • Serialization
    • clone
    • Reflection etc.

    If we restrict all these things then only we will get Complete Singleton class.

    39. Write some points in spring AOP and aspect AOP?

    Ans:

    SpringAOP:

    • Only supported joinpoint is method Execution.
    • Spring supports Runtime Viewing; this means the proxy object will be built on the fly at runtime in the memory.
    • Spring supports Static and Dynamic pointcuts.

    AspectJAOP:

    • It supports various types of join points like constructor Execution, method execution , field set or field get etc.
    • AspectJ uses compile-time Weaving;this indicates your proxy classes will be available whenever you compile your code.
    • AspectJ supports only static pointcut.

    40. Spring Security why we need to configure “Delegating Filter Proxy” class  must and should we need to give name as “spring Security Filter Chain”?

    Ans:

    Because Spring Internally configured the class as “SpringSecurityFilterChain” because of that we need to restrict the class as  “springSecurityFilterChain”. If we use any other name Spring cannot identify the class that’s why we need to give the same name.

    41. What is the Spring Security internal Architecture flow?

    Ans:

    First DelegatingFilterProxy will get the request and it will pass that request to Authentication manager to ask that URL is restricted or not if that is not restricted url that request will come back to DelegatingFilterProxy and it will forward to DispatcherServlet. Authentication Manager will search in the AuthenticationCOnfiguration file whether the URL is restricted or not. If the URL is Restricted That will ask the details to AuthenticationProvider to get the details of the user and it will do the Authentication. If the User is Authorised User it will forward the URL to DispatcherServlet.

    42. What is the Use of @PostConstruct and @PreDestroy annotations?

    Ans:

    • @PostConstruct: This annotation we will use in SpringBean Lifecycle in annotation approach. This will execute that particular method after executing the constructor.
    • @PreDestroy: This Annotation will execute the method before executing finalize method or before exiting control from the program it will execute for pre destroy or complete activities.

    43. What is Dependency Check in Spring?

    Ans:

    In Spring Dependency Injection we will inject the Objects in two ways

    • ConstructorInjection
    • SetterInjection

    if we use Constructor injection those dependencies are mandatory. But if we use Constructor Injection there is a chance of CyclicDependencyInjection. That time we need to go to Mandatory SetterInjection only. If the Setter injection those are optional. With the SetterInjection we need to make those are mandatory we need to enable “DependencyCheck=true”.

    44. What is Bean Alias in Spring?

    Ans:

    For Spring Bean id if we need to give multiple names at that time we will use BeanAlias in Spring.

    Example:

    • <bean id=”mobile” class=”Nokia”>
    • <alias name=”pone” alias=”mobile”>

    45. How to rectify the “ContextLoaderListener ” class not Found Exception while deploying Application in WebServer.

    Ans:

    • Need to check whether the corresponding SpringWeb Jar is Added or not.
    • we need to Remove the files in the temp folder of Our Web Application and we need to restart the server and then again we need to deploy the Application.
    • we need to check whether we are deploying the correct War file or not.

    46. What is the use of Bean Property Sl Parameter Source?

    Ans:

     In Spring JDBC we need to map our object data to positional Parameters. But in Named PArameterJDBCTemplate if we use it we will give proper names in positional Parameter places. If that all positional ParameterNames and the Business or DTO object class Variable Names are same Programmer don’t need to map we will give that BO object to Bean Property Sl Parameter Source and we will give this ParameterSource to Named Parameter JDBC Template that will map internally.For the easy of programmers Spring provided this class.

    47. What is method Replacement in Spring?

    Ans:

    Spring provided a feature for replacing the method logic at runtime. Rather than our actual method logic we will execute another logic. For this we need to Write a class by Implementing MethodReplacer and write the logic incide replacement method. In the Spring Bean Configuration File we need to create a bean for the Replacer class and in the Actual class bean we need to add the below Element.

    • <replaced-method name=”method name” replace=”ReplaceClassBeanName”/>

    48. What is the use of @Configuration and when will we use?

    Ans:

     This annotation we will use if we used Pure Annotation based Approach at that time we will write one class For Configuration  class instead of SpringBean Configuration class. For Telling that class in Configuration class we will write this @Configuration annotation on top of that class.

    49. What are all the Stereo Type Annotation Spring provided and Which scenario we need to use? Which Annotation?

    Ans:

    Spring provided 5 StereoType annotations:

    • @Component
    • @Controller
    • @RestController
    • @Service
    • @Repository

    All the above annotations will create beans for the classes only. But we will use Specific Annotation in Specific Scenario only.

    • Component : this annotation we will this annotation just creating Bean but that class is not Related to any layer in Application.
    • Controller : This Annotation we will use to Specifying that class as controller and it will create a bean for that class.
    • RestController : This Annotation we will use to Specifying that Controller class as RestController and it also creating Bean for that class
    • Service : This Annotation we will use for the Specifying that class has Business Operation logic And that layer is Service Layer
    • Repository : This Annotation we will use for DAO layer classes

    50. How do we implement DI in Spring Framework?

    Ans:

    We can use Spring XML based as well as Annotation-based configuration to implement DI in spring applications. For better understanding, please read the Spring Dependency Injection example where you can learn both the ways with JUnit test cases. The post also contains a sample project zip file, that you can down

    Course Curriculum

    Enroll in Java Spring Course & Get Noticed By Top Hiring Companies

    Weekday / Weekend BatchesSee Batch Details

    51. How to make scope prototype?

    Ans:

    By using the attribute scope=”prototype” in xml.

    52. What are the attributes which helps to solve ambiguity problem in constructor dependency Injection?

    Ans:

    By using type and index attributes in  xml.

    53. What are mutual dependencies?

    Ans:

     When both the objects depending on each other we can call mutual dependencies

    example: A Object depends on B and B also depends on A.

    54. What is dependent on the attribute?

    Ans:

     It is used to indicate the one object has dependency on another.

    55. What is the disadvantage of auto wiring?

    Ans:

    It is helpful to inject only secondary types.

    56. What is the difference between auto wire and @Autowired?

    Ans:

    • Auto wire: attribute used in xml for auto dependency injection.
    • @Autowired: used at method level or field level for auto dependency Injection.

    57. How to solve the ambiguity problem when autowire is byType?

    Ans:

    By using auto-wire-candidate=”false” tag in xml or By using @ualifer.

    58. Spring container creates the objects instead of us we call it?

    Ans:

    IOC(Inversion of control..

    59. when we call getbean method two times for creating object when scope is default how many objects are created?

    Ans:

    one object since the default scope is singleton.

    60. What is the use of the singleton attribute?

    Ans:

     Attribute used to make singleton scope false. So it becomes a prototype.

    61. What is the attribute used for secondary dependency Injection using Xml?

    Ans:

    • property name=”fieldname” ref=”bean id”>

    62. Which objects will be created by default when we inject list, set and map dependencies by xml?

    Ans:

     List-ArrayList, Set-LinkedHashset, Map-LinkedHashMap

    63. What are the methods present in FactoryBean Interface?

    Ans:

    •  getObject(., getObjectType(., isSingleton(.

    64. What is the use of isSingleton(. in FactorBean?

    Ans:

    if it returns true then only a single object will be created for every request.

    65. How to use look-up dependency Injection?

    Ans:

     By using the attribute <lookup-method >

    66. How to use Initializing and Disposable Bean?

    Ans:

     We need to implement InitializingBean and override afterPropertySet(. act like init method. we need to implement Disposable Bean and override destroy(.

    67. What is the use of PropertyPlaceHolderConfiguration class?

    Ans:

     It is used to inject values which are present in a properties file.

    68. What is the use of hibernate templates?

    Ans:

    It is used at DAO layer directly we can perform save, update operation by using methods like save update given by hibernate template.

    69. In which the run time exception occurs JDBC or Spring JDBC?

    Ans:

    Spring JDBC

    70. What is Spring WebFlux?

    Ans:

    Java Spring Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download
    • Spring WebFlux is the new module introduced in Spring 5. Spring WebFlux is the first step towards the reactive programming model in spring framework.
    • Spring WebFlux is the alternative to the Spring MVC module. Spring WebFlux is used to create a fully asynchronous and non-blocking application built on the event-loop execution model.

    71. When do we need to go for a point-cut?

    Ans:

    when we want to execute only the particular method before the business logic.

    72. What are the benefits of IOC?

    Ans:

    Some benefits of IOC are as follows:

    • This makes the application easy to test as it does not require any JNDI lookup mechanisms or singletons in unit test cases.
    • It supports loose coupling with least intrusive mechanisms and minimal effort.
    • It promotes lazy loading and eager instantiation of services.

    73. Which method is used to set the data source in the jdbc template?

    Ans:

    • setDataSource()

    74. What is the use of <context:annotation-config />?

    Ans:

    It is used to enable @Autowired annotation

    75. What is Autowired Annotation Bean Post Processor?

    Ans:

    It is also the class

    76. What is the default handler mapping?

    Ans:

    BeanNameUrlHandlerMapping

    77. What are various handler mappings?

    Ans:

    Bean Name Url Handler Mapping, Simple Url Handler Mapping,Controller Class Name Handler Mapping

    78. When to use Bean Name Url Handler Mapping?

    Ans:

    When we need matching to be done using name of the controller or by pattern.

    79. What are @PostConstruct and @PreDestroy annotations?

    Ans:

    They are used at method and methods act like init and destroy

    80.Name some of the important Spring Modules?

    Ans:

    Some of the important Spring Framework modules are:

    • Spring Context: for dependency injection.
    • Spring AOP: for aspect oriented programming.
    • Spring DAO : for database operations using DAO pattern
    • Spring JDBC: for JDBC and DataSource support.
    • Spring ORM: for ORM tools support such as Hibernate
    • Spring Web Module: for creating web applications.
    • Spring MVC: Model-View-Controller implementation for creating web applications, web services etc.

    81. What is spring-boot-starter-parent?

    Ans:

    It is used to set-up spring boot applications with maven.

    82. What is @SpringBootTest?

    Ans:

     It is an annotation provided by spring boot for testing purposes.

    83. What is the use of spring-boot-devtools?

    Ans:

    It is used for auto reload of an application.

    84. What are dependencies required in any application to make a JPA application?

    Ans:

    • <dependency>
    • <groupId>org.springframework.boot</groupId>
    • <artifactId>spring-boot-starter-data-jpa</artifactId>
    • </dependency>

    85. one of the ways for creating spring boot applications?

    Ans:

     By using Spring Initializr.

    86. What is CrudRepository?

    Ans:

    It is a spring given interface used for crud operations on repositories.

    87. How to use CrudRepository?

    Ans:

     We need to create our interface and extend crudrepository.

    88. What is the use of Actuator in Spring Boot?

    Ans:

     It is tool which is used for monitoring and managing the application

    89. What is the use of application.properties in spring boot?

    Ans:

     It configuration file in spring boot used to override all the default setups

    90. What is a Spring Bean?

    Ans:

    • Any normal java class that is initialized by Spring IoC container is called Spring Bean. We use Spring ApplicationContext to get the Spring Bean instance.
    • Spring IoC container manages the life cycle of Spring Bean, bean scopes and injecting any required dependencies in the bean.

    91. What is the default scope?

    Ans:

    Singleton.

    92. What is the difference between the application context and Bean factor?

    Ans:

    Application context creates the object at time of loading  but Bean factor creates the object at first request.

    93. How to inject arraylist into a class through xml?

    Ans:

      By using <list> tag

    94. What are the Spring scopes?

    Ans:

    Singleton, prototype, request, session, global session.

    95. Types of stereotype annotation?

    Ans:

    • @controller,
    • @component,
    • @Repository,
    • @service

    96. What is Session scope?

    Ans:

     Session: It returns a single bean instance per HTTP session (User level session..

    97. What are different types of Autowire?

    Ans:

    There are four different types of Auto wire:

    • byName
    • byType
    • constructor
    • autodetect

    98. What Are Devtools In Spring Boot?

    Ans:

    Spring boot comes with DevTools which is introduced to increase the productivity of developers.

    99. What are types of pointcuts?

    Ans:

    • Static Method Matcher point cut
    • Name Method Matcher point cut

    100. What are types of Advisors?

    Ans:

    • Default pointcut Advisor
    • Regex method pointcut Advisor

    Are you looking training with Right Jobs?

    Contact Us
    Get Training Quote for Free