W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
To finish our application, we need to create a single Java file. By default, Maven compiles sources from src/main/java
, so you need to create that folder structure and then add a file named src/main/java/Example.java
to contain the following code:
為了完成應用程序, 需要創(chuàng)建一個Java文件。 默認情況下, Maven從src/main/java
(目錄)下編譯源碼, 因此需要創(chuàng)建那文件夾結構,然后添加一個名叫src/main/java/Example.java
的文件, 文件內(nèi)容包含如下代碼:
import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.web.bind.annotation.*;
@RestController
@EnableAutoConfiguration
public class Example {
@RequestMapping("/")
String home() {
return "Hello World!";
}
public static void main(String[] args) throws Exception {
SpringApplication.run(Example.class, args);
}
}
Although there is not much code here, quite a lot is going on. We step through the important parts in the next few sections. 盡管這兒沒有太多代碼, 但是很多代碼在進行中。 在接下來的幾節(jié)中,我們將逐步了解重要的部分。
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: