当前位置: 首页 > news >正文

海西蒙古族藏族自治州网站建设_网站建设公司_虚拟主机_seo优化

响应式网站和不响应式,wordpress多站点好吗,seo谷歌推广,零售网站建设背景#xff1a;淘淘商城项目的环境搭建说明#xff1a;采用SpringMVCSpringMybatisMysqlMavenSvn结构搭建#xff0c;在开发之中可以参考其结构和搭建步骤去搭建实际的工程项目工程结构简图#xff1a;项目结构#xff1a;---------------------------------------------…背景淘淘商城项目的环境搭建说明采用SpringMVCSpringMybatisMysqlMavenSvn结构搭建在开发之中可以参考其结构和搭建步骤去搭建实际的工程项目工程结构简图项目结构---------------------------------------------【 以下是项目的搭建过程 】----------------------------------------------------创建数据库taotao-parent这是父工程其他子工程都要继承它是个POM聚合工程这里集中定义了jar包的版本号但并不是实际依赖其子工程的版本要从这里依赖传递便于维护。File--New--Maven--Maven ProjectNext--Finish修改pom.xml:xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd4.0.0com.taotaotaotao-parent0.0.1-SNAPSHOTpom4.124.1.3.RELEASE3.2.81.2.21.2.155.1.321.6.42.4.21.0.94.3.51.22.52.02.53.3.21.3.23.33.4.2-fix0.9.11.3.12.7.24.10.3joda-timejoda-time${joda-time.version}org.apache.commonscommons-lang3${commons-lang3.version}org.apache.commonscommons-io${commons-io.version}commons-netcommons-net${commons-net.version}com.fasterxml.jackson.corejackson-databind${jackson.version}org.apache.httpcomponentshttpclient${httpclient.version}junitjunit${junit.version}testorg.slf4jslf4j-log4j12${slf4j.version}org.mybatismybatis${mybatis.version}org.mybatismybatis-spring${mybatis.spring.version}com.github.miemiedevmybatis-paginator${mybatis.paginator.version}com.github.pagehelperpagehelper${pagehelper.version}mysqlmysql-connector-java${mysql.version}com.alibabadruid${druid.version}org.springframeworkspring-context${spring.version}org.springframeworkspring-beans${spring.version}org.springframeworkspring-webmvc${spring.version}org.springframeworkspring-jdbc${spring.version}org.springframeworkspring-aspects${spring.version}jstljstl${jstl.version}javax.servletservlet-api${servlet-api.version}providedjavax.servletjsp-api${jsp-api.version}providedcommons-fileuploadcommons-fileupload${commons-fileupload.version}redis.clientsjedis${jedis.version}org.apache.solrsolr-solrj${solrj.version}${project.artifactId}org.apache.maven.pluginsmaven-resources-plugin2.7UTF-8org.apache.maven.pluginsmaven-compiler-plugin3.21.71.7UTF-8org.apache.tomcat.maventomcat7-maven-plugin2.2taotao-common:同理创建taotao-common这个工程是工具工程提供通用的工具类是个jar工程此工程要继承父工程taotao-parent修改pom.xml:xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd4.0.0com.taotaotaotao-parent0.0.1-SNAPSHOTcom.taotaotaotao-common0.0.1-SNAPSHOTjoda-timejoda-timeorg.apache.commonscommons-lang3org.apache.commonscommons-iocommons-netcommons-netcom.fasterxml.jackson.corejackson-databindorg.apache.httpcomponentshttpclientjunitjunittestorg.slf4jslf4j-log4j12com.jcraftjsch0.1.49taotao-manager:这是个POM聚合工程包括controller/service/mapper工程此工程要继承父工程taotao-parent同时要依赖taotao-common工具工程修改pom.xml:xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd4.0.0com.taotaotaotao-parent0.0.1-SNAPSHOTcom.taotaotaotao-manager0.0.1-SNAPSHOTpomcom.taotaotaotao-common0.0.1-SNAPSHOTtaotao-manager-pojotaotao-manager-mappertaotao-manager-servicetaotao-manager-weborg.apache.tomcat.maventomcat7-maven-plugin8080/taotao-manager-pojo:这是POJO是个jar工程不依赖于任何模块在taotao-manager工程上右键New--Other--Maven Module--Next--Finishpom.xml:无需修改xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd4.0.0com.taotaotaotao-manager0.0.1-SNAPSHOTcom.taotaotaotao-manager-pojo0.0.1-SNAPSHOT在src/main/java目录下创建package:com.taotao.pojo使用逆向工程生成POJO类和Mapper接口以及Mapper映射文件将所有POJO类拷贝到这个package下taotao-manager-mapper:同理创建taotao-manager-mapper这是jar工程是mapper层依赖pojo和数据库交互在src/main/java下创建package:com.taotao.mapper将逆向工程生成的Mapper接口和Mapper映射文件拷贝至这个package下修改pom.xml:xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd4.0.0com.taotaotaotao-manager0.0.1-SNAPSHOTcom.taotaotaotao-manager-mapper0.0.1-SNAPSHOTcom.taotaotaotao-manager-pojo0.0.1-SNAPSHOTorg.mybatismybatisorg.mybatismybatis-springcom.github.miemiedevmybatis-paginatorcom.github.pagehelperpagehelpermysqlmysql-connector-javacom.alibabadruidsrc/main/java**/*.properties**/*.xmlfalsetaotao-manager-service同理创建taotao-manager-service这是jar工程是service层调用mapper层修改pom.xml:xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd4.0.0com.taotaotaotao-manager0.0.1-SNAPSHOTcom.taotaotaotao-manager-service0.0.1-SNAPSHOTcom.taotaotaotao-manager-mapper0.0.1-SNAPSHOTorg.springframeworkspring-contextorg.springframeworkspring-beansorg.springframeworkspring-webmvcorg.springframeworkspring-jdbcorg.springframeworkspring-aspects在src/main/java目录下创建package:com.taotao.service以及com.taotao.service.impltaotao-manager-web:同理创建taotao-manager-web这是表现层Controller是个war工程调用service工程修改pom.xml:xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd4.0.0com.taotaotaotao-manager0.0.1-SNAPSHOTcom.taotaotaotao-manager-web0.0.1-SNAPSHOTwarcom.taotaotaotao-manager-service0.0.1-SNAPSHOTjstljstljavax.servletservlet-apiprovidedjavax.servletjsp-apiprovidedcommons-fileuploadcommons-fileupload以下步骤在开发之中根据实际情况调整 可以先搭建好环境之后再开发controller(service层也一样)在src/main/resources目录下创建三个foldmybatis、resource、spring在resource下创建db.propertiesjdbc.driver com.mysql.jdbc.Driverjdbc.url jdbc:mysql://localhost:3306/数据库名?useUnicodetruecharacterEncodingutf-8jdbc.username 数据库账号jdbc.password 数据库密码在mybatis下创建SqlMapConfig.xml(这个文件虽然暂时没有写入什么东西但是要有这个文件否则工程结构不完整就会报错)/pPUBLIC -//mybatis.org//DTD Config 3.0//ENhttp://mybatis.org/dtd/mybatis-3-config.dtd在spring下创建各个整合的配置文件applicationContext-dao.xmlxmlns:contexthttp://www.springframework.org/schema/context xmlns:phttp://www.springframework.org/schema/pxmlns:aophttp://www.springframework.org/schema/aop xmlns:txhttp://www.springframework.org/schema/txxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsdhttp://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsddestroy-methodcloseapplicationContext-service.xmlxmlns:contexthttp://www.springframework.org/schema/context xmlns:phttp://www.springframework.org/schema/pxmlns:aophttp://www.springframework.org/schema/aop xmlns:txhttp://www.springframework.org/schema/txxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsdhttp://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsdapplicationContext-trans.xmlxmlns:contexthttp://www.springframework.org/schema/context xmlns:phttp://www.springframework.org/schema/pxmlns:aophttp://www.springframework.org/schema/aop xmlns:txhttp://www.springframework.org/schema/txxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsdhttp://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsdclassorg.springframework.jdbc.datasource.DataSourceTransactionManagerpointcutexecution(* com.taotao.service.*.*(..)) /springmvc.xmlxmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xmlns:phttp://www.springframework.org/schema/pxmlns:contexthttp://www.springframework.org/schema/contextxmlns:mvchttp://www.springframework.org/schema/mvcxsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsdclassorg.springframework.web.servlet.view.InternalResourceViewResolver在webapp下创建WEB-INF目录其下创建web.xml并把一些静态资源文件和页面(css/js/jsp)拷贝到WEB-INF下web.xml:xmlnshttp://java.sun.com/xml/ns/javaee xmlns:webhttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsdxsi:schemaLocationhttp://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsdidtaotao version2.5taotao-managerindex.htmlindex.htmindex.jspdefault.htmldefault.htmdefault.jspcontextConfigLocationclasspath:spring/applicationContext-*.xmlorg.springframework.web.context.ContextLoaderListenerCharacterEncodingFilterorg.springframework.web.filter.CharacterEncodingFilterencodingutf-8CharacterEncodingFilter/*taotao-managerorg.springframework.web.servlet.DispatcherServletcontextConfigLocationclasspath:spring/springmvc.xml1taotao-manager/在webapp下创建index.jsp:String path request.getContextPath();String basePath request.getScheme() :// request.getServerName() : request.getServerPort() path /;%首页测试尊敬的用户如果您看到此页面说明taotao-manager正在运行...到此为止整个工程的环境已经搭建完毕可以做测试(在实际开发中要步步为营每次搭建完一个模块就要做一次测试)将各个工程及其继承的工程按顺序install到本地仓库然后启动在taotao-manager工程上右键Run As--Maven Build输入clean tomcat7:run运行如果测试通过就将项目提交到svn上这样其他组员就可以从svn上检出项目进行开发-------------------------------------------以下是将项目提交到svn已经从svn检出项目的步骤-------------------------------------------------------提交到svn的顺序taotao-parent, taotao-common, taotao-manager(其子工程不需要提交因为父工程已经包含其子工程)以taotao-parent为例其他同理右键taotao-parent--Team--Share Project...--SVN--Next--创建新的资源库位置(第一个工程选这个后面的工程选择“使用已有资源库位置”)打开VisualSVN Server Manager在Repositories下右键选择Create New Repository...为这个项目的仓库取个名字(如taotao-shop)下一步Create就可以创建一个项目的本地仓库包含三个文件夹branchestagstrunk(这个目录用于存放java代码)右键刚刚创建的仓库选择Copy URL to Clipboard将仓库的URL复制粘贴到以下的URL文本框中Next点击“浏览”--路径指向项目仓库的trunk目录按提示操作Finish即可至此项目并没有真正地上传到svn上只是建立了项目和svn的关系。把除了src及其子目录、pom.xml之外的文件全部 ignore 掉(如果把target/.property/.setting等文件也上传到svn那么其他人从svn上down下来的项目可能会覆盖掉他自己本地的文件这些文件都是个性化的文件不要上传到svn)有些可能要按照顺序操作具体请百度然后提交到svn如果冲突就先更新再提交其他的项目一样操作。这样项目就全部提交到svn上了 建议本地的项目(就是您看到的myeclipse中的所有项目)全部都删除(删除的时候把本地磁盘的选项也勾上表示把磁盘上的也删除)然后从svn上把项目都down下来下载顺序taotao-parent---taotao-common---taotao-manager(这是聚合工程)然后你会发现taotao-manager下的子工程都没有右键taotao-manager这个聚合工程--Import--Maven--Existing Maven Projects--Next路径指向聚合工程taotao-manager的目录就会自动将其子工程列出来全选NextFinish就会把所有的子工程都导入进来你会发现taotao-parent, taotao-common, taotao-manager这三个工程都不是Maven工程需要将其一 一转成Maven工程步骤请参考以下链接http://www.cnblogs.com/josephcnblog/articles/6616563.html将项目都转成maven工程之后至此整个项目的就搭建完毕可以进行其他功能的开发了------------------------------------------以下是一个小demo的开发步骤其他业务模块一样操作--------------------------------------------------在com.taotao.service下创建Service接口ItemService.javapackage com.taotao.service;import com.taotao.pojo.TbItem;/*** 商品Service*/public interface ItemService {TbItem getItemById(long itemId);}在com.taotao.service.impl下创建Service接口实现类ItemServiceImpl.javapackage com.taotao.service.impl;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Service;import com.taotao.mapper.TbItemMapper;import com.taotao.pojo.TbItem;import com.taotao.service.ItemService;/*** 商品Service实现类*/Servicepublic class ItemServiceImpl implements ItemService {// 注入ItemMapperAutowiredprivate TbItemMapper itemMapper;/*** 根据商品Id查询商品对象*/Overridepublic TbItem getItemById(long itemId) {TbItem item itemMapper.selectByPrimaryKey(itemId);return item;}}在src/main/java目录下创建packagecom.taotao.controller在此package下创建ItemController.javapackage com.taotao.controller;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.PathVariable;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.ResponseBody;import com.taotao.pojo.TbItem;import com.taotao.service.ItemService;/*** 商品Controller*/ControllerRequestMapping(/item)public class ItemController {// 注入ItemServiceAutowiredprivate ItemService itemService;RequestMapping(/{itemId})ResponseBodypublic TbItem getItemById(PathVariable Long itemId) {TbItem item itemService.getItemById(itemId);return item;}}下面是测试右键taotao-manager--Run As--Maven Build启动tomcat之后在浏览器地址栏输入http://localhost:8080/item/536563其中, 后面的数字是要查询的商品的 id 回车返回json格式数据 测试通过继续开发其他的业务模块吧
http://www.ihoyoo.com/news/142450.html

