Back
Decor-dark

55+ Spring Boot Interview Questions To Hire Or Get Hired With

6015 words Read time 29:21

The rise of Spring Boot is thanks to many of the agile software development methodologies and the historic use of Java. Spring Boot is not a framework but an easy way to build a standalone prototype, in often use cases. It's still widely used amongst larger organizations in an effort to develop a fast product and benchmark its success. Below are some Spring Boot interview questions and answers to help you during the interview process for when you are undergoing the technology examinations. Often, these will happen in person, behind a whiteboard. Be prepared by answering these questions in your own way, in advance. I would recommend sitting down with a friend and asking for their assistance in reviewing your delivery of the answers.



Spring Boot Interview Questions Table of Contents

1. What is Spring Boot?
2. Name the major advantages of using Spring Boot
3. What are some of the disadvantages of using Spring Boot?
4. How are properties defined in Spring Boot?
5. Why should you use Spring Boot?
6. What are some of the core configuration files used for Spring Boot?
7. What is the JavaConfig inside Spring Boot package?
8. What are the advantages of using the JavaConfig method?
9. What are the two ways you enable the Spring Boot features?
10. What are some of the main features of Spring Boot?
11. How do developers make Spring Boot venture utilizing Spring initializr?
12. Why should you have a Spring Boot Maven module?
13. How can you override the default properties in a Spring Boot project?
14. What is referred to as Actuator in Spring Boot?
15. What are the main components of Spring Boot?
16. Name the different forms of Spring Boot initializer.
17. In Spring Boot, name the different types of classification of dependencies.
18. What are some of the Starter Project Options that are provided by Spring Boot?
19. What is the difference between JPA and Hibernate?
20. What are the steps that an engineer would take to deploy your application (typically) on a virtual machine?
21. Which one of these is the core annotation for Spring Boot?
22. Does Spring Boot require a separate container in order for it to run?
23. Which of these are the ways that Spring Boot runs its package?
24. What is the function of Swagger in Spring Boot?
25. Can you explain what the Spring Boot initializer used for?
26. What are the main features of Spring Boot applications?
27. How would you create a Spring Boot Project using the Spring Initializer?
28. What are some of the Spring Boot starters?
29. What is the main role of the @EnableAutoConfiguration annotation?
30. What are frequently used commands to create and run Spring Boot Applications?
31. How would you use a custom banner in Spring Boot applications?
32. What are the advantages of using Spring Boot for building out micro-services?
33. What is Docker and what is its purpose in Spring Boot?
34. What is swagger and how do you add it to Spring Boot?
35. What are some of the unique features of Spring Book CLI?
36. How do you use LiveReload with Spring Boot development tools?
37. What is the difference between RequestMapping and GetMapping?
38. How does a user or engineer deploy to a different server using Spring Boot?
39. What happens in the background when a Spring Boot Application is run as a Java Application?
40. Can you tell me what Spring Data is?
41. What are some of the main functions of Spring Boot Maven plugin?
42. Explain the steps of setting up a maven project manually.
43. What is the minimum baseline Java Version you need for Spring Boot 2?
44. What are the other Starter Project Options that Spring Boot provides?
45. In what types can Spring Boot dependencies be classified into?
46. Explain the difference between Spring Boot, Spring MVC and Spring.
47. What are some of the main differences between RequestMapping and GetMapping?
48. Why would you not advise someone to use Spring DateRest in most real-world applications?
49. What is the difference between JPA and Hibernate?
50. How would you best expose a custom application configuration within Spring Boot?
51. What are the different environments for enterprise application development?
52. What is the main way that Spring Boot WAR is deployed to Tomcat?
53. Can you explain what annotations are in Spring Boot?
55. What are the main security properties in Spring Boot?
56. What are Spring Boot Starter Projects?
57. What are Embedded Servers and why are the important in Spring Boot applications?


1. What is Spring Boot?

First of all, it is important to understand that Spring Boot is NOT a framework but rather, an easy way of creating stand-alone applications with little or no configurations. This approach is used to develop spring-based applications that have fewer configurations. One of the best features about Spring Boot is that it leverages the existing spring projects and third-party projects to develop production-ready applications.

2. Name the major advantages of using Spring Boot

• The development of Spring-based applications is easy with the help of Java or Groovy.
• Spring Boot requires significantly less development or engineering time and generally increases overall productivity.
• Spring Boot does not require lots of boilerplate Code, XML configuration and Annotations to be written.
• Spring Boot Applications can easily be integrated with Spring Ecosystems such as Spring JDBC, Spring ORM, Spring Data, and Spring Security etc.
• Spring Boot follows “Opinionated Defaults Configuration” in order to reduce development effort.
• Spring Boot applications provide embedded HTTP servers such as Tomcat and Jetty to develop and test web applications easily.
• Spring Boot provides Command Line Interface (CLI) tool s in order to develop and test Spring Boot applications such as Java or Groovy.
• Spring Boot provides a variety of plugins to develop and test Spring Boot Applications using in-built tools such as Maven and Gradle.

3. What are some of the disadvantages of using Spring Boot?

• While using Spring Boot, converting an existing or legacy Spring Framework into a Spring Boot Application is tough and time-consuming.
• Why is Spring Boot opinionated?
• This is because Spring Boot follows the “Opinionated Defaults Configuration” Approach in order to reduce the development effort.
• How does Spring Boot work and how does it now what to configure?
• In Spring Boot, auto-configuration takes place by analyzing the classpath. If you happen to forget a dependency, Spring Boot can’t configure it. Spring Boot works with tools such as Maven, Gradle and Ant/Ivy.

4. How are properties defined in Spring Boot?

Properties in Spring Boot are defined in the application.properties file that exists in a classpath of the application as follows. Example: configure default DataSource bean. database.host=localhost database.user=admin

5. Why should you use Spring Boot?

• Operate independently
• Simplified configuration
• Automatic configuration
• No code generation and XML configuration
• Application monitoring
• Easy to get started

6. What are some of the core configuration files used for Spring Boot?

The two main core configuration files in Spring Boot are the application and bootstrap configuration files. The application configuration files are pretty easy to understand as they are primarily used for automated configuration of your Spring Boot projects.

The bootstrap configuration files on the other hand have the following scenarios.

• Yes, some fixed attributes that cannot be overridden, that is true.
• Yes, there are some encryption/decryption scenarios.

7. What is the JavaConfig inside Spring Boot package?

Spring JavaConfig is essentially a product inside of Spring Boot that provides pure Java methods for the configuration of the Spring IOC containers. Ideally, JavaConfig helps avoid using complicated XML configuration.

8. What are the advantages of using the JavaConfig method?

• Object-oriented configuration: Since JavaConfig defines its configuration as a class; users can take advantage of Java’s object-oriented configuration. • Elimination of XML configuration: despite the fact that externalized configuration improves the efficiency of web applications based on the principle of dependency injection, most developers try to avoid switching back and forth between XML and Java. JavaConfig offers an entirely pure way of configuring the spring containers similar to how the XML configuration works. Whereas most developers often assume that it is ideal to always JavaConfiq with XML, it is possible to configure the container using only JavaConfig.
• Refactoring friendly: JavaConfig has a type-safe way of configuring the Spring container that to Java 5.0 support for generics.

9. What are the two ways you enable the Spring Boot features?

• Inherit tfrom he spring-boot-starter-parent project
• Import the spring-boot-dependencies project dependencies

10. What are some of the main features of Spring Boot?

• Web Development
• Spring Application
• Application occasions and listeners
• Admin highlights
• Externalized Configuration
• Properties Files
• YAML Support
• Type-safe Configuration
• Logging
• Security

11. How do developers make Spring Boot venture utilizing Spring initializr?

The spring initializr is a web-based application that produces the Spring Boot project structure. However, the Spring Initializer does not necessarily create an application code. Despite this, the initializer gives the user an essential project structure using either a Maven or a Gradle-built specification. Below are some of the ways that a Spring Initializr can be utilized.

