1 pom.xml

首先引入两个xml节点

   <!--这里面继承了springboot很多相关依赖-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.6.RELEASE</version>
</parent> <!--web相关依赖-->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>

这两个节点的作用如注释

创建一个控制器 com.superman.springboot.Controller.HelloController

内容如下:

package com.superman.springboot.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; @Controller
public class HelloController {
@ResponseBody
@RequestMapping("/hello")
public String Hello(){
return "hello world";
}
}

注意上述代码中的特性 @Controller @ResponseBody  @RequestMapping

然后要创建一个网站启动的引导类

取名(随意):StartApplication

package com.superman.springboot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication
public class StartApplication {
public static void main(String[] args) {
SpringApplication.run(StartApplication.class,args);
}
}

注意特性 SpringBootApplication 和启动方法SpringApplication.run(StartApplication.class,args);

如果要生成jar包

在pom文件中加入节点

<!--可以将当前项目打成jar包进行运行-->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

就可以生成对应的jar 包 进入jar包所在目录 执行以下dos命令 即可启动程序

1.开始Springboot 基本配置和helloworld的更多相关文章

  1. SpringBoot系统列 1 - HelloWorld!

    学习SpringBoot系统列之HelloWorld! 1.新建一个Maven项目 2.添加POM配置 <parent> <groupId>org.springframewor ...

  2. SpringBoot常用配置简介

    SpringBoot常用配置简介 1. SpringBoot中几个常用的配置的简单介绍 一个简单的Spring.factories # Bootstrap components org.springf ...

  3. Nginx安装配置与HelloWorld

    <深入理解Nginx>阅读与实践(一):Nginx安装配置与HelloWorld 最近在读陶辉的<深入理解Nginx:模块开发与架构解析>,一是想跟着大牛练练阅读和编写开源代码 ...

  4. 在SpringBoot中配置aop

    前言 aop作为spring的一个强大的功能经常被使用,aop的应用场景有很多,但是实际的应用还是需要根据实际的业务来进行实现.这里就以打印日志作为例子,在SpringBoot中配置aop 已经加入我 ...

  5. SpringBoot cache-control 配置静态资源缓存 (以及其中的思考经历)

    昨天在部署项目时遇到一个问题,因为服务要部署到外网使用,中间经过了较多的网络传输限制,而且要加载arcgis等较大的文件,所以在部署后,发现页面loading需要很长时间,而且刷新也要重新从服务器下载 ...

  6. 补习系列(10)-springboot 之配置读取

    目录 简介 一.配置样例 二.如何注入配置 1. 缺省配置文件 2. 使用注解 3. 启动参数 还有.. 三.如何读取配置 @Value 注解 Environment 接口 @Configuratio ...

  7. springboot +redis配置

    springboot +redis配置 pom依赖 <dependency> <groupId>org.springframework.boot</groupId> ...

  8. SpringBoot之配置

    回顾 SpringBoot之基础 配置文件 ① 两种全局配置文件(文件名是固定的) 配置文件放在src/main/resources目录或者类路径/config下 application.proper ...

  9. SpringBoot+Mybatis配置Pagehelper分页插件实现自动分页

    SpringBoot+Mybatis配置Pagehelper分页插件实现自动分页 **SpringBoot+Mybatis使用Pagehelper分页插件自动分页,非常好用,不用在自己去计算和组装了. ...

随机推荐

  1. JS typeof() parseInt() parseFloat()

    判断变量的数据类型:typeof() 使用一元运算符typeof(),可以测试一个变量的类型. typeof()测试的结果是一个类型字符串. typeof()的结果字符串有几种情况: “string” ...

  2. day22_3-json模块

    # 参考资料:# python模块(转自Yuan先生) - 狂奔__蜗牛 - 博客园# https://www.cnblogs.com/guojintao/articles/9070485.html# ...

  3. 如何查找一个命令由哪个rpm安装&&rpm 的相关查询方法

    [root@test-can-nginx src]# which python3 /usr/bin/python3 [root@test-can-nginx src]# rpm -qf /usr/bi ...

  4. DNA repair HDU - 2457 AC自动机+DP

    题意: 给你N个模板串,并且给你一个文本串, 现在问你这个文本串最少需要改变几个字符才能使得它不包含任何模板串. (以上字符只由A,T,G,C构成) 题解: 刚开始做这一题的时候表示很懵逼,好像没有学 ...

  5. JS数组 组团(如何创建数组)var mychar = new Array( )

    组团,并给团取个名(如何创建数组) 使用数组之前首先要创建,而且需要把数组本身赋至一个变量.好比我们出游,要组团,并给团定个名字"云南之旅". 创建数组语法: var myarra ...

  6. 基本包装类型Boolean、Number、String特性及常用方法

    基本包装类型:Boolean.Number.String 一.String 字符串常用方法 1.indexOf()  lastIndexOf()  返回相应字符的索引号 2.slice(index1, ...

  7. react+redux+react-redux练习项目

    一,项目目录 二.1.新建pages包,在pages中新建TodoList.js: 2.新建store包,在store包中新建store.js,reducer.js,actionCreater.js, ...

  8. 4.RDD常用算子之transformations

    RDD Opertions     transformations:create a new dataset from an existing one         RDDA --> RDDB ...

  9. LoadRunner函数的介绍

    LoadRunner函数的介绍 LoadRunner函数 一:通用函数 LoadRunner的通用函数以lr为前缀,可以在任何协议中使用.可以如下分类: 信息相关的函数: lr_error_messa ...

  10. mysql主从跳过错误

    mysql主从复制,经常会遇到错误而导致slave端复制中断,这个时候一般就需要人工干预,跳过错误才能继续 跳过错误有两种方式: 1.跳过指定数量的事务 mysql>stop slave;  m ...