您的位置:首页 > 编程语言 > Java开发

maven实现springboot-mybatis框架(2)

2017-11-26 00:33 281 查看
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 

运行页面:
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