• An online interface.
• Via Spring Tool Suite.
• Using the Spring Boot CLI.

12. Why should you have a Spring Boot Maven module?

The Spring Boot Maven module provides the charges that enable you to package the code as a container as well as run the application. There are several types of Spring Boot Maven modules as outlined below.

• spring-boot-This module operates the Spring Boot module.
• spring-boot: repackage-This module repackages the jug/war to be executable.
• spring-boot: start and spring-boot: stop-These are the two modules that deal with the life-cycle and development of your Spring Boot application.
• Spring-boot:build-data-this module is utilized by the Actuator.

13. How can you override the default properties in a Spring Boot project?

There are a lot of properties that can be overridden in a Spring Boot application and this overriding is achieved when the default properties are specified in application.properties. Example: When a developer wants to specify a prefix or suffix in a Spring MVC application, this can be done by entering the properties below in application.properties. spring.mvc.view.prefix: /WEB-INF/ spring.mvc.view.suffix: .jsp

14. What is referred to as Actuator in Spring Boot?

An actuator is one of the most vital features of Spring Boot. The Actuator is used to access the current state of a running application in a production environment. There are various metrics that are used to establish the current state of an application.

Example: /metrics: This endpoint shows the developer/user metrics such as free memory, uptime, processors among other properties. Spring Boot actuator helps you monitor your applications in the production environment. Restful points are extremely sensitive which means that they have restricted access and can only be accessed by authenticated users. However, this restriction can be changed by overriding it in application.properties.

15. What are the main components of Spring Boot?

• Spring Boot Starter
• Spring Boot AutoConfigurator
• Spring Boot Actuator
• Spring Boot CLI
• Spring Boot Initilizer.

16. Name the different forms of Spring Boot initializer.

• Spring Boot initializer comes in the following forms;
• Spring Boot Initilizer With Web Interface
• Spring Boot Initilizer With IDEs/IDE Plugins
• Spring Boot Initilizer With Spring Boot CLI
• Spring Boot Initilizer With ThirdParty Tools

17. In Spring Boot, name the different types of classification of dependencies.

• Spring – core, beans, context, aop
• Web MVC – (Spring MVC)
• Jackson – for JSON Binding
• Validation – Hibernate Validator, Validation API
• Embedded Servlet Container – Tomcat
• Logging – logback, slf4j

18. What are some of the Starter Project Options that are provided by Spring Boot?

Spring Boot provides new projects or applicatios with the typical dependencies that are meant to develop most specific or general type of applications.

• spring-boot-starter-web-services – SOAP Web Services
• spring-boot-starter-web – Web & RESTful applications
• spring-boot-starter-test – Unit testing and Integration Testing
• spring-boot-starter-jdbc – Traditional JDBC
• spring-boot-starter-hateoas – Add HATEOAS features to your services
• spring-boot-starter-security – Authentication and Authorization using Spring Security
• spring-boot-starter-data-jpa – Spring Data JPA with Hibernate
• spring-boot-starter-data-rest – Expose Simple REST Services using Spring Data REST

19. What is the difference between JPA and Hibernate?

• JPA is a specification/Interface • Hibernate is one of JPA implementations

20. What are the steps that an engineer would take to deploy your application (typically) on a virtual machine?

• Step 1: Install Java • Step 2: Install the Web/Application Server (Tomcat/Websphere/Weblogic etc) • Step 3: Deploy the application war

21. Which one of these is the core annotation for Spring Boot?

@SpringBootApplication is the core annotation above the startup class in Spring Boot. @SpringBootApplication has the following combinations.

• @SpringBootConfiguration: Combines the @Configuration annotation to implement the configuration files.
• @EnableAutoConfiguration: Turns on and off automatic configuration by turning off the data auto-configuration.
• @ComponentScan: Spring component scan.

22. Does Spring Boot require a separate container in order for it to run?

Spring Boot does not require a separate container to run as it has in-built containers such as Tomcat and Jetty.

23. Which of these are the ways that Spring Boot runs its package?

• Packing commands or putting them together into a container.
• By running the application with Maven/Gradle plugin.
• By directly executing the main method in run.

24. What is the function of Swagger in Spring Boot?

Swagger is a tool that generates visual representations of RESTful web services, full framework implementations and specifications.

25. Can you explain what the Spring Boot initializer used for?

A Spring Boot initializer would be described as a tool used to bootstrap the Spring Boot applications in an easy way. The Spring Boot initializr comes in the following forms;

• Spring Boot Initializer With Web Interface.
• Spring Boot Initializer With IDEs/IDE Plugins.
• Spring Boot Initializer With Spring Boot CLI.
• Spring Boot Initializer With ThirdParty Tools.

26. What are the main features of Spring Boot applications?

• In Spring Boot, the applications development environment is faster as Spring Boot can perform many of the configurations automatically, without human intervention.
• Spring Boot has support for Jetty, Undertow and Tomcat servers with a default port 8080.
• When you are using Spring Boot, it is possible to externalize configurations so that you the user user can work with the same application code in different configured code environments. Users can use properties files like YAML files, environment variables and command-line arguments to externalize configuration.
• When using Spring Boot, Common Loggings are used for all internal logging but the user can also implement our Logging.
• Spring Boot provides auto-configuration for Elasticsearch, Solr, Redis, MongoDB, Neo4j and Cassandra NoSQL technologies.
• In Spring Boot applications, auto-configuration is done for the necessary infrastructure to send and receive messages using JMS.
• Spring boot uses SpringApplication.run() inside java main method to bootstrap the application.
• Spring Boot provides a @SpringBootTest annotation to test spring boot application.

27. How would you create a Spring Boot Project using the Spring Initializer?

When creating a Spring Boot Project, go to the spring initializer URL https://start.spring.io and follow the following steps:

• Select a Maven or a Gradle project.
• Select the language to be used such as Java, Kotlin or Groovy.
• Select the Spring Boot version to be used.
• Specify the artifacts coordinates’ i.e. group and artifact name.
• Select the dependencies required by the project.
• click on Generate Project button. A project will get started to download.

28. What are some of the Spring Boot starters?

There are several types of Spring Boot starters used for different engineering purposes when starting a new Spring Boot application. Some of the Spring Boot starters are;

• spring-boot-starter-parent: It is a special starter that provides useful Maven defaults. It is used in parent section in the POM.
• spring-boot-starter-web: Starter for building web and RESTful application with MVC.
• spring-boot-starter-security: Starter for using Spring Security.
• spring-boot-starter-web-services: Starter for using Spring web services.
• spring-boot-starter-thymeleaf: Starter for Spring MVC using Thymeleaf views.
• spring-boot-starter-freemarker: Starter for Spring MVC using FreeMarker views.

29. What is the main role of the @EnableAutoConfiguration annotation?

@EnableAutoConfiguration annotation enables autoconfiguration required in Spring Boot applications. Autoconfiguration in Spring Boot applications is dependent on classpaths and beans.

30. What are frequently used commands to create and run Spring Boot Applications?

1. For Maven

• mvn dependency:tree: Prints tree of JAR dependencies.
• mvn clean eclipse:eclipse: Creates .classpath
• mvn clean package: Creates JAR/WAR for the application.
• mvn spring-boot:run: Starts tomcat to run application in exploded form.

2. For Gradle

• gradle dependencies: Prints list of direct and transitive dependencies. • gradle clean eclipse: Creates .classpath • gradle clean build: Creates JAR/WAR for the application. • gradle bootRun: Starts embedded tomcat server to run application in exploded form for web application.

31. How would you use a custom banner in Spring Boot applications?

A custom banner is generally used as one of the following in the Spring Boot applications;

