打开原教程视频
注:本人是编程小白,这个是我第一个尝试的项目,编写该系列博客是为了记录第一次做项目的经历,其中肯定会有不少不成熟的操作甚至错误之处,如果可以,希望大神指出,谢谢大家。

资料准备

点击获取
获取码:afnm
该链接如果失效了可以自行到原教程视频地址寻找。

数据库搭建

该项目一共需要创建22张表,但在资料中没有创建表格的sql语句,但其中还是提供了比较便捷的方法。

1、打开资料找到并安装PowerDesigner(项目设计工具),点击查看安装教程

2、打开软件,然后打开file–>open–>SSM众筹项目资料\ssm项目\atcrowdfunding课件\docs\代码

3、右击 PhysicalDataModel_1,打开properties

4、点击Preview就可以查看创建所有表的sql语句了。

5、复制语句创建数据库和表

IDEA环境搭建

下图是原资料中的各个系统模块之间的继承和依赖关系,我们可以看到项目之间的关系不仅乱而且关系模糊,刚开始本来想重新自己设计,但由于能力有限同时自己是第一次做项目,担心设计不好导致后期出错,也就放弃了。


1、打开idea创建项目模块。

在创建不同模块时,虽然设计里面有继承关系,但我在创建时所有项目都将parent设置为none,并在后期再进行添加。

2、添加依赖
common模块

<parent><artifactId>CrowdFunding-parent</artifactId><groupId>com.bin.CrowdFunding-parent</groupId><version>1.0-SNAPSHOT</version><relativePath>../CrowdFunding-parent/pom.xml</relativePath></parent>
<dependencies><dependency><groupId>com.bin.CrowdFunding</groupId><artifactId>CrowdFunding-bean</artifactId><version>1.0-SNAPSHOT</version></dependency>

main模块

<parent><artifactId>CrowdFunding-parent</artifactId><groupId>com.bin.CrowdFunding-parent</groupId><version>1.0-SNAPSHOT</version><relativePath>../CrowdFunding-parent/pom.xml</relativePath></parent><dependencies><dependency><groupId>com.bin.CrowdFunding</groupId><artifactId>CrowdFunding-manager-impl</artifactId><version>1.0-SNAPSHOT</version></dependency><dependency><groupId>com.bin.CrowdFunding</groupId><artifactId>CrowdFunding-potal-impl</artifactId><version>1.0-SNAPSHOT</version></dependency>

manager-api

 <dependencies><dependency><groupId>com.bin.CrowdFunding</groupId><artifactId>CrowdFunding-common</artifactId><version>1.0-SNAPSHOT</version></dependency><dependency><groupId>com.bin.CrowdFunding</groupId><artifactId>CrowdFunding-bean</artifactId><version>1.0-SNAPSHOT</version></dependency></dependencies>

manager-impl

 <parent><artifactId>CrowdFunding-parent</artifactId><groupId>com.bin.CrowdFunding-parent</groupId><version>1.0-SNAPSHOT</version><relativePath>../CrowdFunding-parent/pom.xml</relativePath></parent><dependencies><dependency><groupId>com.bin.CrowdFunding</groupId><artifactId>CrowdFunding-manager-api</artifactId><version>1.0-SNAPSHOT</version></dependency><dependency><groupId>com.bin.CrowdFunding</groupId><artifactId>CrowdFunding-common</artifactId><version>1.0-SNAPSHOT</version></dependency></dependencies>

parent

<modules><module>../CrowdFunding-bean</module><module>../CrowdFunding-common</module><module>../CrowdFunding-main</module><module>../CrowdFunding-manager-api</module><module>../CrowdFunding-manager-impl</module><module>../CrowdFunding-potal-api</module><module>../CrowdFunding-potal-impl</module></modules>

potal-api

 <dependencies><dependency><groupId>com.bin.CrowdFunding</groupId><artifactId>CrowdFunding-bean</artifactId><version>1.0-SNAPSHOT</version></dependency><dependency><groupId>com.bin.CrowdFunding</groupId><artifactId>CrowdFunding-common</artifactId><version>1.0-SNAPSHOT</version></dependency></dependencies>

