package com.wjh.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//请求处理类
@RestController
public class HelloController {
@RequestMapping("/hello")
public String hello(){
System.out.println("Hello word!");
return "Hello word!";
}
}
"C:\Program Files\Java\jdk-11.0.15.1\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\lib\idea_rt.jar=54854:D:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\bin" -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath D:\JavaWeb2023\java_web_project\spring-boot-starter-web\target\classes;D:\develop\apache-maven-3.6.1\mvn_repo\org\springframework\boot\spring-boot-starter-web\2.7.4\spring-boot-starter-web-2.7.4.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\springframework\boot\spring-boot-starter\2.7.4\spring-boot-starter-2.7.4.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\springframework\boot\spring-boot\2.7.4\spring-boot-2.7.4.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\springframework\boot\spring-boot-autoconfigure\2.7.4\spring-boot-autoconfigure-2.7.4.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\springframework\boot\spring-boot-starter-logging\2.7.4\spring-boot-starter-logging-2.7.4.jar;D:\develop\apache-maven-3.6.1\mvn_repo\ch\qos\logback\logback-classic\1.2.11\logback-classic-1.2.11.jar;D:\develop\apache-maven-3.6.1\mvn_repo\ch\qos\logback\logback-core\1.2.11\logback-core-1.2.11.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\apache\logging\log4j\log4j-to-slf4j\2.17.2\log4j-to-slf4j-2.17.2.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\apache\logging\log4j\log4j-api\2.17.2\log4j-api-2.17.2.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar;D:\develop\apache-maven-3.6.1\mvn_repo\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\yaml\snakeyaml\1.30\snakeyaml-1.30.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\springframework\boot\spring-boot-starter-json\2.7.4\spring-boot-starter-json-2.7.4.jar;D:\develop\apache-maven-3.6.1\mvn_repo\com\fasterxml\jackson\core\jackson-databind\2.13.4\jackson-databind-2.13.4.jar;D:\develop\apache-maven-3.6.1\mvn_repo\com\fasterxml\jackson\core\jackson-annotations\2.13.4\jackson-annotations-2.13.4.jar;D:\develop\apache-maven-3.6.1\mvn_repo\com\fasterxml\jackson\core\jackson-core\2.13.4\jackson-core-2.13.4.jar;D:\develop\apache-maven-3.6.1\mvn_repo\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.4\jackson-datatype-jdk8-2.13.4.jar;D:\develop\apache-maven-3.6.1\mvn_repo\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.4\jackson-datatype-jsr310-2.13.4.jar;D:\develop\apache-maven-3.6.1\mvn_repo\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.4\jackson-module-parameter-names-2.13.4.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\springframework\boot\spring-boot-starter-tomcat\2.7.4\spring-boot-starter-tomcat-2.7.4.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\apache\tomcat\embed\tomcat-embed-core\9.0.65\tomcat-embed-core-9.0.65.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\apache\tomcat\embed\tomcat-embed-el\9.0.65\tomcat-embed-el-9.0.65.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.65\tomcat-embed-websocket-9.0.65.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\springframework\spring-web\5.3.23\spring-web-5.3.23.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\springframework\spring-beans\5.3.23\spring-beans-5.3.23.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\springframework\spring-webmvc\5.3.23\spring-webmvc-5.3.23.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\springframework\spring-aop\5.3.23\spring-aop-5.3.23.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\springframework\spring-context\5.3.23\spring-context-5.3.23.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\springframework\spring-expression\5.3.23\spring-expression-5.3.23.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\springframework\spring-core\5.3.23\spring-core-5.3.23.jar;D:\develop\apache-maven-3.6.1\mvn_repo\org\springframework\spring-jcl\5.3.23\spring-jcl-5.3.23.jar com.wjh.SpringBootStarterWebApplication
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.4)
2023-09-15 22:36:20.566 INFO 18656 --- [ main] com.wjh.SpringBootStarterWebApplication : Starting SpringBootStarterWebApplication using Java 11.0.15.1 on wangjunhua with PID 18656 (D:\JavaWeb2023\java_web_project\spring-boot-starter-web\target\classes started by 18231 in D:\JavaWeb2023\java_web_project)
2023-09-15 22:36:20.571 INFO 18656 --- [ main] com.wjh.SpringBootStarterWebApplication : No active profile set, falling back to 1 default profile: "default"
2023-09-15 22:36:21.805 INFO 18656 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2023-09-15 22:36:21.817 INFO 18656 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2023-09-15 22:36:21.818 INFO 18656 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.65]
2023-09-15 22:36:21.958 INFO 18656 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2023-09-15 22:36:21.959 INFO 18656 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1313 ms
2023-09-15 22:36:22.982 INFO 18656 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2023-09-15 22:36:23.018 INFO 18656 --- [ main] com.wjh.SpringBootStarterWebApplication : Started SpringBootStarterWebApplication in 3.153 seconds (JVM running for 6.077)
2023-09-15 22:37:07.040 INFO 18656 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2023-09-15 22:37:07.041 INFO 18656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2023-09-15 22:37:07.042 INFO 18656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
Hello word!
Hello word!
1 requests
172 B transferred
11 B resources
Finish: 4 ms
DOMContentLoaded: 13 ms
Request URL:
http://localhost:8080/hello
Request Method:
GET
Status Code:
200 OK
Remote Address:
[::1]:8080
Referrer Policy:
strict-origin-when-cross-origin
Connection:
keep-alive
Content-Length:
11
Content-Type:
text/html;charset=UTF-8
Date:
Fri, 15 Sep 2023 14:43:04 GMT
Keep-Alive:
timeout=60
GET /hello HTTP/1.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7
Cache-Control: max-age=0
Connection: keep-alive
Host: localhost:8080
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
sec-ch-ua: "Google Chrome";v="117", "Not;A=Brand";v="8", "Chromium";v="117"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
面试题:☆☆☆
GET请求方式和POST请求方式的区别???
请求方式-GET: 请求参数在请求行中,没有请求体,如:/brand/findAll?name=OPPO&status=1。GET请求大小是有限制的。
请求方式-POST: 请求参数在请求体中,POST请求大小是没有限制的。
Tomcat官网https://tomcat.apache.org/
官方提供的starter起步依赖https://docs.spring.io/spring-boot/docs/2.7.4/reference/htmlsingle/#using.build-systems.starters