• Text Banner: For text banner just create a file named as banner.txt with desired text and keep it at the location src\main\resources.
• Image Banner: For image banner just create a file named as banner.gif and keep it at the location src\main\resources.
• In the application.properties we can configure following banner properties.
• banner.charset: It configures banner encoding. Default is UTF-8.
• banner.location: It is banner file location. Default is classpath:banner.txt
• banner.image.location: It configures banner image file location. Default is classpath:banner.gif. File can also be jpg, png.
• banner.image.width: It configures width of the banner image in char. Default is 76.
• banner.image.height: It configures height of the banner image in char. Default is based on image height.
• banner.image.margin: It is left hand image margin in char. Default is 2.
• banner.image.invert: It configures if images should be inverted for dark terminal themes. Default is false.

32. What are the advantages of using Spring Boot for building out micro-services?

Building out micro-services suing Spring Boot has the following advantages;

• Spring Boot has opinionated views of the Spring Platform and third-party libraries. This means that Spring developers can access tools easily in order to create standalone applications that can be embedded with properties such as Jetty or Tomcat.
• Spring Boot offers production-ready services for building micro-services.
• Spring Boot has an embedded pre-configured Tomcat server.
• Spring Boot provides executable JAR packaging as well as a host of useful decencies.
• Spring Boot requires minimal configuration overheads thus allowing it to be customized to meet the developmental needs of micro-services.
• The Actuator feature of Spring Boot has basic health-checks and monitoring functions that are useful for micro-services.

33. What is Docker and what is its purpose in Spring Boot?

In Spring Boot applications, a Docker is the tool that allows for easier deployment and running of applications. Dockers assist developers design all-inclusive packages of the applications. From a social aspect, Docker can be described as a Linux container management toolkit. Dockers assists users in publishing container images.

34. What is swagger and how do you add it to Spring Boot?

Swagger in Spring Boot is useful for documenting REST API. Swagger is used specify the method, URL, representation as well as other formats used to describe REST web services. Ideally, Swagger offers Spring developers and users tools to generate/compute the documentation of various application codes.

In order to add Swagger to Spring Boot, the following steps are followed.

1) Generation of swagger documentation with spring boot: Docket configuration has to take place as well as linking some dependencies to Swagger before any document generation can take place. For starters, the Swagger UI adds visual representations of the documentation in addition to helping in the execution of test requests.

2) Viewing of the generated swagger documentation: When the application is restarted, Swagger documentation can be viewed by visiting URL http://localhost:8080/v2/api-docs. The Meta information with regards to the API is found at the top of the specific documentation.

35. What are some of the unique features of Spring Book CLI?

• No Semicolons
• No Public and private access modifiers
• No Imports (Most)
• No “return” statement
• No setters and getters
• No Application class with main () method (It takes care by SpringApplication class)
• No Gradle/Maven builds
• No separate HTTP Servers

36. How do you use LiveReload with Spring Boot development tools?

In a Spring Boot MVC project, web browsers and servers are involved. During the development process, in order to get updated data, the user must restart the server and browser whenever there is a change in the name of a file. However, Spring Boot developers have automatized these two tasks through the use of LiveReload in the browser. Below are the steps to follow when using LiveReload in browser.

• Follow the LiveReload extension link and install it.
• Ensure that spring-boot-devtools is installed.
• The Spring Boot developer tool will start a LiveReload server.
• Users can enable or disable LiveReload in Spring Boot applications.
• When mvn spring-boot:run is run in order to update your application code, the application will automatically restart and the page will be refreshed.

37. What is the difference between RequestMapping and GetMapping?

• RequestMapping is generic - you can use with GET, POST, PUT or any of the other request methods using the method attribute on the annotation.
• GetMapping is specific to GET request method. It’s just an extension of RequestMapping to improve clarity.

38. How does a user or engineer deploy to a different server using Spring Boot?

When deploying to a different server using Spring Boot, there are two steps that are followed;

• Generate a war from the project.
• Deploy it to your favorite server (Websphere or Weblogic or Tomcat or …).

39. What happens in the background when a Spring Boot Application is run as a Java Application?

When the user or engineer is using the Eclipse IDE, Eclipse makes sure that any changes to the class file or an addition of a dependency is compiled and ready in the target folder (user or server side). After this process, any Spring Boot Application will just be like any other Java Application.

