In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Origin of Spring Boot
Everyone has heard of the Spring Framework.
Spring has been a popular J2EE development framework since its birth.
With the development of Spring, its functions became more and more powerful, and the shortcomings that followed became more and more obvious, so that it became more and more bloated and very troublesome to use.
Later, due to the emphasis on configuration flexibility, sometimes it takes quite a lot of XML configuration to add even a simple feature, which is criticized as "configuration hell"!
Later, many excellent server-side frameworks emerged, such as JavaScript-based nodeJS, Python-based Django, Flask, Tornado framework. Both are adopted by more and more developers due to their simplicity of use.
Sprint Boot was created to address these framework challenges and revolutionized the Spring Framework bloated status quo. This makes the J2EE framework simple, and more and more companies and projects are choosing it.
The latest version of Spring Boot is 2.x, in this article we will introduce its installation and configuration, quickly create your first Spring Boot project, enjoy her elegance and power.
Features of Spring Boot
Spring Boot mainly has the following killer features, which can greatly reduce the complexity of learning and use, let us pay more attention to business, and improve development efficiency:
You can create stand-alone runnable applications, packaged in only one jar package, and run them. Built-in application servers Tomcat, Jetty, etc., no deployment required. Zero XML configuration, get rid of configuration hell. Automatic configuration of various third-party libraries, commonly used third-party libraries can be used after introduction. Built-in various service monitoring systems, real-time observation of service operation status. Creating Spring Boot Projects
Without further ado, let's start with the method of creating a Spring Boot 2 project, which is the first step in learning and developing Spring Boot.
Method 1: Create via Idea built-in tools
If you use IntelliJ IDEA as your development IDE, this is the most convenient way, but only if you use the Ultimate version (final version), which can be downloaded from IntelliJ's official website (of course, if conditions allow, it is recommended to buy genuine ones).
Open Idea Select Create New Project
Select Spring Initializr in the navigation bar
and fill in the engineering information.
Note that there is a choice between Maven and Gradle. Since we want zero XML configuration here, we choose to use Gradle project here, as shown in the figure. We use Sprint Boot to simplify our development lives, right?
Add third-party dependencies
We add the required third-party dependencies here. If you're new to Spring Boot, you can choose to add the following two dependencies to avoid complexity. Don't worry about other dependencies, you can easily add them at any time.
DevTools: A set of development tool configurations, such as hot deployment.
Web: Basic support for Web development.
Completion of project creation
After filling in the project name and save directory, click Done.
After the project is created, there will be an interface for gradle configuration, here we choose to use the default wrapper. This option will automatically download the corresponding version of gradle for us to configure and compile, without our own installation configuration, etc., very convenient.
Click OK and we have successfully created the new project! Congratulations! Method 2: Create via Spring Initializr
This method is suitable for students who do not use IntelliJ IDEA and use the free version of Idea, created directly through the official website for creating Spring Boot projects.
Method 1 is actually using this website as a template to integrate into Idea.
Click here to go to this website (https://start.spring.io/)
Enter project information and select Gradle Project
After entering the project information, if you need more detailed information settings, you can click the "More options" button below to set them.
addition dependency
Here we can search directly for dependencies to add, for example we add Web and Devtools libraries.
generating engineering
After we fill in all the information, we can click on the button at the bottom of the page (Generate Project) to start generating.
After generation will automatically download the project to the local, we extract, save the project to the development directory (any location you like), and then use the IDE to open it.
For example, I use IntelliJ IDEA here, and I can open it. Run the project!
Now that our project has been created, it's time to run it.
We observed the structure of the project source package and found that there is a Hellospringboot2Application class, which is the entry point for our service. After running it, our service can start normally!
summary
Through the process of creating a new Spring Boot project, we will find that it is simple, unlike the previous use of Spring to spend a lot of time and effort to create and configure, we can now even create a good project in as little as two minutes!
We'll discuss all aspects of Spring Boot in depth later in this article.
All the other articles on Spring Boot in my blog can be found here, welcome to follow!
If you have any questions, you can leave a message or send me an email at lloyd@examplecode.cn. I look forward to learning and growing together!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.