新聞中心
這篇文章主要講解了“mybatis是什么”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“mybatis是什么”吧!
界首ssl適用于網(wǎng)站、小程序/APP、API接口等需要進行數(shù)據(jù)傳輸應(yīng)用場景,ssl證書未來市場廣闊!成為創(chuàng)新互聯(lián)建站的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:13518219792(備注:SSL證書合作)期待與您的合作!
1.what's mybatis?
MyBatis 是一款優(yōu)秀的持久層框架,它支持定制化 SQL、存儲過程以及高級映射。MyBatis 避免了幾乎所有的 JDBC 代碼和手動設(shè)置參數(shù)以及獲取結(jié)果集。MyBatis 可以使用簡單的 XML 或注解來配置和映射原生類型、接口和 Java 的 POJO(Plain Old Java Objects,普通老式 Java 對象)為數(shù)據(jù)庫中的記錄。
2.what's mybatis-spring-boot-starter?
MyBatis-Spring-Boot-Starter可幫助您在Spring Boot之上快速構(gòu)建MyBatis應(yīng)用程序。
通過使用此模塊,您將實現(xiàn):
構(gòu)建獨立應(yīng)用程序
將樣板減少到幾乎為零
更少的XML配置
3.how?
pom
org.springframework.boot spring-boot-starter-parent 1.5.22.RELEASE 4.0.0 cn.lianhy springboot-mybatis 1.0-SNAPSHOT springboot-mybatis UTF-8 1.8 1.8 org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test test org.projectlombok lombok true org.mybatis.spring.boot mybatis-spring-boot-starter 1.3.3 MySQL mysql-connector-java runtime com.alibaba druid-spring-boot-starter 1.1.17 com.github.pagehelper pagehelper-spring-boot-starter 1.2.10 com.alibaba fastjson 1.2.58 org.springframework.boot spring-boot-starter-thymeleaf org.springframework.boot spring-boot-maven-plugin
properties
server.port=8070 logging.config=classpath:logback.xml logging.level.cn.lianhy=debug #JDBC 配置(數(shù)據(jù)源) spring.datasource.username=root spring.datasource.password=123456 spring.datasource.url=jdbc:mysql://127.0.0.1:3306/ssm spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.type=com.alibaba.druid.pool.DruidDataSource #連接池配置 spring.datasource.druid.initial-size=1 spring.datasource.druid.max-active=20 spring.datasource.druid.min-idle=1 spring.datasource.druid.max-wait=60000 spring.datasource.druid.time-between-eviction-runs-millis=60000 spring.datasource.druid.min-evictable-idle-time-millis=300000 spring.datasource.druid.test-on-borrow=false spring.datasource.druid.test-on-return=false spring.datasource.druid.test-while-idle=true spring.datasource.druid.pool-prepared-statements=true spring.datasource.druid.max-open-prepared-statements=20 spring.datasource.druid.async-init=true #pagehelper(分頁) pagehelper.helperDialect=mysql pagehelper.reasonable=true pagehelper.supportMethodsArguments=true pagehelper.params=count=countSql #mybatis mybatis.config-location=classpath:sql-map-config.xml mybatis.mapper-locations=classpath:mapper/*.xml # Enable template caching. spring.thymeleaf.cache=false # Check that the templates location exists. spring.thymeleaf.check-template-location=true # Content-Type value. spring.thymeleaf.content-type=text/html # Enable MVC Thymeleaf view resolution. spring.thymeleaf.enabled=true # Template encoding. spring.thymeleaf.encoding=UTF-8 # Comma-separated list of view names that should be excluded from resolution. spring.thymeleaf.excluded-view-names= # Template mode to be applied to templates. See also StandardTemplateModeHandlers. spring.thymeleaf.mode=HTML5 # Prefix that gets prepended to view names when building a URL. spring.thymeleaf.prefix=classpath:/templates/ # Suffix that gets appended to view names when building a URL. spring.thymeleaf.suffix=.html # Whether to check that the template exists before rendering it. spring.thymeleaf.check-template=true
啟動類
package cn.lianhy;import org.mybatis.spring.annotation.MapperScan;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.transaction.annotation.EnableTransactionManagement;/** * Hello world! * */@EnableTransactionManagement@MapperScan(value = "cn.lianhy.*.dao")@SpringBootApplicationpublic class App {public static void main( String[] args ){ SpringApplication.run(App.class,args); } }
感謝各位的閱讀,以上就是“mybatis是什么”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對mybatis是什么這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!
文章名稱:mybatis是什么
轉(zhuǎn)載來源:http://www.ef60e0e.cn/article/jhcpcd.html