springBoot基本配置
2024-08-25 07:40:00
Spring Boot 基本配置
1、新建maven jar工程 使用依赖
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.pinyougou</groupId> <artifactId>springbootdemo-helloworld</artifactId> <version>0.0.1-SNAPSHOT</version> <!--spring boot 项目必须继承spring boot 父工程 --> <parent> <artifactId>spring-boot-starter-parent</artifactId> <groupId>org.springframework.boot</groupId> <version>1.5.6.RELEASE</version> </parent> <dependencies> <!--使用spring boot 开发web项目的基础依赖 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> </project>
2、新建启动类
package com.springboot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
3、启动效果
4、访问
5、添加controller
package com.springboot.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class HelloController { @RequestMapping("/hello") public String hello() { return "spring boot is so easy to learn!"; } }
6、重新启动
7、访问
最新文章
- j2ee log4j集中式日志解决方案logpool-v0.2
- java IO输入输出流中的各种字节流,字符流类
- angularjs中provider,factory,service的区别和用法
- 20个Linux服务器安全强化建议(三)
- UNIX 和 LINUX
- 跨服务器之间的session共享
- scikit-learn主要模块和基本使用方法
- sencha combobox下拉框不用jsonstore,直接使用字符串数组做数据源
- 修改jsp文件tomcat发布失败(Could not delete May be locked by another process)
- 【NOIP模拟题】【二分】【倍增】【链表】【树规】
- Spring-Junit4
- day20<;IO流>;
- Couchbase忘记登录密码怎么办
- 巧用border效果
- android-UI组件(四):AdapterView及其子类
- 【刷题】UOJ #374 【ZJOI2018】历史
- 从网站上扒网页,保存为file文件格式
- Spring Boot + Spring Cloud 实现权限管理系统 (集成 Shiro 框架)
- 9.12 开课第9天 (JS脚本语音:基础语法、语句)
- CentOS6.5本地yum源配置
热门文章
- 代码编辑器之sublime text插件
- Eclipse创建一个mybatis工程实现连接数据库查询
- 用windows自带的ftp.exe实现断点续传的方法
- JIRA 资源
- [Easyui - Grid]为easyui的datagrid、treegrid增加表头菜单,用于显示或隐藏列
- 《Java并发编程实战》笔记-Happens-Before规则
- 微服务之分布式跟踪系统(springboot+zipkin+mysql)
- Mina2 udp--zhengli
- 学习笔记之C / C++
- PHP中常用的数组函数总结