2016-12-13 11 views
-4

Springブートを使用して簡単なWebアプリケーションを開発中です。 以下のコードを見つけてください。SPRINGブートを使用したシンプルなWebアプリケーションの開発

import org.springframework.web.bind.annotation.RestController; 
import org.springframework.web.bind.annotation.RequestMapping; 

@RestController 
public class HelloApplication { 

    @RequestMapping("/") 
    public String index() { 
     return "Greetings from Spring Boot!"; 
    } 

} 

私が実行しようとしています、私は..

として実行で...実行するためのオプションを取得しておりませんスクリーンショットを見つけてくださいenter image description here

+0

実行形式で実行...?オプションとしてRun as ...オプションが必要です:spring boot app、このメニューを上から入力しているのか、アプリケーションの中のあるファイルを右クリックしていますか? – viruskimera

答えて

0

あなたのクラスには、次のようになります。

@Controller 
@SpringBootApplication 
public class SampleController { 

    public static void main(String[] args) { 
     SpringApplication.run(SampleController.class, args); 
    } 

    @RequestMapping 
    @ResponseBody 
    String home() { 
     return "hello world"; 
    } 
} 
関連する問題