[英]Spring Boot embedded Tomcat server not starting in intellij idea
[英]How can I display a spring boot "test" on the browser and run the Tomcat server on IntelliJ IDEA when I used @GetMapping?
我不知道會發生什么。 我運行 ApplicationTests 以查看 Tomcat 服務器是否在端口 8080 啟動。當我檢查運行時顯示此消息“C:\Program Files\Java\jdk-17\bin\java.exe... 進程結束並退出代碼 0” 。
我想在瀏覽器上顯示 spring 啟動“測試”。 當我在瀏覽器中鍵入 localhost:8080 時,此消息顯示“HTTP Status 404 – Not Found Type Status Report Description The origin server did not find a current representation for the target resource or is not willing to dispose that one exists. Apache Tomcat/9.0 .62"
我正在使用 IntelliJ IDEA 社區。 我很好奇為什么 Tomcat 沒有在我的 IDE 上啟動? 我缺少什么? 我怎么解決這個問題?
這是我的依賴項
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
運行測試不會啟動服務器並為您提供請求。 您需要從 IDE 運行 spring 應用程序 main class 或者如果您使用 maven 那么您可以在終端中使用命令
mvn spring-boot:run
下面是一些文章,您可以參考這些文章開始使用簡單的 spring 啟動應用程序。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.