很多大佬都已经写过了关于Spring boot 打包发布的博客,之前做项目的时候使用spring boot进行开发,碰到很多问题这里就写一个让自己回顾一下。
我这里是用idea 创建的spring boot项目
创建spring boot项目选择这个后Next就可以了
下一步后这个位置可以选择你用的爽的项目管理,我这里用的是maven,直接下一步。
做的一个预备项目,先实现功能,这里就只用了这几个依赖。这样一个spring boot的项目就搭好了。
进入后整个界面就是这样的,进来后先先写一个小Demo运行一下,运行成功就证码项目搭建好了,之后再配置application.yml文件,本来是.properties,为了看起来好看一些,这里就改成了.yml文件,已经配置
server:
port: 9090
tomcat:
accesslog:
request-attributes-enabled: true
spring:
datasource:
data-username: flowmarket
url: jdbc:mysql://localhost:3306/flowmarket?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false
username: miaoyue
password: mysqlmiaoyue
driver-class-name: com.mysql.jdbc.Driver
#静态文件配置 这东西是在做图片上传到本地服务器后无法通过url访问配置的一个地址映射
mvc:
static-path-pattern: /**
resources:
static-locations: classpath:/META-INF/resources/,classpath:/resources/,\
classpath:/static/,classpath:/public/,file:${web.upload-path}
web.upload-path: /var/apps/userimg/
#分页工具配置 高端大气上档次的工具 好吧主要是我用起来爽
pagehelper:
helper-dialect: mysql
support-methods-arguments: true
params: countSql
reasonable: false
#mybatis 映射配置
mybatis:
mapper-locations: classpath:mapper/*.xml