相关文章:

  • 网站开发c美食网站建设实施方案
  • 安徽省建设工程造价管理网站多商户开源商城
  • 企业网站如何优化排名机械公司企业简介模板
  • 济宁网站建设济宁子域名做微信开放平台网站应用
  • 企业网站建设方案报价东莞市聚势网络科技有限公司
  • wordpress saas 建站wordpress文档模板下载
  • 网站是否能够被恶意镜像分类网站作用
  • 做网站包头网站运营教程
  • wordpress 修改headseo诊断表
  • 做电影网站放抢先版电子商务网站建设基础项目实训报告
  • 网站建设考试试题app 与网站
  • 做评测好的视频网站网站建设的七大主要目的
  • 常见网站架构建设银行的网站
  • 织梦做的网站怎么上传视频教程建一个网页
  • 汕头网站关键词推广云上铺会员管理系统
  • 电商网站建设题库江苏省交通运输厅门户网站建设管理办法
  • 海西高端网站建设公司上海百度推广官方电话
  • 做cpa搭建哪个网站比较好h5网站开发公司
  • 网站建设服务器和空间费深圳网络营销技巧
  • 在茂名哪里可以做网站旅游网站开发的意义
  • 沈阳cms模板建站wordpress获取标签名
  • 已备案网站数量如果做淘宝网站
  • 网站技术支持什么意思网站开发环境搭建
  • 网站建设费用预算建筑模板怎么装
  • 摄影网站设计实现步骤动漫网站设计论文
  • 厦门微信网站有什么做家常菜的网站
  • 信息咨询公司网站源码二十一冶建设有限公司网站
  • 个人网站做商城深圳专业建网站多少钱
  • 做废铝的关注哪个网站好商城网站大概多少钱
  • 局域网内的网站建设徐州品牌网站建设|徐州网站优化|徐州网络公司-徐州启思信息科技