ARTICLE DETAIL

资讯详情

深耕编程入门与网站建设的一线实战洞察。

第1章:环境搭建与ElementUI-01-环境搭建

第1章:环境搭建与ElementUI-01-环境搭建 目录第1章 项目概述和环境搭建1. 项目概述1.1 项目介绍1.2 项目展示1.3 技术架构1.4 功能架构1.5 软件开发流程2. 环境搭建2.1 项目结构2.2 maven项目搭建2.2.1 health_parent2.2.2 health_common2.2.5 health_interface2.2.6 health_service_provider2.2.7 health_backend第1章 项目概述和环境搭建1. 项目概述1.1 项目介绍随着国家对医疗健康政策的调整越来越多的新兴健康管理机构涌现大批的创业者和传统医疗公司纷纷加入健康管理机构的业务不能快速的成型投入产出不成比例等问题逐渐浮现。而健康管理系统应运而生能够充分解决这些问题。1.2 项目展示运行项目展示项目完整功能。1.3 技术架构1.4 功能架构1.5 软件开发流程软件开发一般会经历如下几个阶段整个过程是顺序展开所以通常称为瀑布模型。2. 环境搭建2.1 项目结构本项目采用maven分模块开发方式即对整个项目拆分为几个maven工程每个maven工程存放特定的一类代码具体如下health_parent父工程打包方式为pom同时聚合其他子模块便于统一执行maven命令health_common通用模块打包方式为jar 存放项目中使用到的一些工具类、实体类、返回结果和常量类health_interface打包方式为jar存放服务接口health_service_providerDubbo服务模块打包方式为war存放服务实现类、Dao接口、Mapper映射文件等作为服务提供方需要部署到tomcat运行health_backend健康管理后台打包方式为war作为Dubbo服务消费方存放Controller、HTML页面、js、css、SpringBoot配置文件等需要部署到tomcat运行health_mobile移动端前台打包方式为war作为Dubbo服务消费方存放Controller、HTML页面、js、css、SpringBoot配置文件等需要部署到tomcat运行2.2 maven项目搭建通过前面的项目功能架构图可以知道本项目分为健康管理后台和健康管理前台微信端2.2.1 health_parent创建health_parent父工程打包方式为pom用于统一管理依赖版本选择的SpringBoot版本可以在创建完成后在pom文件中更改版本号。pom.xml?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd modelVersion4.0.0/modelVersion groupIdcom.liusp/groupId artifactIdhealth_parent/artifactId version0.0.1-SNAPSHOT/version namehealth_parent/name !--设置为pom父工程-- packagingpom/packaging descriptionDemo project for Spring Boot/description !--子项目聚合-- modules modulehealth_common/module modulehealth_interface/module modulehealth_backend/module modulehealth_mobile/module modulehealth_service_provider/module modulespring_security_demo/module /modules /project2.2.2 health_common创建health_common子工程打包方式为jar存放通用组件例如工具类、实体类等选择的SpringBoot版本可以在创建完成后在pom文件中更改版本号。选哪个版本可以在工程创建完成后修改版本号pom.xml?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd parent groupIdcom.liusp/groupId artifactIdhealth_parent/artifactId version0.0.1-SNAPSHOT/version !--relativePath/ lt;!ndash; lookup parent from repository ndash;gt;-- /parent modelVersion4.0.0/modelVersion groupIdcom.liusp/groupId artifactIdhealth_common/artifactId version0.0.1-SNAPSHOT/version namehealth_common/name packagingjar/packaging descriptionDemo project for Spring Boot/description properties java.version1.8/java.version /properties dependencies dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-web/artifactId version2.3.7.RELEASE/version /dependency dependency groupIdorg.apache.poi/groupId artifactIdpoi/artifactId version3.14/version /dependency dependency groupIdcom.qiniu/groupId artifactIdqiniu-java-sdk/artifactId version7.7.0/version /dependency dependency groupIdorg.apache.poi/groupId artifactIdpoi-ooxml/artifactId version3.14/version /dependency !--阿里云短信-- dependency groupIdcom.aliyun/groupId artifactIdaliyun-java-sdk-core/artifactId version3.3.1/version /dependency dependency groupIdcom.aliyun/groupId artifactIdaliyun-java-sdk-dysmsapi/artifactId version1.0.0/version /dependency !--腾讯云短信-- dependency groupIdcom.tencentcloudapi/groupId artifactIdtencentcloud-sdk-java/artifactId version3.1.62/version!-- 注这里只是示例版本号请获取并替换为 最新的版本号 -- /dependency !--freemarker-- dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-freemarker/artifactId version2.3.7.RELEASE/version /dependency dependency groupIdcom.lowagie/groupId artifactIditext/artifactId version2.1.7/version /dependency !--jasperreports报表生成工具-- dependency groupIdnet.sf.jasperreports/groupId artifactIdjasperreports/artifactId version6.8.0/version !--排除itext,jar读取-- exclusions exclusion groupIdcom.lowagie/groupId artifactIditext/artifactId /exclusion /exclusions /dependency !--文件上传-- dependency groupIdcommons-codec/groupId artifactIdcommons-codec/artifactId version1.10/version /dependency /dependencies build plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId version3.8.1/version configuration source1.8/source target1.8/target encodingUTF-8/encoding /configuration /plugin /plugins /build /project2.2.5 health_interface创建health_interface子工程打包方式为jar存放服务接口pom.xml?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd modelVersion4.0.0/modelVersion parent groupIdcom.liusp/groupId artifactIdhealth_parent/artifactId version0.0.1-SNAPSHOT/version !--relativePath/ lt;!ndash; lookup parent from repository ndash;gt;-- /parent groupIdcom.liusp/groupId artifactIdhealth_interface/artifactId version0.0.1-SNAPSHOT/version namehealth_interface/name packagingjar/packaging descriptionDemo project for Spring Boot/description properties java.version1.8/java.version /properties dependencies dependency groupIdcom.liusp/groupId artifactIdhealth_common/artifactId version0.0.1-SNAPSHOT/version /dependency /dependencies build plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId version3.8.1/version configuration source1.8/source target1.8/target encodingUTF-8/encoding /configuration /plugin /plugins /build /project2.2.6 health_service_provider创建health_service_provider子工程打包方式为war作为服务单独部署存放服务类、Dao接口和Mapper映射文件等选择的SpringBoot版本可以在创建完成后在pom文件中更改版本号。pom.xml?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd parent groupIdcom.liusp/groupId artifactIdhealth_parent/artifactId version0.0.1-SNAPSHOT/version !--relativePath/ lt;!ndash; lookup parent from repository ndash;gt;-- /parent modelVersion4.0.0/modelVersion groupIdcom.liusp/groupId artifactIdhealth_service_provider/artifactId version0.0.1-SNAPSHOT/version packagingwar/packaging namehealth_service_provider/name descriptionDemo project for Spring Boot/description properties java.version1.8/java.version project.build.sourceEncodingUTF-8/project.build.sourceEncoding project.reporting.outputEncodingUTF-8/project.reporting.outputEncoding spring-boot.version2.3.7.RELEASE/spring-boot.version /properties dependencies dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-web/artifactId /dependency dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-tomcat/artifactId scopeprovided/scope /dependency dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-test/artifactId scopetest/scope exclusions exclusion groupIdorg.junit.vintage/groupId artifactIdjunit-vintage-engine/artifactId /exclusion /exclusions /dependency !--MyBatis依赖-- !--mysql-- dependency groupIdmysql/groupId artifactIdmysql-connector-java/artifactId !--加了scope会导致application.yml文件报红但不影响操作可加可不加不加application.yml文件不会报红-- !--scoperuntime/scope-- version5.1.49/version /dependency !--mybatis-- dependency groupIdorg.mybatis.spring.boot/groupId artifactIdmybatis-spring-boot-starter/artifactId version2.1.3/version /dependency !--阿里数据源-- !-- https://mvnrepository.com/artifact/com.alibaba/druid -- dependency groupIdcom.alibaba/groupId artifactIddruid/artifactId version1.2.6/version /dependency !-- druid使用log4j记录日志切换为slf4j -- dependency groupIdorg.slf4j/groupId artifactIdlog4j-over-slf4j/artifactId version1.7.25/version /dependency !--Dubbo集成SpringBoot起步依赖-- dependency groupIdcom.alibaba.spring.boot/groupId artifactIddubbo-spring-boot-starter/artifactId version2.0.0/version /dependency !--zkclient zookeeper客户端-- dependency groupIdcom.101tec/groupId artifactIdzkclient/artifactId version0.10/version /dependency dependency groupIdcom.liusp/groupId artifactIdhealth_interface/artifactId version0.0.1-SNAPSHOT/version /dependency !--分页插件-- dependency groupIdcom.github.pagehelper/groupId artifactIdpagehelper-spring-boot-starter/artifactId version1.2.5/version /dependency !-- 引入redis-- dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-data-redis/artifactId /dependency /dependencies dependencyManagement dependencies dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-dependencies/artifactId version${spring-boot.version}/version typepom/type scopeimport/scope /dependency /dependencies /dependencyManagement build plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId version3.8.1/version configuration source1.8/source target1.8/target encodingUTF-8/encoding /configuration /plugin plugin groupIdorg.springframework.boot/groupId artifactIdspring-boot-maven-plugin/artifactId version2.3.7.RELEASE/version configuration mainClasscom.liusp.HealthServiceProviderApplication/mainClass /configuration executions execution idrepackage/id goals goalrepackage/goal /goals /execution /executions /plugin /plugins /build /projectapplication.yml# 应用名称 server: port: 81 spring: datasource: username: root password: root url: jdbc:mysql://localhost:3306/health?characterEncodingUTF-8 driver-class-name: com.mysql.jdbc.Driver type: com.alibaba.druid.pool.DruidDataSource #数据源其他配置 initialSize: 5 minIdle: 5 maxActive: 20 maxWait: 60000 timeBetweenEvictionRunsMillis: 60000 minEvictableIdleTimeMillis: 300000 validationQuery: SELECT 1 FROM DUAL testWhileIdle: true testOnBorrow: false testOnReturn: false poolPreparedStatements: true #配置监控统计拦截的filters去掉后监控界面sql无法统计wall用于防火墙 filters: stat,wall,log4j maxPoolPreparedStatementPerConnectionSize: 20 useGlobalDataSourceStat: true connectionProperties: druid.stat.mergeSqltrue;druid.stat.slowSqlMillis500 jackson: date-format: yyyy-MM-dd time-zone: GMT8 #redis配置 redis: host: 127.0.0.1 freemarker: # 模板后缀名 suffix: .ftl # 文档类型 content-type: text/html # 页面编码 charset: UTF-8 # 页面缓存 cache: false # 模板路径 template-loader-path: classpath:/templates/ #freemarker文件输出地址 out_put_path: D:/IdeaProjects9/health_parent/health_mobile/src/main/resources/static/pages mybatis: # 指定全局配置文件位置 config-location: classpath:mybatis/mybatis-config.xml # 指定sql映射文件位置 mapper-locations: classpath:mybatis/mapper/*.xml type-aliases-package: com.liusp.pojo,com.liusp.entity #dubbo dubbo: #设置服务器应用名称 application: name: health_service_provider #指定注册中心 registry: address: zookeeper://127.0.0.1:2181 #指定通讯协议和端口,指定暴露服务的端口如果不指定默认为20880 protocol: port: 20888 name: dubbo #添加monitor监控 monitor: registry #分页插件配置 pagehelper: helper-dialect: mysql reasonable: true support-methods-arguments: true params: countcounSql #显示日志 logging: level: com.liusp: debug在src\main\resources\ 目录下新建mybatis目录并创建mybatis-config.xml文件?xml version1.0 encodingUTF-8 ? !DOCTYPE configuration PUBLIC -//mybatis.org//DTD Config 3.0//EN http://mybatis.org/dtd/mybatis-3-config.dtd configuration settings !--设置myBatis全局配置采用驼峰命名法 -- setting namemapUnderscoreToCamelCase valuetrue/ /settings /configuration创建项目的web.xml文件2.2.7 health_backend创建health_backend子工程打包方式为war单独部署存放Controller、页面等选择的SpringBoot版本可以在创建完成后在pom文件中更改版本号。pom.xml?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd parent groupIdcom.liusp/groupId artifactIdhealth_parent/artifactId version0.0.1-SNAPSHOT/version !--relativePath/ lt;!ndash; lookup parent from repository ndash;gt;-- /parent modelVersion4.0.0/modelVersion groupIdcom.liusp/groupId artifactIdhealth_backend/artifactId version0.0.1-SNAPSHOT/version packagingwar/packaging namehealth_backend/name descriptionDemo project for Spring Boot/description properties java.version1.8/java.version project.build.sourceEncodingUTF-8/project.build.sourceEncoding project.reporting.outputEncodingUTF-8/project.reporting.outputEncoding spring-boot.version2.3.7.RELEASE/spring-boot.version /properties dependencies dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-web/artifactId /dependency dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-tomcat/artifactId scopeprovided/scope /dependency dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-test/artifactId scopetest/scope exclusions exclusion groupIdorg.junit.vintage/groupId artifactIdjunit-vintage-engine/artifactId /exclusion /exclusions /dependency !--Dubbo集成SpringBoot起步依赖-- dependency groupIdcom.alibaba.spring.boot/groupId artifactIddubbo-spring-boot-starter/artifactId version2.0.0/version /dependency !--zkclient zookeeper客户端-- dependency groupIdcom.101tec/groupId artifactIdzkclient/artifactId version0.10/version /dependency dependency groupIdcom.liusp/groupId artifactIdhealth_interface/artifactId version0.0.1-SNAPSHOT/version /dependency !-- 引入redis-- dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-data-redis/artifactId /dependency !--文件上传-- dependency groupIdcommons-fileupload/groupId artifactIdcommons-fileupload/artifactId version1.3.3/version /dependency /dependencies dependencyManagement dependencies dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-dependencies/artifactId version${spring-boot.version}/version typepom/type scopeimport/scope /dependency /dependencies /dependencyManagement build plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId version3.8.1/version configuration source1.8/source target1.8/target encodingUTF-8/encoding /configuration /plugin plugin groupIdorg.springframework.boot/groupId artifactIdspring-boot-maven-plugin/artifactId version2.3.7.RELEASE/version configuration mainClasscom.liusp.HealthBackendApplication/mainClass /configuration executions execution idrepackage/id goals goalrepackage/goal /goals /execution /executions /plugin /plugins /build /projectapplication.ymlserver: port: 82 #dubbo dubbo: #设置服务器应用名称 application: name: health_backend #指定注册中心 registry: address: zookeeper://127.0.0.1:2181 #超时全局设置 10分钟 #checkfalse 不检查服务提供方开发阶段建议设置为false #checktrue 启动时检查服务提供方如果服务提供方没有启动则报错 consumer: timeout: 600000 check: false spring: redis: host: 127.0.0.1 #文件上传 servlet: multipart: enabled: true max-file-size: 10MB max-request-size: 100MB #设置日期格式 jackson: date-format: yyyy-MM-dd time-zone: GMT8创建项目的web.xml文件
返回列表