SpringBoot快速搭建笔记
来源:互联网 发布:mac os 10.7 iso下载 编辑:程序博客网 时间:2024/06/04 17:57
SpringBoot快速搭建
1.创建maven项目
2.配置pmo文件,文件内容如下:
<dependencyManagement> <dependencies> <dependency> <!-- Import dependency management from Spring Boot --> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>1.5.1.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies></dependencyManagement> <!-- Add typical dependencies for a web application --> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency></dependencies> <!-- springboot 编译插件 --> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
注:使用dependencyManagement而不是用 parent是因为我的项目是maven模块管理。
3.创建引导入口类。
package com.lcl.springBoot;@SpringBootApplication@ComponentScan(basePackages={"com.lcl.springBoot"})public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); }}
注:@SpringBootApplication等价于@Configuration、@EnableAutoConfiguration、@ComponentScan
4.创建控制层类。
package com.lcl.springBoot.controller;@RestControllerpublic class DemoController { @RequestMapping("index") public String index(){ return "hello,springBoot!"; }}
注:包名引导入口类报名对应。SpringBoot项目的Bean装配默认规则是根据Application类所在的包位置从上往下扫描。“Application类”是指SpringBoot项目入口类。引:http://blog.csdn.net/u014695188/article/details/52263903
5.运行Application类,以java Application方式运行。
6.在浏览器输入:http://localhost:8080/index。显示:hello,springBoot!
0 0
- SpringBoot快速搭建笔记
- SpringBoot12-springboot-springboot快速搭建
- SpringBoot 快速搭建
- springboot快速搭建
- 快速搭建SpringBoot项目
- springBoot快速搭建项目
- 【SpringBoot】2.快速搭建一个SpringBoot应用
- SpringBoot(一):快速搭建一个springboot项目
- 使用SpringBoot快速搭建服务器
- SpringBoot-快速搭建WEB工程
- 使用Springboot快速搭建项目
- 使用idea快速搭建springboot
- springboot快速实战搭建篇
- idea上快速搭建springboot
- springboot (1) 快速搭建简单项目
- 快速搭建一个简单的springboot项目
- SpringBoot入门-快速搭建web服务
- 聊聊SpringBoot | 第一章:快速搭建SpringBoot第一个应用
- python机器学习--01.windows下pip安装numpy、scilik-learn、pandas库
- 包含min函数的栈
- 别人那搞过来date工具mark一下
- 简单控件的一些小知识
- mark2
- SpringBoot快速搭建笔记
- linux文件操作指令
- 学习算法收敛条件的判断
- iptables详解
- Toast使用示例
- java再复习——通过反射获取到方法的参数和返回值的泛型类型
- 419. Battleships in a Board
- xilinx pl330 DMA驱动访问bram
- MySql操作