potal-impl

<parent><artifactId>CrowdFunding-parent</artifactId><groupId>com.bin.CrowdFunding-parent</groupId><version>1.0-SNAPSHOT</version><relativePath>../CrowdFunding-parent/pom.xml</relativePath></parent><dependencies><dependency><groupId>com.bin.CrowdFunding</groupId><artifactId>CrowdFunding-common</artifactId><version>1.0-SNAPSHOT</version></dependency><dependency><groupId>com.bin.CrowdFunding</groupId><artifactId>CrowdFunding-potal-api</artifactId><version>1.0-SNAPSHOT</version></dependency></dependencies>

到此依赖添加完毕,需要注意的是还需要按照资料添加模块的打包类型
如:parent

添加api包依赖和配置文件

由项目设计可以看到几乎所有项目依赖于common,而common由继承自parent,所以只需要在parent和common模块添加依赖即可。

parent的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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.bin.CrowdFunding-parent</groupId><artifactId>CrowdFunding-parent</artifactId><version>1.0-SNAPSHOT</version><packaging>pom</packaging><modules><module>../CrowdFunding-bean</module><module>../CrowdFunding-common</module><module>../CrowdFunding-main</module><module>../CrowdFunding-manager-api</module><module>../CrowdFunding-manager-impl</module><module>../CrowdFunding-potal-api</module><module>../CrowdFunding-potal-impl</module></modules><dependencyManagement><dependencies><dependency><groupId>javax.servlet</groupId><artifactId>servlet-api</artifactId><version>2.5</version><scope>provided</scope><!-- 注意!!!! --></dependency><dependency><groupId>javax.servlet.jsp</groupId><artifactId>jsp-api</artifactId><version>2.1.3-b06</version><scope>provided</scope><!-- 注意!!!! --></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>4.0.0.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>4.0.0.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>4.0.0.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-orm</artifactId><version>4.0.0.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-web</artifactId><version>4.0.0.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>4.0.0.RELEASE</version></dependency><dependency><groupId>com.mchange</groupId><artifactId>c3p0</artifactId><version>0.9.2</version></dependency><dependency><groupId>cglib</groupId><artifactId>cglib</artifactId><version>2.2</version></dependency><dependency><groupId>org.aspectj</groupId><artifactId>aspectjweaver</artifactId><version>1.6.8</version></dependency><!-- Spring整合MyBatis --><!-- MyBatis中延迟加载需要使用Cglib --><!-- https://mvnrepository.com/artifact/org.mybatis/mybatis --><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId><version>3.2.8</version></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId><version>1.2.2</version></dependency><!-- 控制日志输出:结合log4j --><dependency><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.17</version></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>1.7.7</version></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId><version>1.7.7</version></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>5.1.47</version></dependency><dependency><groupId>jstl</groupId><artifactId>jstl</artifactId><version>1.2</version></dependency><!-- ********其他****************************** --><!-- Ehcache二级缓存 --><dependency><groupId>net.sf.ehcache</groupId><artifactId>ehcache</artifactId><version>1.6.2</version></dependency><!-- 石英调度 - 开始 --><dependency><groupId>org.quartz-scheduler</groupId><artifactId>quartz</artifactId><version>1.8.5</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId><version>4.0.0.RELEASE</version></dependency><dependency><groupId>commons-collections</groupId><artifactId>commons-collections</artifactId><version>3.1</version></dependency><!-- 石英调度 - 结束 --><dependency><groupId>org.codehaus.jackson</groupId><artifactId>jackson-mapper-asl</artifactId><version>1.9.2</version></dependency><dependency><groupId>org.apache.poi</groupId><artifactId>poi</artifactId><version>3.9</version></dependency><dependency><groupId>org.jfree</groupId><artifactId>jfreechart</artifactId><version>1.0.19</version></dependency><dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupload</artifactId><version>1.3.1</version></dependency><dependency><groupId>org.freemarker</groupId><artifactId>freemarker</artifactId><version>2.3.19</version></dependency><dependency><groupId>org.activiti</groupId><artifactId>activiti-engine</artifactId><version>5.15.1</version></dependency><dependency><groupId>org.activiti</groupId><artifactId>activiti-spring</artifactId><version>5.15.1</version></dependency><dependency><groupId>org.apache.commons</groupId><artifactId>commons-email</artifactId><version>1.3.1</version></dependency><dependency><groupId>org.activiti</groupId><artifactId>activiti-explorer</artifactId><version>5.15.1</version><exclusions><exclusion><artifactId>groovy-all</artifactId><groupId>org.codehaus.groovy</groupId></exclusion></exclusions></dependency></dependencies></dependencyManagement>
</project>

