SpringBoot-环境搭建

标签(空格分隔): java,SpringBoot

1.创建Maven工程

2.编写pom文件

  1. <parent>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-parent</artifactId>
  4. <version>2.0.1.RELEASE</version>
  5. </parent>
  6. <dependencies>
  7. <dependency>
  8. <groupId>org.springframework.boot</groupId>
  9. <artifactId>spring-boot-starter-web</artifactId>
  10. </dependency>
  11. <dependency>
  12. <groupId>com.alibaba</groupId>
  13. <artifactId>druid</artifactId>
  14. <version>1.1.6</version>
  15. </dependency>
  16. <dependency>
  17. <groupId>org.projectlombok</groupId>
  18. <artifactId>lombok</artifactId>
  19. <version>1.18.12</version>
  20. </dependency>
  21. </dependencies>

3.编写SpringBoot引导类

  1. package com.itheima;
  2. import org.springframework.boot.SpringApplication;
  3. import org.springframework.boot.autoconfigure.SpringBootApplication;
  4. @SpringBootApplication
  5. public class MySpringBootApplication {
  6. public static void main(String[] args) {
  7. SpringApplication.run(MySpringBootApplication.class, args);
  8. }
  9. }

4.编写Controller

  1. package com.itheima.web;
  2. import org.springframework.beans.factory.annotation.Autowired;
  3. import org.springframework.stereotype.Controller;
  4. import org.springframework.web.bind.annotation.GetMapping;
  5. import org.springframework.web.bind.annotation.ResponseBody;
  6. import javax.sql.DataSource;
  7. @Controller
  8. public class HelloController {
  9. @Autowired
  10. private DataSource dataSource;
  11. @GetMapping("/hello")
  12. @ResponseBody
  13. public String hello() {
  14. return "hello spring boot";
  15. }
  16. }

5.运行测试

6.注意事项

  1. JDK版本配置
  2. Maven仓库配置

# SpringBoot-环境搭建的更多相关文章

  1. spring-boot 环境搭建(一)

    环境 jdk 8 tomcat 8.5 sts 4.4.2 maven 3.6.1 新建 maven 项目 首先创建一个普通的 maven 项目. pom.xml <project xmlns= ...

  2. 1. 开篇-springboot环境搭建

    最初学习strurs2时,虽然觉得也挺好用的,但也有一些不便的地方:1. 模型绑定必须要在Action中声明对应模型的成员变量:2. Action中对外提供调用的接口必须明确注明:3. 要声明一大堆的 ...

  3. Springboot环境搭建_第一个例子

    首先创建一个maven项目 maven项目创建完成之后,找到pom.xml配置节点.需要springboot-starter-web ,springboot-starter-test,springbo ...

  4. 简单的SpringBoot环境搭建

    开始搭建前请确认您的计算机中的Maven已正确配置 一:使用IDEA创建一个Maven项目,图中第一个指针请选择自己正在使用的JDK版本,指针二请打勾,选中指针三所指向的类型并点击Next 二:填写G ...

  5. Spring cloud微服务安全实战-7-11PinPoint+SpringBoot环境搭建

    微服务的最后一个组件, 调用链监控,一个请求进来以后,经过N多个微服务,例如a调用了b.b又调用了c,那么在这个过程中看到,整个的调用的链路,然后每一段调用所耗费的时间,帮你去分析你的系统如果出现瓶颈 ...

  6. Spring cloud微服务安全实战-7-8ELK+SpringBoot环境搭建

    采集不可聚合的离散的.日志信息的e ELK是三个系统的简称 LogStash:用来做日志的收集.过滤.格式转换 Kibana:和普罗米修斯的grafana一个意思.主要用来展示数据. 用docker来 ...

  7. springboot~环境搭建与Helloworld

    转了,非转了 只是项目需要,从.net到java,以后可以学习java的思想把它应用到.net上来,让咱们的.net越来越强大,springbool是一个强大的框架,几乎有了你想要的所有功能模块,大叔 ...

  8. SpringBoot环境搭建

    创建 maven 项目 , 选择的打包类型为 jar 类型 自己构建 SpringBoot 项目时 , 要继承 SpringBoot 的父项目 , 这里用的版本是 2.1.4 点击 Finish , ...

  9. SpringBoot环境搭建及第一个程序运行(详细!)

    spring boot简介 spring boot框架抛弃了繁琐的xml配置过程,采用大量的默认配置简化我们的开发过程. 所以采用Spring boot可以非常容易和快速地创建基于Spring 框架的 ...

  10. 一、springBoot简介与环境搭建

    前言:学习计划 1.springBoot环境搭建 2.springBoot入门 3.srpingBoot整合Mybatis 4.springBoot整合Redis,Redis集群 5.springBo ...

随机推荐

  1. optim.py-使用tensorflow实现一般优化算法

    optim.py Project URL:https://github.com/Codsir/optim.git Based on: tensorflow, numpy, copy, inspect ...

  2. svn和GitHub的使用

    GitHub的工作流程和命令介绍:http://www.runoob.com/w3cnote/git-guide.html svn的基本使用用法:http://www.cnblogs.com/xile ...

  3. tkinter的三种几何布局管理类

    1.pack() 主要采用块的方式组织子组件 如下: import tkinter root=tkinter.Tk() #创建窗口对象 label=tkinter.Label(root,text='h ...

  4. Electron 初识-搭建一个简易桌面应用

    Electron ​ 快速入门 简介 Electron 可以让你使用纯 JavaScript 调用丰富的原生 APIs 来创造桌面应用.你可以把它看作是专注于桌面应用而不是 web 服务器的,io.j ...

  5. mmdetection源码剖析(1)--NMS

    mmdetection源码剖析(1)--NMS 熟悉目标检测的应该都清楚NMS是什么算法,但是如果我们要与C++和cuda结合直接写成Pytorch的操作你们清楚怎么写吗?最近在看mmdetectio ...

  6. Spring Boot注解大全,一键收藏了!

    本文首发于微信公众号[猿灯塔],转载引用请说明出处 今天是猿灯塔“365天原创计划”第5天. 今天呢!灯塔君跟大家讲: Spring Boot注解大全 一.注解(annotations)列表 @Spr ...

  7. 冷知识:达夫设备(Duff's Device)效率真的很高吗?

    ID:技术让梦想更伟大 作者:李肖遥 wechat链接:https://mp.weixin.qq.com/s/b1jQDH22hk9lhdC9nDqI6w 相信大家写业务逻辑的时候,都是面向if.el ...

  8. td文字溢出显示省略号

    昨天遇到移动端表格td中文字溢出问题,写了溢出隐藏样式,居然没起作用! { overflow:hidden;//溢出隐藏 white-space:nowrap;//文字不换行 text-overflo ...

  9. Vue中computed的本质及与methods的区别

    一.computed的本质? computed为什么不像methods一样加小括号使用? 正常使用computed方式 运行结果 至于为什么computed为什么不像methods一样使用小括号调用, ...

  10. postman-7-前置请求脚本

    前面讲了,tests初如何校验请求之后返回值是否正确 那前置脚本,就是处理,请求之前接口该如何处理,什么时候会用到呢? 比如:接口字段time,需要填入时间,而且这个是需要当前时间的,: 需要达到自动 ...