SpringDemo - mantoskez/mantas-wiki GitHub Wiki

  1. We open Intelij.
  2. Create a new project choosing Spring Boot initializer (double check if we have in there the right release of the JDK)
  3. Next window, we do not mark anything, just go further.
  4. There, Spring creates pom.xml file for us. (we need to do some adds to it)
  5. // Import to be able to write @RequestMapping further down // Requires import via Maven (pom.xml) import org.springframework.web.bind.annotation.RequestMapping; RestController (and @RestController below) to get the content of our methods directly to the browser. // What happens if you delete @RestController below ...? What error message do you get? import org.springframework.web.bind.annotation.RestController;
  6. When you start the program, you can have to go to the following pages in your browser:

http://127.0.0.1:8080/ http://127.0.0.1:8080/undersida

  1. Open your terminal (Ubuntu, git-bash or Terminal on OSX) and try using the curl program. You may need to run apt install curl in Ubuntu or homebrew install curl on OSX).