
课程咨询: 400-996-5531 / 投诉建议: 400-111-8989
认真做教育 专心促就业
1 文档概述
1.1 文档结构说明
安装环境要求: 阐述本系统的安装条件及其运行环境。
安装部署过程: 介绍本系统的安装步骤。
项目配置需求:介绍项目中配置文件的编写
数据库数据导入:项目所需数据如何导入
2 安装环境要求
2.1 软件环境要求
需要安装JDK1.8、TOMCAT 7 /Maven3.3.9/mysql/navicat
3 安装部署过程
3.1 JDK 1.8的安装及配置
3.2 Tomcat7的安装及配置
在Eclipse配置Tomcat服务器
3.3 Maven3的安装与配置
4 项目配置需求
4.1 .pom.xml所需依赖及说明:
<dependencies>
<!--spring-webmvc依赖-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.9.RELEASE</version>
</dependency>
<!--jackson依赖-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.5</version>
</dependency>
<!--连接mysql数据库驱动依赖-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.40</version>
</dependency>
<!--阿里巴巴连接池依赖-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.10</version>
</dependency>
<!--mybatis依赖-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.6</version>
</dependency>
<!--mybatis-spring依赖-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.2</version>
</dependency>
<!--spring-jdbc依赖-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.3.9.RELEASE</version>
</dependency>
<!--测试依赖-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<!--日志模块依赖-->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!--shiro安全框架依赖-->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
4.2 spring-configs.xml文件编写
<?xml version="1.0" encoding="UTF-8"?>
<beans default-lazy-init="true"
xmlns="#/schema/beans"
xmlns:p="#/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="#/schema/context"
xmlns:tx="#/schema/tx"
xmlns:aop="#/schema/aop"
xmlns:mvc="#/schema/mvc"
xmlns:util="#/schema/util"
xmlns:jpa="#/schema/data/jpa"
xsi:schemaLocation="
#/schema/beans
#/schema/beans/spring-beans-4.3.xsd
#/schema/mvc
#/schema/mvc/spring-mvc-4.3.xsd
#/schema/tx
#/schema/tx/spring-tx-4.3.xsd
#/schema/aop
#/schema/aop/spring-aop-4.3.xsd
#/schema/util
#/schema/util/spring-util-4.3.xsd
#/schema/data/jpa
#/schema/data/jpa/spring-jpa-1.3.xsd
#/schema/context
#/schema/context/spring-context-4.3.xsd">
<context:component-scan base-package="com.dessert"></context:component-scan>
<import resource="classpath:spring-mvc.xml"/>
<import resource="classpath:spring-datasource.xml"/>
<import resource="classpath:spring-mybatis.xml"/>
<import resource="classpath:spring-shiro.xml"/>
</beans>
4.3 configs.properties文件编写
jdbcDriver=com.mysql.jdbc.Driver
jdbcUrl=jdbc:mysql:///dessert?useUnicode=true&characterEncoding=utf-8
jdbcUser=root
jdbcPassword=
4.4 spring-datasource.xml文件编写
<?xml version="1.0" encoding="UTF-8"?>
<beans default-lazy-init="true"
xmlns="#/schema/beans"
xmlns:p="#/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="#/schema/context"
xmlns:tx="#/schema/tx"
xmlns:aop="#/schema/aop"
xmlns:mvc="#/schema/mvc"
xmlns:util="#/schema/util"
xmlns:jpa="#/schema/data/jpa"
xsi:schemaLocation="
#/schema/beans
#/schema/beans/spring-beans-4.3.xsd
#/schema/mvc
#/schema/mvc/spring-mvc-4.3.xsd
#/schema/tx
#/schema/tx/spring-tx-4.3.xsd
#/schema/aop
#/schema/aop/spring-aop-4.3.xsd
#/schema/util
#/schema/util/spring-util-4.3.xsd
#/schema/data/jpa
#/schema/data/jpa/spring-jpa-1.3.xsd
#/schema/context
#/schema/context/spring-context-4.3.xsd">
<!-- 加载属性配置文件(此文件内部存储这访问数据库的相关信息) -->
<util:properties id="cfg" location="classpath:configs.properties"></util:properties>
<!-- 配置DURUID连接池数据源对象 -->
<bean id="druid"
class="com.alibaba.druid.pool.DruidDataSource"
init-method="init"
destroy-method="close"
lazy-init="false">
<property name="DriverClassName" value="#{cfg.jdbcDriver}"/>
<property name="Url" value="#{cfg.jdbcUrl}"/>
<property name="Username" value="#{cfg.jdbcUser}"/>
<property name="Password" value="#{cfg.jdbcPassword}"/>
</bean>
</beans>
4.5 spring-mvc.xml文件编写
<?xml version="1.0" encoding="UTF-8"?>
<beans default-lazy-init="true"
xmlns="#/schema/beans"
xmlns:p="#/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="#/schema/context"
xmlns:tx="#/schema/tx"
xmlns:aop="#/schema/aop"
xmlns:mvc="#/schema/mvc"
xmlns:util="#/schema/util"
xmlns:jpa="#/schema/data/jpa"
xsi:schemaLocation="
#/schema/beans
#/schema/beans/spring-beans-4.3.xsd
#/schema/mvc
#/schema/mvc/spring-mvc-4.3.xsd
#/schema/tx
#/schema/tx/spring-tx-4.3.xsd
#/schema/aop
#/schema/aop/spring-aop-4.3.xsd
#/schema/util
#/schema/util/spring-util-4.3.xsd
#/schema/data/jpa
#/schema/data/jpa/spring-jpa-1.3.xsd
#/schema/context
#/schema/context/spring-context-4.3.xsd">
<!-- 启用MVC默认配置(自动注册springMVC自带的默认配置) -->
<mvc:annotation-driven></mvc:annotation-driven>
<!-- 配置视图解析器 -->
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="Prefix" value="/WEB-INF/pages/"></property>
<property name="Suffix" value=".html"></property>
</bean>
</beans>
4.6 spring-mybatis.xml文件编写
<?xml version="1.0" encoding="UTF-8"?>
<beans default-lazy-init="true"
xmlns="#/schema/beans"
xmlns:p="#/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="#/schema/context"
xmlns:tx="#/schema/tx"
xmlns:aop="#/schema/aop"
xmlns:mvc="#/schema/mvc"
xmlns:util="#/schema/util"
xmlns:jpa="#/schema/data/jpa"
xsi:schemaLocation="
#/schema/beans
#/schema/beans/spring-beans-4.3.xsd
#/schema/mvc
#/schema/mvc/spring-mvc-4.3.xsd
#/schema/tx
#/schema/tx/spring-tx-4.3.xsd
#/schema/aop
#/schema/aop/spring-aop-4.3.xsd
#/schema/util
#/schema/util/spring-util-4.3.xsd
#/schema/data/jpa
#/schema/data/jpa/spring-jpa-1.3.xsd
#/schema/context
#/schema/context/spring-context-4.3.xsd">
<!-- 配置SQLSessionFactoryBean,系统底层会通过此bean来创建SQLSessionFactory对象 -->
<bean id="sqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="DataSource" ref="druid"></property>
<property name="MapperLocations" value="classpath*:mapper/sys/*Mapper.xml"></property>
</bean>
<!-- 配置MapperScanner对象(借助此对象扫描Dao接口,基于此接口创建接口的实现类对象-proxy) -->
<bean id="mapperScanner" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.dessert.**.dao"/>
<property name="SqlSessionFactoryBeanName"
value="sqlSessionFactory"/>
</bean>
</beans>
4.7 spring-shiro.xml文件编写
<?xml version="1.0" encoding="UTF-8"?>
<beans default-lazy-init="true"
xmlns="#/schema/beans"
xmlns:p="#/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="#/schema/context"
xmlns:tx="#/schema/tx"
xmlns:aop="#/schema/aop"
xmlns:mvc="#/schema/mvc"
xmlns:util="#/schema/util"
xmlns:jpa="#/schema/data/jpa"
xsi:schemaLocation="
#/schema/beans
#/schema/beans/spring-beans-4.3.xsd
#/schema/mvc
#/schema/mvc/spring-mvc-4.3.xsd
#/schema/tx
#/schema/tx/spring-tx-4.3.xsd
#/schema/aop
#/schema/aop/spring-aop-4.3.xsd
#/schema/util
#/schema/util/spring-util-4.3.xsd
#/schema/data/jpa
#/schema/data/jpa/spring-jpa-1.3.xsd
#/schema/context
#/schema/context/spring-context-4.3.xsd">
<!-- 配置SecurityManager对象 -->
<bean id="securityManager"
class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
<property name="Realm" ref="shiroUserRealm"/>
</bean>
<!-- 配置ShiroFilterFactoryBean对象 -->
<bean id="shiroFilterFactory" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
<property name="SecurityManager" ref="securityManager"></property>
<!-- 设置此项的目的是让用户进行认证登录 -->
<property name="LoginUrl" value="/doLoginUI.do"></property>
<!-- 设置请求过滤规则 -->
<property name="FilterChainDefinitionMap">
<map>
<entry key="/bower_components/**" value="anon"/><!-- anon表示允许匿名访问 -->
<entry key="/build/**" value="anon"/>
<entry key="/dist/**" value="anon"/>
<entry key="/plugins/**" value="anon"/>
<entry key="/employee/doLogin.do" value="anon"/>
<entry key="/doLogout.do" value="logout"/>
<entry key="/**" value="authc"/><!-- 必须认证 -->
</map>
</property>
</bean>
<!-- 配置bean对象的生命周期管理 -->
<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor">
</bean>
<!-- 配置Bean对象的代理 -->
<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"
depends-on="lifecycleBeanPostProcessor">
</bean>
<!-- 配置授权属性-->
<bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
<property name="SecurityManager" ref="securityManager"/>
</bean>
</beans>
4.8 log4j.properties文件编写
log4j.rootLogger=INFO,stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d [%-5p] %c - %m%n
log4j.logger.com.mybatis3=DEBUG
log4j.logger.com.pt=DEBUG
5 数据库数据导入
5.1 创建数据库dessert
这里要使用Navicat工具进行导入数据,首先打开Navicat工具,点击链接,输入连接名,用户名和密码,点击连接测试查看是否链接成功,链接成功直接点击下面的确定即可
5.2 创建数据库dessert
打开点击mysql邮件新建数据库,数据库名填写dessert点击确定即可
5.3 导入表数据
点击dessert邮件选择运行sql文件,点击三个点这个按钮选择dessert.sql文件,点击开始,只要显示successfully字样就成功导入所有表数据了。点开dessert数据库右键刷新就可以看到所有表数据了
项目需求:
实现后台对商品,订单,员工,客户的管理以及前端商品显示,加入购买,结算功能
商品管理:
商品添加
商品修改
商品删除
员工管理:
员工添加
员工修改
员工删除
部门管理:
部门添加
部门修改
部门产出
订单管理:
订单修改
订单删除
所用技术:
Spring、springMVC、mybatis、shiro
【免责声明】本文部分系转载,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责。如涉及作品内容、版权和其它问题,请在30日内与联系我们,我们会予以更改或删除相关文章,以保证您的权益!