用Marven构建第一个Spring Boot应用
Marven配置文件:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0modelVersion><groupId>boogroupId><artifactId>booartifactId><version>0.0.1-SNAPSHOTversion><packaging>jarpackaging><name>booname><url>http://maven.apache.orgurl><properties><project.build.sourceEncoding>UTF-8project.build.sourceEncoding>properties><parent><groupId>org.springframework.bootgroupId><artifactId>spring-boot-starter-parentartifactId><version>1.3.4.RELEASEversion>parent><dependencies><dependency><groupId>org.springframework.bootgroupId><artifactId>spring-boot-starter-webartifactId>dependency>dependencies>
project>
启动类:
package boo.boo;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;@SpringBootApplication
public class HelloController {@RequestMapping("/hello")@ResponseBodyString home() {return "Hello ,spring boot哈哈!";}public static void main(String[] args) throws Exception {SpringApplication.run(HelloController.class, args);}}
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!