Springboot整合SSM框架

Application.yml配置文件:

spring:
  mvc:
    view:
      prefix: /WEB-INF/
      suffix: .jsp
  datasource:
      url: jdbc:mysql:///pojo?useUnicode=true&characterEncoding=utf8
      username: root
      password: 123
      driverClassName: com.mysql.jdbc.Driver
      type: com.alibaba.druid.pool.DruidDataSource
mybatis:
  mapper-locations: classpath:mapper/*.xml
  type-aliases-package: com.wgh.pro1.sbssmzh.demo.domain

Pom.xml配置文件:



    4.0.0
    
        org.springframework.boot
        spring-boot-starter-parent
        2.1.1.RELEASE
         
    
    com.wgh.pro1
    sbssmzh
    0.0.1-SNAPSHOT
    sbssmzh
    Demo project for Spring Boot

    
        1.8
    

    
        
            org.springframework.boot
            spring-boot-starter-web
        
        
        
            org.mybatis.spring.boot
            mybatis-spring-boot-starter
            1.3.2
        
        
        
            mysql
            mysql-connector-java
            5.1.38
        
        
        
            org.projectlombok
            lombok
            true
        
        
            org.springframework.boot
            spring-boot-starter-test
            test
        
        
        
            com.alibaba
            druid
            1.1.10
        
        
        
            org.apache.tomcat.embed
            tomcat-embed-jasper
        
        
        
            javax.servlet
            javax.servlet-api
        
        
        
            javax.servlet.jsp
            javax.servlet.jsp-api
            2.3.1
        
        
        
            javax.servlet
            jstl
        
    

    
        
            
                org.springframework.boot
                spring-boot-maven-plugin
            
        
        
        
            
            
                src/main/java
                
                    **/*.xml
                
            
            
                sac/main/resources
                
                    **/*.*
                
            
            
            
                src/main/webapp
                META-INF/resources
                
                    **/*.*
                
            
        
    



目录结构:
Springboot整合SSM框架_第1张图片
Springboot整合SSM框架_第2张图片 Springboot整合SSM框架_第3张图片
主类(开启类):

package com.wgh.pro1.sbssmzh;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
//扫描mapper包下的mapper接口
@MapperScan("com.wgh.pro1.sbssmzh.demo.mapper")
public class SbssmzhApplication {
    public static void main(String[] args) {
        SpringApplication.run(SbssmzhApplication.class, args);
    }
}

你可能感兴趣的:(Springboot整合SSM框架)