mybatis mysql 图片_使用SpringBoot+MyBatis+MySQL实现图片上传

一、技术参数:

SpringBoot 1.15.6.RELEASE

MyBatis-SpringBoot 1.3.2

MySQL 5.1.30

数据库连接池:druid

Maven 3.5.9

项目pom文件:

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0

fileupload

demo

0.0.1-SNAPSHOT

jar

demo

Demo project for Spring Boot

org.springframework.boot

spring-boot-starter-parent

1.5.16.RELEASE

UTF-8

UTF-8

1.8

org.springframework.boot

spring-boot-starter-jdbc

org.springframework.boot

spring-boot-starter-thymeleaf

org.springframework.boot

spring-boot-starter-web

org.mybatis.spring.boot

mybatis-spring-boot-starter

1.3.2

mysql

mysql-connector-java

5.1.30

org.springframework.boot

spring-boot-starter-test

test

com.alibaba

druid

1.0.11

com.fasterxml.jackson.core

jackson-core

com.fasterxml.jackson.core

jackson-databind

com.fasterxml.jackson.datatype

jackson-datatype-joda

com.fasterxml.jackson.module

jackson-module-parameter-names

com.github.pagehelper

pagehelper-spring-boot-starter

1.1.2

com.alibaba

druid-spring-boot-starter

1.1.0

com.google.guava

guava

20.0

org.apache.commons

commons-lang3

3.5

commons-collections

commons-collections

3.2.1

org.springframework.boot

spring-boot-maven-plugin

org.mybatis.generator

mybatis-generator-maven-plugin

1.3.2

${basedir}/src/main/resources/generatorConfig.xml

true

true

二、项目配置文件application.yml

server:

port: 8086

#FreeMarker

pring:

freemarker:

allow-request-override: false

cache: false

check-template-location: true

charset: UTF-8

content-type: text/html

expose-request-attributes: false

expose-session-attributes: false

expose-spring-macro-helpers: false

suffix: .ftl

spring:

datasource:

name: test

url: jdbc:mysql://127.0.0.1:3306/springBootDemo

username: root

password: root

# 使用druid数据源

type: com.alibaba.druid.pool.DruidDataSource

driver-class-name: com.mysql.jdbc.Driver

filters: stat

maxActive: 20

initialSize: 1

maxWait: 60000

minIdle: 1

timeBetweenEvictionRunsMillis: 60000

minEvictableIdleTimeMillis: 300000

validationQuery: select 'x'

testWhileIdle: true

testOnBorrow: false

testOnReturn: false

poolPreparedStatements: true

maxOpenPreparedStatements: 20

mybatis:

mapper-locations: classpath:mapping/*.xml

type-aliases-package: com.winter.model

#pagehelper分页插件

pagehelper:

helperDialect: mysql

reasonable: true

supportMethodsArguments: true

params: count=countSql

##上传图片保存的路径

#img:

# location: /Downloads/imgUpload/

#配置上传文件的最大值

servlet:

multipart:

max-file-size: 5Mb

max-request-size: 50Mb

#自定义文件上传路径

web:

upload-path: /Downloads/imgUpload/

三、项目说明

1、项目默认将图片上传到本地路径,如果需要上传到服务器路径直接在项目中进行修改即可,不要忘了修改存储到数据库中的路径。

2、项目没有使用任何图片上传控件或插件,原生springBoot实现,简单易上手。

3、项目使用Maven进行构建,朋友们在导入项目时不要导错了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值