expand

SpringBoot series learning summary and extension

Pay attention to the collection and don’t get lost

I. Construction of the official website (for study, not recommended)
  • Build address: Click Jump

  • Can be modified according to their own requirements, recommended as follows:

  • Click on the building

  • Download and decompress

  • Open the project

  • It will take some time for Maven to download the relevant JAR packages, depending on your Internet speed

  • The download completed is this directory structure

  • You can delete redundant files

  • It is recommended to use the YML configuration file and set the startup port number, which is 8080 by default

  • Writing test interfaces

  • Example Add a Web initiator to the POM

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
Copy the code
  • Test code is as follows:
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class helloWorldController {

    @RequestMapping(value = "test",method = RequestMethod.GET)
    public String hello(a){
        return "hello world!"; }}Copy the code
  • Start-up project:

  • Browser access, success!

1. IDEA construction (recommended method)
  • New project

  • Set the project, not explained, as in the first way

  • Select the components for testing, we only check the Web components, the rest can be selected as needed, or you can import them in Maven

  • Click finish

  • Test success

The road ahead will be long and long, but I will keep searching. If you think I blogger’s writing is good! Writing is not easy, please like, follow, comment to give the blogger a encouragement ~ reprint please indicate the source oh ~