common的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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.bin.CrowdFunding</groupId><artifactId>CrowdFunding-common</artifactId><version>1.0-SNAPSHOT</version><packaging>jar</packaging><parent><artifactId>CrowdFunding-parent</artifactId><groupId>com.bin.CrowdFunding-parent</groupId><version>1.0-SNAPSHOT</version><relativePath>../CrowdFunding-parent/pom.xml</relativePath></parent>
<dependencies><dependency><groupId>com.bin.CrowdFunding</groupId><artifactId>CrowdFunding-bean</artifactId><version>1.0-SNAPSHOT</version></dependency><dependency><groupId>javax.servlet</groupId><artifactId>servlet-api</artifactId><scope>provided</scope><!-- 注意!!!! --></dependency><dependency><groupId>javax.servlet.jsp</groupId><artifactId>jsp-api</artifactId><scope>provided</scope><!-- 注意!!!! --></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-orm</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-web</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId></dependency><dependency><groupId>com.mchange</groupId><artifactId>c3p0</artifactId></dependency><dependency><groupId>cglib</groupId><artifactId>cglib</artifactId></dependency><dependency><groupId>org.aspectj</groupId><artifactId>aspectjweaver</artifactId></dependency><!-- Spring整合MyBatis --><!-- MyBatis中延迟加载需要使用Cglib --><!-- https://mvnrepository.com/artifact/org.mybatis/mybatis --><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId></dependency><!-- 控制日志输出:结合log4j --><dependency><groupId>log4j</groupId><artifactId>log4j</artifactId></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId></dependency><dependency><groupId>jstl</groupId><artifactId>jstl</artifactId></dependency><!-- ********其他****************************** --><!-- Ehcache二级缓存 --><dependency><groupId>net.sf.ehcache</groupId><artifactId>ehcache</artifactId></dependency><!-- 石英调度 - 开始 --><dependency><groupId>org.quartz-scheduler</groupId><artifactId>quartz</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId></dependency><dependency><groupId>commons-collections</groupId><artifactId>commons-collections</artifactId></dependency><!-- 石英调度 - 结束 --><dependency><groupId>org.codehaus.jackson</groupId><artifactId>jackson-mapper-asl</artifactId></dependency><dependency><groupId>org.apache.poi</groupId><artifactId>poi</artifactId></dependency><dependency><groupId>org.jfree</groupId><artifactId>jfreechart</artifactId></dependency><dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupload</artifactId></dependency><dependency><groupId>org.freemarker</groupId><artifactId>freemarker</artifactId></dependency><dependency><groupId>org.activiti</groupId><artifactId>activiti-engine</artifactId></dependency><dependency><groupId>org.activiti</groupId><artifactId>activiti-spring</artifactId></dependency><dependency><groupId>org.apache.commons</groupId><artifactId>commons-email</artifactId></dependency><dependency><groupId>org.activiti</groupId><artifactId>activiti-explorer</artifactId><exclusions><exclusion><artifactId>groovy-all</artifactId><groupId>org.codehaus.groovy</groupId></exclusion></exclusions></dependency>
</dependencies>
</project>

另外在资料中找到对应的配置文件,并添加当自己创建的对应项目中。


web.xml设计

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://java.sun.com/xml/ns/javaee"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"id="WebApp_ID" version="2.5"><display-name>Archetype Created Web Application</display-name><context-param><param-name>contextConfigLocation</param-name><param-value>classpath*:spring/spring-*.xml</param-value></context-param><!-- 监听器监听servletContext的创建和销毁如果监听到servletContext创建(服务器启动),就会创建ioc容器如果监听到销毁(服务器停止),就会销毁ioc容器创建Spring框架的ioc容器将ioc容器对象放到application域--><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><!-- 字符编码过滤器只负责解决post请求的乱码问题--><filter><filter-name>encoding</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name><param-value>UTF-8</param-value></init-param><init-param><param-name>forceEncoding</param-name><param-value>true</param-value></init-param></filter><filter-mapping><filter-name>encoding</filter-name><url-pattern>/*</url-pattern><!-- 添加服务器内部请求转发过滤<dispatcher>FORWARD</dispatcher><dispatcher>REQUEST</dispatcher>--></filter-mapping><!--支持RESTFUL风格,将post请求转换为put和delete请求会读取隐含参数:“_method”--><filter><filter-name>HiddenHttpMethodFilter</filter-name><filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class></filter><filter-mapping><filter-name>HiddenHttpMethodFilter</filter-name><servlet-name>dispatcherServlet</servlet-name></filter-mapping><servlet><servlet-name>dispatcherServlet</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><init-param><param-name>contextConfigLocation</param-name><param-value>classpath:springMVC/springmvc-context.xml</param-value></init-param><!-- servlet的生命周期
1.加载和实例化2.初始化3.请求处理4.服务终止--><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>dispatcherServlet</servlet-name><!-- 扩展匹配--><url-pattern>*.htm</url-pattern><url-pattern>*.do</url-pattern><!-- 路径匹配<url-pattern>/*</url-pattern><url-pattern>/user/*</url-pattern>--><!-- 精确匹配--><url-pattern>/user/save</url-pattern><!-- 默认匹配--><url-pattern>/</url-pattern></servlet-mapping><!-- 会话超时时间 --><session-config><session-timeout>60</session-timeout></session-config><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list>
</web-app>

到此项目已经搭建完成,接下来就是测试了。

项目环境测试

现在我打算在t_role表插入一条数据。
1、在bean中创建对应的实体类并添加对应的属性和封装方法

2、在manager-api中创建dao和service层的接口

3、在manager-impl中创建service的实现类和controller控制类

@Service(value = "service")
public class TestServiceImpl implements TestService {@Autowiredprivate TestDao dao;/*** service层是是实现类环境测试* @param role*/public void insert(Role role) {dao.insert(role);}
}

4、在controller中编写方法插入数据

@Controller
@RequestMapping(value = "testController")
public class TestController {@Autowiredprivate TestService service;/*** 测试环境* @return*/@RequestMapping(value = "/testRun")public String testRun(){Role role = new Role();role.setName("小明");service.insert(role);System.out.println("环境搭建成功!!!");return "success";}
}

5、在index.jsp中添加超链接跳转到测试方法

<a href="${pageContext.request.contextPath}/testController/testRun">test</a>

6、配置tomcat服务器

7、启动服务器,项目正常运行并且插入数据,环境搭建成功。