40. Can you tell me what Spring Data is?

The objective of Spring Data is to provide a consistent and familiar Spring-based programming model. This is done to provide general access to data while still retaining the special traits that the underlying data may have. In simple terms, Spring Data makes it easier t access and use data technologies, map-reduce frameworks, relational and non-relational databases and cloud-based services.

41. What are some of the main functions of Spring Boot Maven plugin?

The spring-boot-maven-plugin has several commands that allow you to package the code in form of JAR or run the application. Below are some of the commands found in the spring-boot-maven-plugin;

• spring-boot:run runs your Spring Boot application.
• spring-boot:repackage repackages your jar/war to be executable.
• spring-boot:start and spring-boot:stop to manage the lifecycle of your Spring Boot application (i.e. for integration tests).
• spring-boot:build-info generates build information that can be used by the Actuator.

42. Explain the steps of setting up a maven project manually.

In Eclipse, Use File -> New Maven Project to create a new project.

• Add dependencies.
• Add the maven plugins!
• Add the Spring Boot Application class

43. What is the minimum baseline Java Version you need for Spring Boot 2?

Spring Boot 2.0 requires having Java 8 or later installed on your machine. Java 6 and 7 are no longer supported as of late.

44. What are the other Starter Project Options that Spring Boot provides?

Spring Boot provides a number of new projects or applications with addition to the typical dependencies meant to develop specific-type web applications. These starter projects are:

• spring-boot-starter-web-services - SOAP Web Services
• spring-boot-starter-web - Web & RESTful applications
• spring-boot-starter-test - Unit testing and Integration Testing
• spring-boot-starter-jdbc - Traditional JDBC
• spring-boot-starter-hateoas - Add HATEOAS featur
es to your services
• spring-boot-starter-security - Authentication and Authorization using Spring Security
• spring-boot-starter-data-jpa - Spring Data JPA with Hibernate
• spring-boot-starter-data-rest - Expose Simple REST Services using Spring Data REST

45. In what types can Spring Boot dependencies be classified into?

Spring Boot dependencies can be classified into some of the following:

• Spring - core, beans, context, aop
• Web MVC - (Spring MVC)
• Jackson - for JSON Binding
• Validation - Hibernate Validator, Validation API
• Embedded Servlet Container - Tomcat
• Logging - logback, slf4j

46. Explain the difference between Spring Boot, Spring MVC and Spring.

One of the most important features of the Spring framework is that it is Dependency Injection (or IOC). The core of all Spring Modules is IOC (Inversion of Control) or Dependency Injection. When Dependency Injection (or IOC) is used by the engineer appropriately, users can develop loosely-coupled applications which can easily be tested.

The Spring MVC Framework provides a couple of ways to develop web applications such as by using concepts such as Dispatcher Servlet, ModelAndView and View Resolver.

The main problem about the Spring Framework and the Spring MVC framework is the amount of configuration that is required to get it setup. This is where Spring Boot comes in. Spring Boot has auto configuration as well as other non-functional features that make it easier to build production-ready applications.

47. What are some of the main differences between RequestMapping and GetMapping?

RequestMapping is generic: RequestMapping can be used with GET, POST, PUT and many other request methods using the method attribute on the annotation.

GetMapping is specific: GetMapping is an extension of RequestMapping to improve clarity on requests.

48. Why would you not advise someone to use Spring DateRest in most real-world applications?

While Spring DataRest does an excellent job in prototyping, it is not recommended for big applications. This is because when using Spring DataRest, the database entities operate as REST Services. During the design of RESTful services, the interface being used should have the following key features;

• The domain model
• The consumers

When using Spring Data REST, your entities are exposed as REST Services. This means that while Spring Data REST is good for prototyping, it may not be such a great idea to use when a project is fully evolved.

49. What is the difference between JPA and Hibernate?

In simple terms;

• JPA is a specification/Interface
• Hibernate is one of JPA implementations

