今天就跟大家聊聊有关在SpringBoot中使用mybatis如何实现一个应用访问功能,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。一,Pom文件<?xml v
今天就跟大家聊聊有关在SpringBoot中使用mybatis如何实现一个应用访问功能,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
一,Pom文件
<?xml version="1.0" encoding="UTF-8"?><project xmlns="Http://Maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>example</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> //这里设置为jar,因为我们会使用jar包部署运行 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.2.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-WEB</artifactId> </dependency> <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis --> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> //Mybatis的jar包 <version>1.1.1</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> //JSON数据格式和对象的转换jar包 <version>1.9.8</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>com.h3Database</groupId> //内嵌数据库 <artifactId>h3</artifactId> <version>1.3.156</version> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> //lombok插件,方便model对象的处理 <version>1.16.2</version> </dependency> <!-- https://mvnrepository.com/artifact/mysql/Mysql-connector-java --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> //mysql驱动 <version>5.1.18</version> </dependency> </dependencies> <build> <finalName>example</finalName> //打包后的jar包名称 <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> //必须要的SpringBoot继承的maven插件,缺少了无法打包jar。 <executions> <execution> <Goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-resources-plugin</artifactId> //因为jar包中可能存在很多其他的配置资源,例如mapper文件所以打包为jar包需要将其加入,所以需要此资源打包插件 <version>2.5</version> <executions> <execution> <id>copy-xmls</id> <phase>process-sources</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target/classes</outputDirectory> <resources> <resource> <directory>${basedir}/src/main/java</directory> <includes> <include>***.properties</include> <include>***.tld</include> </includes> <filtering>false</filtering> </resource> <resource> <directory>src/main/java</directory> <includes> <include>***.xml</include> <include>**/*.tld</include> </includes> <filtering>false</filtering> </resource> </resources> </build> <repositories>//设置仓库 <repository> <id>spring-milestone</id> <url>http://repo.spring.io/libs-release</url> </repository> </repositories></project>
--结束END--
本文标题: 在SpringBoot中使用MyBatis如何实现一个应用访问功能
本文链接: https://lsjlt.com/news/226179.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0