• 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 }
  • 相关阅读:
    内存溢出
    接手新业务
    pjb fabu
    中文手册
    人背的时候,做啥都失败
    帮助开发人员学习
    python中的__dict__,__getattr__,__setattr__
    NetCore在Docker中发布及运行
    ELK基础配置
    IdentityServer4 手动验签及日志记录
  • 原文地址:https://www.cnblogs.com/douyamv/p/6606847.html
Copyright © 2020-2023  润新知