Springboot入门
Posted 豆芽的博客
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Springboot入门相关的知识,希望对你有一定的参考价值。
pom.xml
1 <?xml version="1.0" encoding="UTF-8"?> 2 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4 <modelVersion>4.0.0</modelVersion> 5 6 <groupId>douya</groupId> 7 <artifactId>Blog_SpringBoot</artifactId> 8 <version>0.0.1-SNAPSHOT</version> 9 <packaging>jar</packaging> 10 11 <name>spring-web-demo</name> 12 <description>Demo project for Spring WebMvc</description> 13 14 <parent> 15 <groupId>org.springframework.boot</groupId> 16 <artifactId>spring-boot-starter-parent</artifactId> 17 <version>1.3.5.RELEASE</version> 18 <relativePath/> 19 </parent> 20 21 <properties> 22 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 23 <java.version>1.8</java.version> 24 </properties> 25 26 <dependencies> 27 <dependency> 28 <groupId>org.springframework.boot</groupId> 29 <artifactId>spring-boot-starter-web</artifactId> 30 <!-- spring-boot-starter:核心模块,包括自动配置支持、日志和YAML --> 31 </dependency> 32 </dependencies> 33 34 <build> 35 <plugins> 36 <plugin> 37 <groupId>org.springframework.boot</groupId> 38 <artifactId>spring-boot-maven-plugin</artifactId> 39 </plugin> 40 </plugins> 41 </build> 42 43 44 </project>
src/main/java/a/
1 package a; 2 3 import org.springframework.boot.SpringApplication; 4 import org.springframework.boot.autoconfigure.SpringBootApplication; 5 import org.springframework.web.bind.annotation.RequestMapping; 6 import org.springframework.web.bind.annotation.RestController; 7 8 @SpringBootApplication 9 @RestController 10 public class Application { 11 12 @RequestMapping("/") 13 public String greeting() { 14 return "Hello World2!"; 15 } 16 17 @RequestMapping("/p") 18 public String greeting2() { 19 return "Hello World pp2!"; 20 } 21 @RequestMapping("/h") 22 public String greeting3() { 23 return "Hello World pp2!"; 24 } 25 26 public static void main(String[] args) { 27 SpringApplication.run(Application.class, args); 28 } 29 }
以上是关于Springboot入门的主要内容,如果未能解决你的问题,请参考以下文章
全栈编程系列SpringBoot整合Shiro(含KickoutSessionControlFilter并发在线人数控制以及不生效问题配置启动异常No SecurityManager...)(代码片段
SpringBoot中表单提交报错“Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported“(代码片段