栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

springboot常用配置

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

springboot常用配置

springboot常用设置 1.pom.xml


    4.0.0
    
        org.springframework.boot
        spring-boot-starter-parent
        2.5.6
         
    
    com.xxx
    implents
    0.0.1-SNAPSHOT
    implents
    Demo project for Spring Boot
    
        1.8
        
        true
    
    
        
            org.springframework.boot
            spring-boot-starter
        

        
            org.projectlombok
            lombok
            true
        

        
            org.springframework.boot
            spring-boot-starter-test
            test
        

        
        
            io.springfox
            springfox-swagger2
            2.9.2
        
        
            io.springfox
            springfox-swagger-ui
            2.9.2
        


        
            org.springframework.boot
            spring-boot-starter-web

            
                
                    org.springframework.boot
                    spring-boot-starter-logging
                
            
        
        
        
            org.springframework.boot
            spring-boot-starter-log4j2
        

        
        
            org.jsoup
            jsoup
            RELEASE
        

        
        
            com.alibaba
            fastjson
            RELEASE
        


        
            org.apache.commons
            commons-lang3
           3.3.2
        


        
            org.seleniumhq.selenium
            selenium-java
        



        
            org.mybatis.spring.boot
            mybatis-spring-boot-starter
            2.1.3
        

        
            mysql
            mysql-connector-java
        


        
        
            org.springframework.boot
            spring-boot-starter-test
            test
        
        
            junit
            junit
        

        
        
            com.github.pagehelper
            pagehelper-spring-boot-starter
            1.3.0
        

        
            org.springframework.boot
            spring-boot-starter-thymeleaf
        


    

    

        zy
        
            
                org.springframework.boot
                spring-boot-maven-plugin
                
                    
                        
                            org.projectlombok
                            lombok
                        
                    
                
            
        
    



2.log4j2.xml



    
        demo
        logs
        30 MB
    

    
        
        
            
            
            
            
        

        
        
            
            
                
                
            
            
                
                
                
            
            
            
        

        
        
            
            
                
                
            
            
                
                
            
            
            
        
    

    
        
        
        
            
            
            
        

        
        
        

    


3.application.yml
spring:
  datasource: #修改数据库连接配置
    url: jdbc:mysql://localhost/ziyuan?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
    driver-class-name: com.mysql.cj.jdbc.Driver
    username: 123456
    password: 123456
  web:
    resources:
      static-locations: classpath:/static,classpath:/public,classpath:/resources,classpath:/meta-INF/resources,classpath:/static/img

# mybatis配置
mybatis:
  type-aliases-package: com.xxx.implents.domain # 别名目录


# pagehelper
pagehelper:
  helperDialect: mysql
  reasonable: true
  supportMethodsArguments: true
  params: count=countSql
server:
  port: 8082
4.测试
import org.junit.Test;
import org.junit.runner.RunWith;
@SpringBootTest
@RunWith(SpringJUnit4ClassRunner.class)
public class BaiDuSearchControllerTest {

    @Autowired
    BaiDuSearchController baiDuSearchController;
    @Test
    public void test(){
        //测试代码
    }
}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/531882.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号