• 办公自动化项目从无到有-第一篇项目搭建


    1.新建一个springboot项目

     1.1 maven依赖如图如下所示

    <?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    	<groupId>cn.gson</groupId>
    	<artifactId>oasys</artifactId>
    	<version>0.0.1-SNAPSHOT</version>
    	<packaging>jar</packaging>
    	<name>oasys</name>
    	<description>Demo project for Spring Boot</description>
    	<parent>
    		<groupId>org.springframework.boot</groupId>
    		<artifactId>spring-boot-starter-parent</artifactId>
    		<version>1.5.6.RELEASE</version>
    		<relativePath /> <!-- lookup parent from repository -->
    	</parent>
    	<properties>
    		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    		<java.version>1.8</java.version>
    	</properties>
    	<dependencies>
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-data-jpa</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-freemarker</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>eu.bitwalker</groupId>
    			<artifactId>UserAgentUtils</artifactId>
    			<version>1.20</version>
    		</dependency>
    		<!-- 导入Jpinyin;汉字转拼音的包 -->
    		<dependency>
    			<groupId>com.github.stuxuhai</groupId>
    			<artifactId>jpinyin</artifactId>
    			<version>1.1.8</version>
    		</dependency>
    		<!-- 发送邮件插件 -->
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-mail</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.mybatis.spring.boot</groupId>
    			<artifactId>mybatis-spring-boot-starter</artifactId>
    			<version>1.3.0</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-web</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>mysql</groupId>
    			<artifactId>mysql-connector-java</artifactId>
    			<version>8.0.16</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-test</artifactId>
    			<scope>test</scope>
    		</dependency>
    		<!--分页插件 -->
    		<dependency>
    			<groupId>com.github.pagehelper</groupId>
    			<artifactId>pagehelper-spring-boot-starter</artifactId>
    			<version>1.0.0</version>
    		</dependency>
    		<dependency>
    			<groupId>com.squareup.retrofit2</groupId>
    			<artifactId>converter-gson</artifactId>
    			<version>2.3.0</version>
    		</dependency>
    		<!-- 导入fastjson -->
    		<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
    		<dependency>
    			<groupId>com.alibaba</groupId>
    			<artifactId>fastjson</artifactId>
    			<version>1.2.36</version>
    		</dependency>
    		<dependency>
    			<groupId>org.hibernate</groupId>
    			<artifactId>hibernate-jpamodelgen</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>commons-fileupload</groupId>
    			<artifactId>commons-fileupload</artifactId>
    			<version>1.3.2</version>
    		</dependency>
    		<dependency>
    			<groupId>commons-io</groupId>
    			<artifactId>commons-io</artifactId>
    			<version>2.5</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-devtools</artifactId>
    			<optional>true</optional>
    		</dependency>
    	</dependencies>
    	<build>
    		<plugins>
    			<plugin>
    				<groupId>org.springframework.boot</groupId>
    				<artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <!-- 如果不设置fork,那么不会restart,devtools热部署不会起作用-->
                        <fork>true</fork>
                    </configuration>
    				<!--热加载 -->
    				<dependencies>
    					<dependency>
    						<groupId>org.springframework</groupId>
    						<artifactId>springloaded</artifactId>
    						<version>1.2.7.RELEASE</version>
    					</dependency>
    				</dependencies>
    			</plugin>
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-javadoc-plugin</artifactId>
    				<version>3.0.0</version>
    			</plugin>
    		</plugins>
    	</build>
    </project>
    

    1.2  项目的配置文件

    #端口
    server.port=8088
    #数据库配置 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/oasys?useSSL=false&serverTimezone=Hongkong&characterEncoding=utf-8& autoReconnect=true spring.datasource.username=root spring.datasource.password=123456 #some file convert spring.http.multipart.enabled=true #write into cache spring.http.multipart.file-size-threshold=5MB #max file size spring.http.multipart.max-file-size=500MB #many file upload maxsize at one time spring.http.multipart.max-request-size=200MB # analysize request spring.http.multipart.resolve-lazily=false
    # mybatis mybatis.mapper-locations=classpath*:/mappers/*.xml mybatis.type-aliases-package=cn.gson.oasys.model.entity

    1.3 项目功能结构图

     

     

  • 相关阅读:
    这款开源测试神器,圆了我玩游戏不用动手的梦想
    在spring容器中对中间件bean进行替换
    java agent调试
    linux查看进程的打开文件数
    Ubuntu 下的 Git 在 SSH 协议下使用代理
    GO语言程序查询数据库字段为空遇到的几个问题总结
    Vue3学习(十)之 页面、菜单、路由的使用
    寻找写代码感觉(十)之SpringBootAOP的使用
    寻找写代码感觉(九)之SpringBoot拦截器的使用
    寻找写代码感觉(八)之SpringBoot过滤器的使用
  • 原文地址:https://www.cnblogs.com/cainame/p/11712694.html
Copyright © 2020-2023  润新知