Hello, everyone, I’m Xiaojian.

Today’s sharing topic is about Springboot sharing. Actually, BEFORE writing this series of topics, I thought about the order of sharing technology, because WHEN I created the public account “IT Dry Warehouse”, I wanted to share some dry goods about back-end technology.

We hope that all interested partners can learn or be able to review some new technologies or skill points, back-end technology is not limited to Java but also involved in go, Python, blockchain, artificial intelligence and big data.

Therefore, I want to make notes of what I have learned to share with you, so as to avoid stepping on pits in actual combat and make progress together.

It is because of the many technologies involved, but in the series of topics to share the time will have a bit of concern, after thinking or decided to each language tutorial system interspersed release.

If you have good suggestions or opinions, you are welcome to leave a message to xiaojian jun. Search “IT dry warehouse”, there are interesting and useful dry goods waiting for you every day, we progress together, grow together!

1. Springboot prequel

Without further further, we’ve been doing a series of presentations around Springboot, the cornerstone of the Springcloud microservices framework.

In the later stage, the SpringCloud micro-service technology will be completely explained and practiced from zero to one. Let everyone on the Java backend technology has a more in-depth and specific understanding, step by step to master the technology.

Java developers are to Spring what knights are to spears and warriors are to swords. Among the top three frameworks Java developers must master is the Spring family.

Because it contains IOC and AOP two big tools greatly simplify the degree of complexity of software development, and with its excellent design pattern in many open source framework won the first, belongs to the name of the big brother.

As an important member of the Spring family, Springboot has covered more than 90% of the incomplete statistics of software developed in Java language.

So the Spring website also puts Springboot in the C bit.

(Picture from Spring official website)

Spring has gone through four generations, with The Spring1.0 era focusing on configuring entity beans through XML. As shown in the figure:

With the development of the JDK, Spring 2.x has entered a new era where beans can be declared and injected through annotations, greatly reducing the size of XML configuration files and speeding up software development.

But configuration files for resource files and databases are, of course, highly recommended in XML. Starting with Spring3.x, Java configuration is provided to better understand the beans you are configuring.

We’re in that era now, and Both Spring4.x and Spring Boot recommend using Java configuration.

As shown, we use three annotations on this class. The first @Configuration applies to the class, which is equivalent to an XML Configuration file.

The implication of this flag is that the class is automatically loaded when the container is started, and the @bean acts on the method, analogous to beans configured in XML.

There is also an @loadbalanced annotation method for load balancing in Springcloud, which will be covered in more detail in a later topic.

In fact, with the development of the Internet and the iteration of the company’s products, we can find that in terms of technology selection, we have also experienced a transition from Struts to SpringMVC and then to Springboot and Springcloud. In fact, all changes are the same.

The Spring kernel mechanics and design patterns are still something we need to study and learn. After all, The Spring family barrel already occupies the majority of the country.

2. Preliminary study of Springboot

Springboot is easy to create singleton and enterprise-class applications that you can “run directly,” according to springBoot.

We also have our own profile of the Spring platform and third-party libraries that you can easily get started with. Many Springboot projects require very little configuration. To sum up, Springboot adopts “habit over configuration” to simplify complexity.

3. Build projects

Since it’s official that building a project requires minimal configuration, let’s see if it’s true.

To facilitate testing, we first created our project framework on the Spring website: https://start.spring.io/

As you can see, the Spring website makes it easy to create projects you want. It supports Maven and Gradle language types, as well as Java, Kotlin and Groovy language types.

Versions 2.20, 2.19, 2.18 are available. And the third party plug-in support is as easy to use as described on the official website.

Download the pre-configured project and open it with The Eclipse or IDEA tool to see the structure directory of our project and related references

From the POM files, we can see that Springboot’s project structure is much simpler than our traditional JAR package reference and previous build with POM files, and related startup classes have been generated in the project structure.

Start the project directly using the run method. Is it very simple, you can also try oh

This is the end of today’s sharing, if you like my share, please click again, share or leave a message, I am Xiaojian jun, we will see you next time, bye bye ~

This article is published by OpenWrite!