在正式Spring Boot開始之前,我們先來準備一下環境,並開創建一個Spring MVC專案來回顧一下我們過去的開發與部署流程吧!!。
解壓並於bin目錄下執行startup.bat
TomCat控制臺中文亂碼及IDEA設置為UTF-8
idea Error:Could not create the Java Virtual Machine
<dependencies>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>6.0.12</version>
</dependency>
</dependencies>
<servlet>
<servlet-name>DispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
@RestController
public class HelloController {
@GetMapping(value = "hello")
public String hello(){
return "hello";
}
}