大连建网站网站制作,知识付费网站开发,网站建设与运营课程,免费解析网站项目说明 1、项目文件结构 2、项目主要接口及其实现 #xff08;1#xff09;Index#xff1a; 首页页面#xff1a;展示商品功能#xff0c;可登录或查看商品详细信息 #xff08;2#xff09;登录#xff1a;/ApiLogin 3、dao层 数据持久化层#xff0c;把商品和用户…项目说明 1、项目文件结构 2、项目主要接口及其实现 1Index 首页页面展示商品功能可登录或查看商品详细信息 2登录/ApiLogin 3、dao层 数据持久化层把商品和用户信息寸进mysql数据库 1ContentDao 2PersonDao 3ProductDao 4TransactionDao 4、spring配置文件和mybatis配置文件 spring-mvc.xml 1 ?xml version1.0 encodingUTF-8?2 beans xmlnshttp://www.springframework.org/schema/beans3 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance4 xmlns:contexthttp://www.springframework.org/schema/context5 xmlns:mvchttp://www.springframework.org/schema/mvc6 xsi:schemaLocationhttp://www.springframework.org/schema/beans7 http://www.springframework.org/schema/beans/spring-beans.xsd8 http://www.springframework.org/schema/context9 http://www.springframework.org/schema/context/spring-context.xsd
10 http://www.springframework.org/schema/mvc
11 http://www.springframework.org/schema/mvc/spring-mvc.xsd
12
13 !-- 自动扫描该包使SpringMVC认为包下用了controller注解的类是控制器 --
14 context:component-scan base-packagecom.web.controller/context:component-scan
15 !-- 扩充了注解驱动可以将请求参数绑定到控制器参数 --
16 mvc:annotation-driven/
17 mvc:default-servlet-handler/
18
19 !-- 配置事务管理器
20 bean idtransactionManager
21 classorg.springframework.jdbc.datasource.DataSourceTransactionManager
22 !- 注入数据库连接池 -
23 property namedataSource refdataSource/
24 /bean
25 --
26 !-- freemarker配置 --
27 bean idfreemarkerConfig
28 classorg.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer
29 property nametemplateLoaderPath value/WEB-INF/freemarker /
30 property nametemplateLoaderPaths value/template/
31 property namefreemarkerSettings
32 props
33 prop keytemplate_update_delay0/prop!--刷新模板的周期单位为秒--
34 prop keydefaultEncodingUTF-8/prop!--模板的编码格式 --
35 /props
36 /property
37 /bean
38 !-- freemarker视图解析器 --
39 bean
40 classorg.springframework.web.servlet.view.ContentNegotiatingViewResolver
41 property nameviewResolvers
42 list
43 bean idviewResolver
44 classorg.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver
45 property namecache valuetrue /
46 property nameprefix value /
47 property namesuffix value.ftl /
48 property namecontentType valuetext/html; charsetUTF-8 /
49 /bean
50 /list
51 /property
52 property namedefaultViews
53 list
54 bean
55 classorg.springframework.web.servlet.view.json.MappingJackson2JsonView /
56 /list
57 /property
58 /bean
59 !-- SpringMVC上传文件时需要配置MultipartResolver处理器 --
60 bean idmultipartResolver
61 classorg.springframework.web.multipart.commons.CommonsMultipartResolver
62 property namedefaultEncoding valueUTF-8 /
63 !-- 指定所上传文件的总大小,单位字节。注意maxUploadSize属性的限制不是针对单个文件而是所有文件的容量之和 --
64 property namemaxUploadSize value10240000 /
65 /bean
66
67 !--注册拦截器--
68
69 /beans spring-mybatis.xml 1 ?xml version1.0 encodingUTF-8?2 !-- 配置文件需要引入的类 --3 beans xmlnshttp://www.springframework.org/schema/beans4 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance5 xmlns:contexthttp://www.springframework.org/schema/context6 xmlns:mybatishttp://mybatis.org/schema/mybatis-spring7 xsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd8 9 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
10
11
12
13
14 http://mybatis.org/schema/mybatis-spring http://mybatis.org/schema/mybatis-spring.xsd
15 !-- scanner --
16 context:component-scan base-packagecom.web.service/context:component-scan
17 context:component-scan base-packagecom.web.service.impl/context:component-scan
18
19
20 !-- Spring and mybatis--
21 mybatis:scan base-packagecom.web.dao/
22
23
24 bean idsqlSessionFactory classorg.mybatis.spring.SqlSessionFactoryBean
25 property namedataSource refdataSource/
26 /bean
27
28 bean iddataSource classorg.apache.commons.dbcp.BasicDataSource
29 destroy-methodclose
30 property namedriverClassName value${jdbc.driverClassName}/property
31 property nameurl value${jdbc.url}/property
32 property nameusername value${jdbc.username}/property
33 property namepassword value${jdbc.password}/property
34 !-- 初始化连接大小 --
35 property nameinitialSize value${initialSize}/property
36 !-- 连接池最大数量 --
37 property namemaxActive value${maxActive}/property
38 !-- 连接池最大空闲 --
39 property namemaxIdle value${maxIdle}/property
40 !-- 连接池最小空闲 --
41 property nameminIdle value${minIdle}/property
42 !-- 获取连接最大等待时间 --
43 property namemaxWait value${maxWait}/property
44 /bean
45
46 context:property-placeholder locationclasspath:db.properties/
47
48 !-- 配置基于注解的声明式事务
49 bean idtransactionManager
50 classorg.springframework.orm.jpa.JpaTransactionManager
51 property namedataSource refdataSource /
52 /bean
53
54 tx:annotation-driven transaction-managertransactionManager/
55 --
56 /beans db.properties 1 jdbc.driverClassName com.mysql.jdbc.Driver2 jdbc.url jdbc:mysql://localhost:3306/shen_db?characterEncodingutf8useSSLtrue3 jdbc.usernameroot4 jdbc.password1234565 initialSize06 #定义最大连接数7 maxActive208 #定义最大空闲9 maxIdle20
10 #定义最小空闲
11 minIdle1
12 #定义最长等待时间
13 maxWait60000 5、运行截图 首页 买家购物车 买家账单 卖家发布商品界面 转载于:https://www.cnblogs.com/shenzhi/p/7590973.html