Cookie Consent by Free Privacy Policy Generator 📌 Spring Boot: Everything you need to know, and what nobody told you.

🏠 Team IT Security News

TSecurity.de ist eine Online-Plattform, die sich auf die Bereitstellung von Informationen,alle 15 Minuten neuste Nachrichten, Bildungsressourcen und Dienstleistungen rund um das Thema IT-Sicherheit spezialisiert hat.
Ob es sich um aktuelle Nachrichten, Fachartikel, Blogbeiträge, Webinare, Tutorials, oder Tipps & Tricks handelt, TSecurity.de bietet seinen Nutzern einen umfassenden Überblick über die wichtigsten Aspekte der IT-Sicherheit in einer sich ständig verändernden digitalen Welt.

16.12.2023 - TIP: Wer den Cookie Consent Banner akzeptiert, kann z.B. von Englisch nach Deutsch übersetzen, erst Englisch auswählen dann wieder Deutsch!

Google Android Playstore Download Button für Team IT Security



📚 Spring Boot: Everything you need to know, and what nobody told you.


💡 Newskategorie: Programmierung
🔗 Quelle: dev.to

For all those who seek to solidify a career in application development using Java, they should also seek all knowledge in OOP (Object Oriented Programming), as I mentioned in my article 15 Tips to Become a Java Expert!, in the tip of learning a framework/lib, we must develop on other fronts that will support us in our career as a developer .

In the early days of application development using Java, it is known that the process of configuring development environments was a complex, boring and time-consuming moment.

But, over time, tools were created that had these functions configured and fell in love with developers, and the one that is most used in gigantic environments or even for small projects, this framework is called Spring Boot by Pivotal, it is It's possible to make our life a lot easier, a lot, lol.

Those of us who are part of a team of developers know that the time to finish our activities is short and of a lot of responsibility, and you can't waste time configuring a project instead of developing it, so in this article we'll go through the points you should know of this Framework, in addition to tips on best practices in its use.

Our mission here is to try to help you understand SpringBoot, to help you simplify the development of applications (Java), reducing the amount of configurations and optimizations, but remember not to reset the configurations, because they exist, but today we configure an application at a speed that 10 years ago was unthinkable.

In this article we will cover the following order to master the Spring Boot:

This article is divided into 4 parts:

Spring Boot: Everything you need to know, and what nobody told you. #Part01

How to start learning Spring boot #Part02

Questions About Microservices and Asynchronous Services(Rabbit, Kafka, SQS) #Part03

Exception Handling, Spring Security, Exceptions and Validations, Upload, Download, test and Deploy (Cloud) #Part04

Here we will start with Theory, on:

1. What is Spring
2. What is Spring Boot?
3. The Spring Components
4. Spring Boot Starter
5. Spring Boot AutoConfigurator
6. Spring Boot Actuator

1. What is Spring

Spring is a Java framework that was created with the aim of facilitating the development of applications, using the concepts of Inversion of Control and Dependency Injection. Inside it, there's Spring MVC and Core Technologies (it's the base of Spring, inside it's the dependency injection package).

2. What is Spring Boot?

Spring Boot is a framework that was born from Spring (MVC), a framework developed for the Java platform based on design patterns, IOC (inversion of control) and ID (dependency injection), both of which are standards for project that helps a lot to leave the code uncoupled.

Spring framework was created to simplify the configurations for web applications, however you still configured a lot of xml files, which did not manage to meet your objective, but which already helped you in great situations, in addition to the project, come out with your layers well defined.

Therefore, a new project was added to the framework to change this game and abstract all the complexity that a complete configuration can bring: O Spring Boot.

So Spring Boot 1.0 was released in April 2014. The Spring Framework 4.2.0, in this simpler and more direct development model, this framework was decisive for the use of the Spring ecosystem to become the darling of Programmers.

But what does it deliver that made it grow so much?

It provides most of the components needed in general applications in a pre-configured way, enabling an application running in production quickly, reducing the configuration and deployment effort, being already coupled to the tomcat Application server.

In short, Spring Boot is a pre-configured template for developing and running Spring-based applications.

3. The Spring Components

spring-boot, at the time of writing this article, is in version 3.0.1, and it is part of other spring. io with about 23 libs that help you build your applications:

  1. Spring Boot
  2. Spring Framework
  3. Spring Data
  4. Spring Cloud
  5. Spring Cloud Data Flow
  6. Spring Security
  7. Spring for GraphQL
  8. Spring Session
  9. Spring Integration
  10. Spring HATEOAS
  11. Spring REST Docs
  12. Spring Batch
  13. Spring AMQP
  14. Spring CredHub
  15. Spring Flo
  16. Spring for Apache Kafka
  17. Spring LDAP
  18. Spring Shell
  19. Spring Statemachine
  20. Spring Vault
  21. Spring Web Flow
  22. Spring Web Services

But with that many libs, how can I identify what I should understand first?*

Let's divide this first part into 3 fragments:

  • Spring Boot Starter
  • Spring Boot AutoConfigurator
  • Spring Boot Actuator

4. Spring Boot Starter

When we create an application we want to provide access to this application so we develop REST services; that we are currently using behind libs like Spring MVC, Tomcat and Jackson among many other dependencies for a single application.

So Spring Boot to help us decrease the number of manually added dependencies just by adding a dependency. Therefore, instead of manually specifying the dependencies, it is only necessary to add the following lib to our pom.xml:

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

When you run the maven command below:

mvn dependency:tree

Result:

Image description

