What is Spring Boot ?
Over the years, Spring has become more complex as new features are added. Just visit the https://spring.io/projects page and we will see the different features of all the Srping projects that we can use in our program. Spring Boot is already built on top of the existing Spring framework. With Spring Boot, we avoid all the boilerplate code and configuration we had to do before. Therefore, Srping Boot can help us use existing Spring features more robustly with minimal effort.
What are the advantages of Spring Boot ?
①Reduce development and testing time. ② Using JavaConfig helps to avoid the use of XML . ③ Avoid a large number of Maven imports and various version conflicts. ④ Less configuration is required because there is no web.xml . ⑤ Start development quickly by providing default values. ⑥ No separate web server is required, which means you no longer need to start Tomcat , Glassfish or anything.
What is JavaConfig ?
Spring JavaConfig is a product of the Spring community that provides a pure Java approach to configuring the Spring Ioc container. So it helps to avoid XML configuration.
Advantages of JavaConfig ?
Object Oriented Configuration :
Since configurations are defined as classes in JavaConfig, users can take full advantage of the object-oriented features in java. One configuration class can inherit from another, override its @Bean methods, etc.
Reduce or eliminate XML configuration :
JavaConfig provides developers with a pure Java way to configure Spring containers with a similar concept to XML configuration. From a technical point of view, it is possible to configure the container using only the JavaConfig configuration class. But in practice many people think it is ideal to mix and match JavaConfig with XML.
Type safe and refactoring friendly :
JavaConfig provides a type-safe way to configure the Spring container. Thanks to Java 5.0 's support for generics, beans can now be retrieved by type rather than by name , without any casts or string-based lookups.
How to reload changes on Spring Boot without restarting the server ?
Spring Boot has a Development Tools (DevTools) module that helps improve developer productivity. A major challenge for Java developers is to automatically deploy file changes to the server and automatically restart the server. Developers can reload changes on Spring Boot without restarting the server. <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> <dependency>
What is an Actuator ?
Spring Boot Actuator is one of the important features in the startup framework. Spring Boot monitors help you access the current state of a running application in production. The monitor module exposes a set of REST endpoints directly accessible as HTTP, URL to check status.
How to run Spring Boot application on custom port?
Configuration file: application.properties
Port configuration: server.port = 8080
What is YAML ?
YAML is a data serialization language with hierarchical configuration data, it is often used in configuration files. If we want to add complex properties to the configuration file, the YAML file is more structured and less confusing.
What is Swagger ?
Swagger is widely used to visualize APIs, using Swagger UI to provide an online sandbox for front-end developers. Swagger is a tool, specification and complete framework implementation for generating visual representations of RESTful web services. It enables documents to be updated at the same rate as the server.
What are Spring Profiles ?
Spring Profiles allow users to register beans based on profiles (dev, test , prod, etc.). So, when the application is running in development, only some beans can be loaded, while in PRODUCTION, some other beans can be loaded.
What is Spring Batch ?
Spring Boot Batch provides reusable functions that are important when dealing with large numbers of records, including logging/tracing, transaction management, job processing statistics, job restarts, skips, and resource management. It also provides more advanced technical services and functions, enabling extremely high batch and high performance batch jobs through optimization and partitioning techniques. Simple as well as complex high-volume batch jobs can utilize the framework to process significant amounts of information in a highly scalable manner.
What are FreeMarker templates?
FreeMarker is a Java-based template engine originally focused on dynamic web page generation using the MVC software architecture. The main advantage of using Freemarker is the complete separation of presentation and business layers. Programmers can handle application code, while designers can handle html page design. Finally using freemarker these can be combined to give the final output page.
How to implement the security of Srping Boot application ?
The Spring-boot-sarter-security dependency is used and security configuration must be added. It requires very little code, the configuration class will have to extend WebSecurityConfigurerAdapter and override its methods.
How to implement exception handling with Spring Boot ?
Spring provides a way to handle exceptions using ControllerAdvice. We handle all exceptions thrown by the controller class by implementing a ControlerAdvice class.
What starter maven dependencies are used in Spring Boot ?
spring-boot-starter-activemq spring-boot-starter-security Helps to add fewer dependencies and reduce version conflicts.
What is a CSRF attack?
CSRF stands for Cross Site Request Forgery. This is an attack that forces end users to perform unwanted actions on currently authenticated web applications. CSRF attacks specifically target state change requests, not data theft, because the attacker cannot view the response to a forged request.
What are WebSockets ?
WebSocket is a computer communication protocol that provides a full-duplex communication channel over a single TCP connection.
WebSockets are bidirectional :
Message sending can be initiated using a WebSocket client or server.
WebSocket is full duplex :
Client and server communications are independent of each other.
A single TCP connection :
The initial connection uses HTTP, upgrade this connection to a socket-based connection. This single connection is then used for all future communications.
Compared to HTTP, WebSocket message data exchange is much easier.
What is Apache Kafka ?
Apache Kafka is a distributed publish-subscribe messaging system. It is a scalable, fault-tolerant publish-subscribe messaging system that enables us to build distributed applications. This is an Apache top-level project. Kafka is suitable for offline and online message consumption.