In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what is mybatis". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is mybatis".
1.what's mybatis?
MyBatis is an excellent persistence layer framework that supports customized SQL, stored procedures, and advanced mapping. MyBatis avoids almost all JDBC code and manually setting parameters and getting result sets. MyBatis can use simple XML or annotations to configure and map native types, interfaces, and Java's POJO (Plain Old Java Objects, plain old Java objects) to records in the database.
2.what's mybatis-spring-boot-starter?
MyBatis-Spring-Boot-Starter helps you quickly build MyBatis applications on top of Spring Boot.
By using this module, you will implement:
Build stand-alone applications
Reduce the template to almost zero
Less XML configuration
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=8070logging.config=classpath:logback.xmllogging.level.cn.lianhy=debug#JDBC configuration (data source) spring.datasource.username=rootspring.datasource.password=123456spring.datasource.url=jdbc:mysql://127.0.0.1:3306/ssmspring.datasource.driver-class-name=com.mysql.jdbc.Driverspring.datasource.type=com.alibaba.druid.pool.DruidDataSource# connection pool configuration spring.datasource.druid.initial-size=1spring.datasource.druid.max-active=20spring.datasource.druid.min-idle=1spring.datasource.druid.max-wait=60000spring.datasource .druid.time-between-eviction-runs-millis=60000spring.datasource.druid.min-evictable-idle-time-millis=300000spring.datasource.druid.test-on-borrow=falsespring.datasource.druid.test-on-return=falsespring.datasource.druid.test-while-idle=truespring.datasource.druid.pool-prepared-statements=truespring.datasource.druid.max-open-prepared-statements=20spring.datasource.druid.async-init=true#pagehelper (paging) pagehelper.helperDialect=mysqlpagehelper.reasonable=truepagehelper.supportMethodsArguments=truepagehelper.params=count=countSql#mybatismybatis.config-location=classpath:sql-map-config.xmlmybatis.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
Startup class
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) }} Thank you for your reading, the above is the content of "what is mybatis". After the study of this article, I believe you have a deeper understanding of what mybatis is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.