This command shows us all the dependencies of a lib:
in the case each level shows if it has other internal dependencies or not, in the first level we have:

org.springframework.boot:spring-boot-starter-json
org.springframework.boot:spring-boot-starter-tomcat
org.springframework:spring-web

As seen when running the command, Springboot's function is to combine the various dependencies arising from a Spring Boot project into a single dependency, eliminating the need to configure multiple dependencies in Maven or Gradle.

We noticed that if we had to add one by one this process would be very laborious. Therefore, Spring Boot uses starters in order to significantly decrease it.

Remember that this lib is the one that enables you to create controllers to use the annotations that we'll see later.

5. Spring Boot AutoConfigurator

Spring Boot autoconfiguration attempts to automatically configure your Spring application based on the jar dependencies you have added.

For example, if HSQLDB is in your classpath and you haven't manually configured any database connection beans, Spring Boot will automatically configure an in-memory database.

You need to opt-in to automatic configuration by adding @EnableAutoConfiguration or @SpringBootApplication annotations to one of your @Configuration classes.

Yes, but all the settings are in the official documentation, about this process.

It is responsible for managing the configuration process of a Spring Boot application, providing default settings and merging them with possible custom settings, you can create annotated classes that configure some function of your application.

In a Spring Boot application, the AutoConfigurator can be seen using the traditional @SpringBootApplication annotation, which is above the application's initialization method.

Internally, the aSpringBootApplication annotation is a combination of Spring's traditional @Configuration, @ComponentScan, and @EnableAutoConfiguration annotations.

6. Spring Boot Actuator

The Spring Boot Actuator, it provides us with endpoints that make it easier to obtain metrics from our application.

When configuring maven with the dependency below:

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

Spring Boot AutoConfigurator defines that the web server should be exposed on localhost on port 8080, but you can redefine this port. But who makes the provision of this configuration on the web server is the Actuator.

In my github there is a project SpringBootActuatorPrometheus that teaches how to activate it and interconnect with Prometheus and Kibana, and visualize its graphs with micrometer metrics and spring boot Statistic.

This article is divided into 4 parts:

Spring Boot: Everything you need to know, and what nobody told you. #Part01

How to start learning Spring boot #Part02

Questions About Microservices and Asynchronous Services(Rabbit, Kafka, SQS) #Part03

Exception Handling, Spring Security, Exceptions and Validations, Upload, Download, test and Deploy (Cloud) #Part04

...



📌 Spring Boot: Everything you need to know, and what nobody told you.


📈 80.15 Punkte

📌 software-architektur.tv: GraalVM mit Spring Native, Spring Boot und Spring Cloud


📈 40.25 Punkte

📌 'Nobody Cares Who Was First, and Nobody Cares Who Copied Who': Marco Arment on Defending Your App From Copies and Clones


📈 35.91 Punkte

📌 7 Must-Have Tools for Developers to Boost Productivity that nobody told you about !!


📈 33.27 Punkte

📌 Build CRUD RESTful API Using Spring Boot 3, Spring Data JPA, Hibernate, and MySQL Database


📈 31.47 Punkte

📌 Querydsl vs. JPA Criteria, Part 6: Upgrade Guide To Spring Boot 3.2 for Spring Data JPA and Querydsl Project


📈 31.47 Punkte

📌 Learn Spring Boot and Spring Data JPA


📈 31.47 Punkte

📌 Upgrade Guide To Spring Boot 3.0 for Spring Data JPA and Querydsl


📈 31.47 Punkte

📌 Generative AI With Spring Boot and Spring AI


📈 31.47 Punkte

📌 Twitter vs. Substack feud: Everything you need to know (and how it affects you)


📈 30.64 Punkte

📌 The More You Know, The More You Know You Don’t Know (Project Zero)


📈 29.77 Punkte

📌 Spring Boot 2.0 mit Support für Spring Framework 5.0 veröffentlicht


📈 29.67 Punkte

📌 Spring Tools 4.6.0 versprechen mehr Leistung für Spring Boot


📈 29.67 Punkte

📌 Azure Spring Cloud - a fully managed service for Spring Boot apps


📈 29.67 Punkte

📌 Spring Boot 3.0 setzt auf Spring Framework 6.0 und Java 17


📈 29.67 Punkte

📌 Spring Boot & Spring Data JPA – Complete Course


📈 29.67 Punkte

📌 Introducing Azure Spring Cloud: fully managed service for Spring Boot microservices


📈 29.67 Punkte

📌 Introducing Azure Spring Cloud: fully managed service for Spring Boot microservices


📈 29.67 Punkte

📌 Lies of P for Xbox and PC: Gameplay, details, and everything you need to know


📈 29.57 Punkte

📌 Reboot and select proper boot device or Insert boot media in selected boot device and press a key


📈 29.16 Punkte

📌 Everything you didn't know you needed to know about Power Platform Solutions


📈 29.12 Punkte

📌 AirTag Found Moving With You: Everything You Need to Know


📈 28.84 Punkte

📌 My 6.5 yr told told me today...


📈 28.51 Punkte

📌 Meltdown and Spectre - Everything You Need To Know - ThreatWire


📈 27.78 Punkte

📌 Everything you need to know about OLED display tech (and why it matters)


📈 27.78 Punkte

📌 Best Thermal Paste: Our Top Picks and Everything You Need To Know


📈 27.78 Punkte

📌 OnePlus 9 Release Date, Specs, And Price: Everything You Need To Know


📈 27.78 Punkte

📌 What is cyber insurance? Everything you need to know about what it covers and how it works


📈 27.78 Punkte











matomo