maven实现springboot-mybatis框架(2)
3、配置文件:
application.xml:
# Server settings
#server:
# port:8080
# address:localhost
# DATASOURCE
spring:
datasource:
name: spring
url: jdbc:mysql://localhost:3306/spring
username: root
password: root
# SPRING PROFILES
# HTTP ENCODING
http:
encoding.charset: UTF-8
encoding.enable: true
encoding.force: true
# MyBatis
mybatis:
typeAliasesPackage: my.pojo
mapperLocations: classpath:/mybatis/mappers/*.xml
configLocation: classpath:/mybatis/mybatis-config.xml
# LOGGING
logging:
level:
com.ibatis:DEBUG
log4j.properties:这个就不贴了,资源很多,自行搜索
mybatis-config.xml
UserMapper.xml:
pom.xml:
配置完成。
下图是jsp页面
在入口类Application上,run as java application
运行页面: