您好,欢迎来到爱够旅游网。
搜索
您的当前位置:首页Springboot与Vue使用脚手架的整合,迈出Java全栈第一步

Springboot与Vue使用脚手架的整合,迈出Java全栈第一步

来源:爱够旅游网

这里是视频的演示(没有对时间格式进行处理):

springboot整合VueCli项目

一、编写springboot项目代码:

 因为主要是实现springboot和Vue-Cli项目进行的整合,所以仅仅是单表crud;

1.1创建项目就省略了

  • 项目目录结构图:

1.2 编写配置文件:

  • pom.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <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.0</modelVersion>
       <parent>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-parent</artifactId>
           <version>2.4.1</version>
           <relativePath/> <!-- lookup parent from repository -->
       </parent>
       <groupId>com.liu</groupId>
       <artifactId>springboot_cli</artifactId>
       <version>0.0.1-SNAPSHOT</version>
       <name>springboot_cli</name>
       <description>Demo project for Spring Boot</description>
    
       <properties>
           <java.version>1.8</java.version>
       </properties>
    
       <dependencies>
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-web</artifactId>
           </dependency>
    
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-devtools</artifactId>
               <scope>runtime</scope>
               <optional>true</optional>
           </dependency>
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-test</artifactId>
               <scope>test</scope>
           </dependency>
    
           <!--引入MySQL数据库驱动-->
           <dependency>
               <groupId>mysql</groupId>
               <artifactId>mysql-connector-java</artifactId>
           </dependency>
           <!--mybatis-->
           <dependency>
               <groupId>org.mybatis.spring.boot</groupId>
               <artifactId>mybatis-spring-boot-starter</artifactId>
               <version>2.1.1</version>
           </dependency>
           <!--druid数据源-->
           <dependency>
               <groupId>com.alibaba</groupId>
               <artifactId>druid</artifactId>
               <version>1.1.21</version>
           </dependency>
       </dependencies>
    
       <build>
           <plugins>
               <plugin>
                   <groupId>org.springframework.boot</groupId>
                   <artifactId>spring-boot-maven-plugin</artifactId>
               </plugin>
           </plugins>
       </build>
    
    </project>
    
    
  • application.yaml (yaml看起来美观,所以用它写配置)
    spring:
      datasource:
        username: root
        password: root
        #在地址后面加上时区,以及编码设置
        url: jdbc:mysql://localhost:3306/vue?serverTimezone=UTC&useUncode=true&setcharacterEncoding=utf-8
        driver-class-name: com.mysql.cj.jdbc.Driver
        #用于用的

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- igbc.cn 版权所有 湘ICP备2023023988号-5

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务