When a JPA is used (executed by the engineer), an annotation and general interfaces from javax.persistence package without using Hibernate import packages.

50. How would you best expose a custom application configuration within Spring Boot?

A configuration component can be defined using the @ConfigurationProperties.
Here is an example:
@Component
@ConfigurationProperties("basic")
public class BasicConfiguration {
private boolean value;
private String message;
private int number;
The values can be configured in application.properties
basic.value: true
basic.message: Dynamic Message
basic.number: 100

51. What are the different environments for enterprise application development?

• Dev
• QA
• Stage
• Production

52. What is the main way that Spring Boot WAR is deployed to Tomcat?

When deploying Spring Boot WAR to Tomcat, the following steps are followed.

• Download Apache Tomcat.
• Unpackage the same into the desired tomcat folder.
• Copy the WAR file from the target/spring-boot-tomcat.war into the tomcat/webapps/ folder.
• From a terminal, go to tomcat/bin folder.
• Execute the file.

53. Can you explain what annotations are in Spring Boot?

In a Spring Boot framework, annotations promote and implement the principles of IOC (control inversion) and DI (dependency injection). Annotations therefore can allow developers to manage bean dependencies (and more) using the XmL-based configuration. Annotations and their dependencies can also be defined in a Java-based configuration that instead uses Spring annotations. Different from the XML approach, a Java-based configuration creates programs to manage bean components.

54. Can you control the dev logging with Spring Boot? If so, how do you do it?

Yes, it is entirely possible to control logging with Spring Boot by specifying the log-levels on the application.properties file. Spring Boot always loads this file if it is present in the classpath and can be used in the configuration of both Spring Boot and the application code.

Since Spring Boot uses Commons Logging for internal logging, it is possible to change the log levels by adding the line below in the application.properties file.

Syntax
• logging.level.org.springframework=DEBUG
• logging.level.com.demo=INFO

55. What are the main security properties in Spring Boot?

• security.basic.enabled: It enables basic authentication. Default value is true.
• security.basic.path: It configures paths to apply security. We need to provide comma separated paths.
• security.enable-csrf: It enables CSRF. Default value is false.
• security.require-ssl: It enables and disables SSL. Default value is false.
• security.sessions: Default value is stateless. Values can be always, never, if required, stateless.
• security.user.name: It configures user name. Default user is user.
• security.user.password: It configures password.
• security.user.role: It configures role. Default role is USER.

56. What are Spring Boot Starter Projects?

Starters in Spring Boot are a set of convenient descriptors that are included in Spring Boot applications. Starters come with a variety of Spring-related technology making the process of application development with Spring Boot much easier. With Starter Projects, you don’t have to search for a sample code or try to copy and paste a load of descriptors.

Example:

If you are using Spring or JPA for database access as an engineer, you can include the spring-boot-starter-data-jpa dependency in your main project and that’s pretty much it. Another example is when you are using Spring Boot Starter Web. When trying to develop a Spring Boot web application that exposes RESTful services, then Spring Boot Start Web is the package of choice for the engineer. A project using Spring Initializr and Spring Boot Starter Web would look like the following:

< dependency >
< groupId >org. springframework.boot
< artifactId > spring-boot-starter-web

57. What are Embedded Servers and why are the important in Spring Boot applications?

here are so many benefits that arise from deploying your application on a virtual machine. When doing this, consider the following steps;

• Step 1 : Install Java
• Step 2 : Install the Web/Application Server (Tomcat/Websphere/Weblogic etc)
• Step 3 : Deploy the application war

Considering a scenario where you want to make the server part of the application, all you need is a virtual machine installed with Java and you can directly deploy an application on a virtual machine. This is the whole idea behind Embedded Servers.

Example:
In a Spring Boot application, it is possible to generate an application JAR that contains an Embedded Tomcat. This means that you can still run your application like a normal Java application. To make this really easy to understand, embedding a server refers to the process when a deployable unit has binaries for the server that are required i.e. (tomcat.jar).

Share this article

C

Other articles