Spring and Spring Boot Interview Questions and Answers - PLM Developer

Here are the Spring and Spring Boot Frequently asked Interview Questions and Answers.  There are crucial features introduced and improved in Sprint Boot. Please go through questions and answers. Add a comment or mail us if anything is missing or you feel like included in this post.

Q. What is Spring?
A. Spring is a framework that provides a convenient way for different components to be integrated

Q. What is Spring Boot?
A. It is an extension of the Spring framework, It makes developing in Spring easier
Q. What is Apache Maven?
A. A project and build management tool for Java and other projects
Q. What is a Maven archetype?
A. A project template that contains the basic structure of our Maven project
Q. Which is the one annotation that you would apply to the class which contains the main() method for your Spring Boot app?
A. @SpringBootApplication
Q. What is the starter dependency descriptor you should use to use the embedded Tomcat server in SpringBoot?
A. Spring-boot-starter-web

Q. Which are the embedded servers that the spring-boot-starter-web dependency supports?
A. Undertow, Jetty, Tomcat
Q. When deploying your web application as an external war file what are the first two details you need to specify in your app?
A.Set the Maven packaging as "war", Have your configuration derive from SpringBootServletInitializer.

Q. What is the Spring Initializr?
A. A web interface used to specify the project structure and dependencies for a Spring Boot project
Q. What is Thymeleaf in Spring Boot?
A. The template engine which transforms and displays views in a web application
Q. What is the Spring Tools Suite?
A. A suite of tools integrated with Eclipse to make development in Spring easier

Q. What is the property in Spring which helps you change the port your application is running on?
A. server. port
Q. What is the annotation that tells Spring that we have external properties specified in a Java file?
A. @ConfigurationpProperties
Q. What utility can you use to generate unique confirmation tokens?
Q. Using Spring Data, how do you perform CRUD operations on a database?
A. Set up an interface that extends CrudRepository<T, ID> and Spring Data will automatically provide an implementation
Q. Which interface should you implement to specify interceptors for your web requests?
A. HandlerInterceptor

Q. What base class should you extend when you want to configure the security settings for your application?
A. WebSecurityConfigurerAdapter
Q. What method would you override in the WebSecurityConfigurerAdapter, to specify which pages should be behind the login page?
A. configure()

Q. What are the characteristics of the Java mail sender?

A. It is possible to send an email with attachments, You can specify HTML content in the text of the email
Q. When you do not specify a user explicitly, what is the password for the default user that Spring Security configures?
A. The password is generated and displayed in the console logs

Q. What annotation would you apply to the component which holds business logic in your application?
A. @Service
A. What kind of HTTP request would you make to add a new record to your database?
Q. What kind of HTTP request would you make to update an existing record in your database?
Q. What is the most relevant HTTP request that you can make to remove an existing record in your database?

Q. Which Spring module automatically provides implementations for CRUD operations on your database entities?

A. Spring Data
Q. Which statements accurately describe the @Cacheable annotation? 

A. Once the response is cached, the code for the method is not invoked, Cache responses are not automatically updated when a change has occurred
Q. What annotation would you use to clear the cache in case of deletes or updates?
A. @CacheEvict

See Also:

👉Java Interview Questions & Answers 1

👉Java Interview Questions & Answers 2

👉Java Interview Questions & Answers 3

Post a Comment