1. Install idea
IDEA official website https://www.jetbrains.com/zh-cn/products/#type=ide
IDEA cracking tutorial: https://tech.souyunku.com/?p=30970
Idea settings
Code hints are not case sensitive
Filesettings enter the setting interface
Editor-->General-->code completions
Enter the interface in the figure, do not select Match case, and then click OK
Show doc when mouse is moved in
Some computers are as shown below
The shortcut keys are the same as eclipse
Global settings configuration maven
File→Settings, enter maven in the input box,
2. Create a maven project
Step 1: Filenew Project creates a project named idea_maven,
Step 2: First select maven, then select Create from archtype, then select
org.apache.maven.archtypes:maven-archtype-quickstart
Step 3: Enter com.tedu.01maven
Step 4: Choose the location of your own local warehouse
Finish the new creation is complete, check whether there is an App class in src, if not, please see step 5
Step 5: Set up the sources directory
If you don’t set the sources directory, you cannot create a class under the package.
Select the project and right-click open module settings to open the settings window. First select modulessourcesjava on the left and right-click sources.
Final test: Open App.java, right-click run, and output the program running results in the run window.
2. Create a springboot project
Step 1: File→new→project...
Step 2: Enter the domain name + project name and select your JDK version number
Step 3: Select Web→Spring Web→Select the dependent version
Step 4: View the project name and project path
Step 5: Created
Step 6: If the dependency download fails, the solution:
Step 7: Test whether it is running
Create a new controller package and test the Testcontroller class
package com.tedu.idea03springboot.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TestController {
@RequestMapping("/test")
public String test(){
return "ok";
}
}
Open the main class Run As to run:
http://localhost:8080/test
Problems encountered:
1. There is no Spring Initializr in IDEA, indicating that your version is community-run, you can go to the professional version or install plug-ins
Open opens a springboot project, and idea uses its own download 3.3.9. Some computers do not work.
Solution
1. Use idea to create an ordinary maven project and set maven to 3.6.3
2. Copy the project generated by start.spring.io.
Some computers report errors, you can refer to the following figure to solve
2. Just turn off and reopen.
Create a normal maven project, check the location of the default maven warehouse, and copy all the jars of the machine.
The latest version of idea maven warehouse can only be in the default directory
3 of the c drive , and the package name is the same
Import a created maven project yourself
Download the DbDemo project, unzip it into the IDEA workspace,
then change the folder name to, open pom.xml, and modify the project name in the pom