Springboot框架:框架搭建

SpringBoot 框架搭建



  • IDEA下载安装
  • 构建与配置
    • 引入 SpringBoot模块:新建初始化项目 Spring Initializr,点击 next(此处要是出现 read time out报错信息,可以试试手机热点,亲测有效 ),修改 Group等相关信息,点击 next,点击加入相关的模块:webThtmeleafJPAMySQLAspectsDevTools,点击 finish创建项目完成。
    • application.yml配置,使用 thymeleaf 3:在 pom.xml文件中添加:
      <properties>
              <thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
              <thymeleaf-layout-dialect.version>2.1.1</thymeleaf-layout-dialect.version>
          </properties>
    • application.yml文件中添加:
      spring:
        thymeleaf:
          mode: HTML
    • 数据库连接配置:
      spring:
        datasource:
          driver-class-name: com.mysql.jdbc.Driver
          url: jdbc:mysql://localhost:3306/blog?useUnicode=true&characterEncoding=utf-8
          username: root
          password: root
    • jpa配置:
      spring:
          jpa:
              hibernate:
                ddl-auto: update
              show-sql: true
    • 日志配置:
      logging:
        level:
          root: info
          com.skgxsn: debug
        file: log/blog.log

猜你喜欢

转载自www.cnblogs.com/skygrass0531/p/12519470.html