Home >Java >javaTutorial >Getting started with spring boot (1)
Create a new maven project and select the artifact id as maven-archetype-quicktype
Create pom, add in project
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.4.RELEASE</version> </parent>
Add in properties
<java.version>1.8</java.version>
Add in dependencies
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
update maven
Create HelloWorldController class
@RestController public class HelloWorldController { @RequestMapping("/hello") public String hello(){ return "Hello World!"; } }
Write startup class APP.java
@SpringBootApplication public class App { public static void main( String[] args ) { System.out.println( "console Hello World!" ); SpringApplication.run(App.class, args); } }
Browse Enter localhost:8080/hello
The above is the detailed content of Getting started with spring boot (1). For more information, please follow other related articles on the PHP Chinese website!