【项目创建流程】普通接口开发
程序员文章站
2022-03-04 13:08:51
...
【项目创建流程】普通接口开发
创建数据库
创建的时候选择utf8mb4 urf8修改了兼容四字节的字符,解决某些汉字出现乱码问题
utf8_general_ci: 校对速度快,但准确度稍差。
utf8_unicode_ci: 准确度高,但校对速度稍慢。
若数据库中有德语、法语或者俄语需求,需使用utf8_unicode_ci。其他情况用utf8_general_ci即可。
建Maven
改POM
写YML
server:
port: 8140 # 服务端口
spring:
profiles:
active: dev # 环境设置
application:
name: service-cms # 服务名
cloud:
nacos:
discovery:
server-addr: localhost:8848 # nacos服务地址
sentinel:
transport:
port: 8081
dashboard: localhost:8080
datasource: # mysql数据库连接
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/guli_cms?serverTimezone=GMT%2B8
username: root
password: 123456
#spring:
jackson: #返回json的全局时间格式
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #mybatis日志
mapper-locations: classpath:cn/jimu98/guli/service/cms/mapper/xml/*.xml
ribbon:
ConnectTimeout: 10000 #连接建立的超时时长,默认1秒
ReadTimeout: 10000 #处理请求的超时时间,默认为1秒
feign:
sentinel:
enabled: true
主启动
@SpringBootApplication
@ComponentScan({"cn.jimu98.guli"})
public class ServiceEduApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceEduApplication.class, args);
}
}
业务类
@CrossOrigin //解决跨域问题
@RestController
@RequestMapping("/admin/edu/teacher")
public class TeacherController {
@Autowired
private TeacherService teacherService;
@GetMapping("list")
public List<Teacher> listAll(){
return teacherService.list();
}
}
代码生成器
项目经理不让用就自己写吧。。。
上一篇: 一篇文章带你了解python中的typing模块和类型注解
下一篇: 知识图谱实例简介
推荐阅读
-
Java开发之普通web项目转为Maven项目的方法
-
Xcode中iOS应用开发的一般项目目录结构和流程简介
-
java在线运行工具(教你创建一个普通的 Java 项目)
-
用Eclipse搭建Android开发环境并创建第一个Android项目(eclipse+android sdk)
-
java在线运行工具(教你创建一个普通的 Java 项目)
-
PHP对接微信公众平台消息接口开发流程教程
-
高效开发:你的项目有接口聚合服务吗?
-
【教程】ThingJS 3D开发快速入门 第一讲 开发概述·优势·项目流程
-
前端项目git操作命名规范和协作开发流程
-
Xcode中iOS应用开发的一般项目目录结构和流程简介