mirror of
https://github.com/JeffLi1993/springboot-learning-example.git
synced 2026-03-14 06:03:52 +08:00
文档
This commit is contained in:
76
README.md
76
README.md
@@ -2,20 +2,27 @@
|
||||
spring boot 实践学习案例,是 spring boot 初学者及核心技术巩固的最佳实践。
|
||||
|
||||
# 推荐
|
||||
- [高性能 TCP/UDP 通信框架 HP-Socket](https://github.com/ldcsaa/HP-Socket)
|
||||
- springcloud-learning-example
|
||||
[spring cloud 实践学习案例](https://github.com/JeffLi1993/springcloud-learning-example)<br>
|
||||
https://github.com/JeffLi1993/springcloud-learning-example
|
||||
由于工作原因,我发表原创博客也需要编写的时间。期间很多人私我问题,没有及时得到回复,这里说声抱歉。因此,建一个星球
|
||||
|
||||
「泥瓦匠BYSocket」和朋友们讨论技术相关的话题,你一起来吧?
|
||||
|
||||
[泥瓦匠BYSocket 星球](https://t.zsxq.com/nMzjqbe "泥瓦匠BYSocket")
|
||||
|
||||
[泥瓦匠BYSocket 星球](https://t.zsxq.com/nMzjqbe "泥瓦匠BYSocket")
|
||||
|
||||
[泥瓦匠BYSocket 星球](https://t.zsxq.com/nMzjqbe "泥瓦匠BYSocket")
|
||||
|
||||
这个星球里面讲深入讨论 Java 、Java EE、Spring Boot 等框架技术及工作经验交流,分享一路技术走来的经验、教训。硬实力软实力、择业、职业规划等。
|
||||
|
||||
## 计划
|
||||
Spring Boot 2.0 最大的热点肯定是 Web Flux。我这边也就开始操刀了...
|
||||
|
||||
Web Flux 努力进行中,尽情期待。唯一文章入口:[GitChat文章地址](http://gitbook.cn/gitchat/author/58968d35f2b669527d7a7c57 "gitchat")
|
||||
|
||||
## Spring For All 社区
|
||||
[Spring For All 社区](http://www.spring4all.com/ "spring4all")是新组建的关于 Spring 的纯技术交流社区(涵盖 Spring Boot、Spring Cloud 等内容),集诸多开源爱好者和技术大牛贡献内容和交流问题。我们不夸大、不装逼、做最纯粹的技术分享!!!
|
||||
|
||||
看看我们超强的群众基础,欢迎有兴趣的朋友加入QQ群分享与交流:
|
||||
Spring For All 社区 ⑪ 517395240 <br>
|
||||
Spring For All 社区 ⑫ 498098401 <br>
|
||||
|
||||
博主微信:139-5868-6678
|
||||
看看我们超强的群众基础,欢迎有兴趣的朋友加入QQ群分享与交流:[点击立即加入](http://www.spring4all.com/about "about")
|
||||
|
||||
## 作者与学习乐园
|
||||
源码地址:我的[GitHub地址](https://github.com/JeffLi1993 "GitHub")、[OSCGit地址](https://git.oschina.net/jeff1993/springboot-learning-example "OSCGit")<br>
|
||||
@@ -23,7 +30,6 @@ Spring For All 社区 ⑫ 498098401 <br>
|
||||
关注微信公众号【泥瓦匠BYSokcet】,及时得到技术文章推送<br>
|
||||

|
||||
|
||||
|
||||
## 一、项目结构
|
||||
「Spring Boot 那些事」:[传送门](http://www.bysocket.com/?page_id=1639 "Spring Boot 那些事")<br>
|
||||
|
||||
@@ -74,56 +80,6 @@ Dubbo 服务提供者工程和 Dubbo 服务消费者工程 <br>
|
||||
- spring-data-elasticsearch-query <br>
|
||||
spring-data-elasticsearch - 实战案例详解
|
||||
|
||||
## 二、项目 Quick Start 快速开发指南
|
||||
#### a. 基本环境配置
|
||||
在 MySQL 中,创建数据库 springbootdb:
|
||||
````
|
||||
CREATE DATABASE springbootdb;
|
||||
````
|
||||
创建表 city 城市 (因为我喜欢徒步)
|
||||
````
|
||||
DROP TABLE IF EXISTS `city`;
|
||||
CREATE TABLE `city` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '城市编号',
|
||||
`province_id` int(10) unsigned NOT NULL COMMENT '省份编号',
|
||||
`city_name` varchar(25) DEFAULT NULL COMMENT '城市名称',
|
||||
`description` varchar(25) DEFAULT NULL COMMENT '描述',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||
````
|
||||
插入基础数据
|
||||
````
|
||||
INSERT city VALUES (1 ,1,'温岭市','BYSocket 的家在温岭。');
|
||||
````
|
||||
<br>
|
||||
|
||||
### 《 springboot-mybatis 工程 Quick Start 》
|
||||
首先 check 基本环境配置完成,创建好数据库和表。
|
||||
|
||||
#### 1. 修改数据库配置
|
||||
配置文件地址:springboot-mybatis/src/main/resources/application.properties
|
||||
修改相应的数据源配置,比如账号、密码等
|
||||
|
||||
#### 2. 编译工程
|
||||
在项目根目录 `springboot-learning-example`,运行 maven 指令:
|
||||
````
|
||||
mvn clean install
|
||||
````
|
||||
#### 3. 运行工程
|
||||
右键运行工程包中 `org.spring.springboot.Application` Spring Boot 应用启动类的 main 函数,然后在浏览器访问:
|
||||
`````
|
||||
http://localhost:8080/api/city?cityName=温岭市
|
||||
`````
|
||||
可以看到返回的 JSON 结果:
|
||||
````
|
||||
{
|
||||
"id": 1,
|
||||
"provinceId": 1,
|
||||
"cityName": "温岭市",
|
||||
"description": "我的家在温岭。"
|
||||
}
|
||||
````
|
||||
最后,<br/>
|
||||
|
||||
推荐
|
||||
[《Spring Boot教程与Spring Cloud教程》](https://git.oschina.net/didispace/SpringBoot-Learning "Spring Boot教程与Spring Cloud教程")<br>
|
||||
|
||||
Reference in New Issue
Block a user