java框架-Springboot3-数据访问

整合SSM

  • Spring
  • SpringMVC
  • Mybatis

整合步骤


<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0modelVersion>
    <parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>3.1.4version>
        <relativePath/> 
    parent>
    <groupId>com.examplegroupId>
    <artifactId>boot3-06-ssmartifactId>
    <version>0.0.1-SNAPSHOTversion>
    <name>boot3-06-ssmname>
    <description>boot3-06-ssmdescription>
    <properties>
        <java.version>17java.version>
    properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-webartifactId>
        dependency>
        <dependency>
            <groupId>org.mybatis.spring.bootgroupId>
            <artifactId>mybatis-spring-boot-starterartifactId>
            <version>3.0.2version>
        dependency>

        <dependency>
            <groupId>com.mysqlgroupId>
            <artifactId>mysql-connector-jartifactId>
            <scope>runtimescope>
        dependency>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-testartifactId>
            <scope>testscope>
        dependency>
        <dependency>
            <groupId>org.mybatis.spring.bootgroupId>
            <artifactId>mybatis-spring-boot-starter-testartifactId>
            <version>3.0.2version>
            <scope>testscope>
        dependency>
    dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.bootgroupId>
                <artifactId>spring-boot-maven-pluginartifactId>
            plugin>
        plugins>
    build>

project>

java框架-Springboot3-数据访问_第1张图片
java框架-Springboot3-数据访问_第2张图片

java框架-Springboot3-数据访问_第3张图片

java框架-Springboot3-数据访问_第4张图片

总结

java框架-Springboot3-数据访问_第5张图片

原理

java框架-Springboot3-数据访问_第6张图片
java框架-Springboot3-数据访问_第7张图片

java框架-Springboot3-数据访问_第8张图片

TODO 扩展其他数据源

你可能感兴趣的:(java,开发语言)