众筹网站项目第一天之项目环境搭建和环境测试相关推荐

  1. ZED2i相机使用环境搭建(Windows 环境下 C#API)

    ZED2i相机使用环境搭建(Windows 环境下 C#API) 本文记录了ZED2i相机在Windows 环境下使用 C#API环境搭建过程,以及出现"无法加载 DLL"sl_z ...

  2. Hyperledger Fabric2.3 环境搭建及Fabric 测试网络使用

    一.安装ubuntu20 Download Ubuntu Desktop | Download | Ubuntu 二.安装环境 参考: Prerequisites - hyperledger-fabr ...

  3. U2-Net: Going Deeper with Nested U-Structure for Salient Object Detection|环境搭建|人物素描 测试 简记 |

    这个代码非常强大,最近作者更新了模型 我也特别更新一篇博文 [最新同步更新教程链接 – 2021-9-3 ]-- 敬请移步 文章目录 U2-Net: Going Deeper with Nested ...

  4. csdn新出炉的Python基础Python的简介和环境搭建和环境变量

    一.前言 hello呀,大家好我叫涂九,今天呢想换中方式和大家唠唠,因为发现之前的文章写得有些乱,我的强迫症犯了,打算给大家从Python的基础开始讲起,今天我们主要讲Python简介和环境搭建和环境 ...

  5. 鸿蒙硬件HI3861开发环境搭建-串口2测试

    鸿蒙硬件HI3861开发环境搭建-串口2测试 鸿蒙硬件HI3861开发环境搭建-串口2测试 - 哔哩哔哩 鸿蒙其他教程请看https://blog.csdn.net/qq_33259323/categ ...

  6. 小程序-本地环境搭建-线上测试搭建-线上正式环境搭建

    本地环境搭建 本地环境只能自己测试 小程序的url设置为localhost.127.0.0.1.或者xxx.xxx.com/api (需要配置hosts)都可以,本地的地址,不需要在小程序后台配置,l ...

  7. 乐鑫Esp32学习之旅① 爬坑学习新旅程,虚拟机Linux环境搭建esp32环境,打印 “Hellow World”。(2021年6月已更新)

    本系列博客学习由非官方人员 半颗心脏 潜心所力所写,仅仅做个人技术交流分享,不做任何商业用途.如有不对之处,请留言,本人及时更改. 系列一:ESP32系列模组基础学习系列笔记 1. 爬坑学习新旅程,虚 ...

  8. java环境搭建_java环境搭建问题

    1.首先去Sun的官方网站 . 1, . 1.java环境安装:这里使用的是j2se1.4.2,这个可以到sun公司的网站去下载: . JDK1.6安装后的配置:i.右击"我的电脑" ...

  9. Ubuntu 美化和常用环境搭建 -- Linux 环境搭建(下)

    NVIDIA显卡驱动安装 通过"附加驱动"安装驱动 通过PPA安装最新驱动 美化和扩展插件 GNOME 扩展推荐(针对 GNOME 桌面) 主题推荐(GNOME 和 Unity 桌 ...

最新文章

  1. 《编写高质量Python代码的59个有效方法》——第10条:尽量用enumerate取代range
  2. Golang 数组传参
  3. OpenCV | OpenCV中cvgoodFeaturesToTrack函数详细注释
  4. android:在ViewPager中使用Button
  5. IT大神提升代码效率的秘密,都私藏在这10个神仙软件里
  6. Linux流量监控工具 – iftop
  7. 转载:CS224n笔记1 自然语言处理与深度学习简介
  8. 2021桂花开得真晚,晚了将近一个月
  9. 图的BFS和DFS原理及实例分析(java)
  10. (必读)工业机器人基础教程——快速入门学习
  11. linux文件系统基础知识--目录项 dirent、inode 和数据块
  12. mysql insert 写法_mysql中insert into语句的6种写法(上)
  13. 茶叶文化网站设计与实现 HTML+CSS学生网页设计作业源码
  14. 【Vue3】第十四部分 父子组件传参
  15. dev/sda1 磁盘满了,导致ubuntu启动显示/dev/sda1: clean, 798946/2621440 files , 1021098/10485248 clocks
  16. 上百本中文书籍中对《人月神话》的引用(4)
  17. 呵呵,GET2017教育科技大会VIP门票,你要不要啊?
  18. 高中计算机听课总结,中学新信息技术老师听课心得体会五篇
  19. php怎么把中文转,php如何把中文转换成拼音
  20. 【树莓派】系统刷机教程

热门文章

  1. Python核心编程06-----列表 切片 常用操作 修改列表 列表的方法 遍历列表
  2. opendir、readdir以及使用
  3. readdir()函数:读取目录函数
  4. sklearn Kmeans
  5. 如何查看天猫产品的历史最低价?
  6. 企业运维经典面试题汇总 (1)
  7. jq获取id变量值(Ajax)
  8. 华为交换机基本配置命令大全
  9. 0x0000000A 蓝屏问题
  10. wemos D1 wifi ESP8266 开发板