SpringBoot + SSM环境搭建

SpringBoot + SSM环境搭建

springboot整合ssm非常容易,不需要再像普通ssm项目一样配置一大堆xml文件,只需要配置非常少的文件 ,一起来看一看吧

创建maven项目,导入pom文件



    4.0.0

    com.itheima
    springboot_ssm
    1.0-SNAPSHOT
    
    war
    
    
        UTF-8
        1.8
        1.8
    
    
    
        org.springframework.boot
        spring-boot-starter-parent
        2.1.6.RELEASE
    
    
        
        
            org.springframework.boot
            spring-boot-starter-web
            
                
                    org.springframework.boot
                    spring-boot-starter-logging
                
            
        
        
        
            org.springframework.boot
            spring-boot-starter-log4j2
        
        
        
            org.springframework.boot
            spring-boot-starter-jdbc
        
        
        
            com.baomidou
            mybatis-plus-boot-starter
            3.1.2
        
        
        
            mysql
            mysql-connector-java
            5.1.47
        
        
        
            org.springframework.boot
            spring-boot-starter-test
        
    
    
    
        
            
                org.springframework.boot
                spring-boot-maven-plugin
            
        
    

创建yaml文件

logging:
  level:
    cn.itcast: debug                #指定目录的日志级别
    org.springframework: debug      #Spring框架日志级别 debug info warn error fatal
server:
  port: 80

#HikariCP数据源设置
spring:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/saas-export?characterEncoding=utf-8
    username: root
    password: root

#mybatis-plus设置
mybatis-plus:
  mapper-locations: classpath:mapper/*.xml # mapper.xml文件位置,如果没有映射文件,请注释掉

创建启动类

@SpringBootApplication
@MapperScan("com.itheima.mapper")
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

其他文件和SSM一样,这里不做赘述。

你可能感兴趣的:(SpringBoot + SSM环境搭建)