发表于: 2017-10-21 00:25:01
1 736
今天完成的事
【1】将单元测试项目打包。
建立了spring-mvc.xml
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<body>
<h2>Hello World!</h2>
${student.id}<br>
${student.user_name}<br>
${student.user_qq}<br>
${student.user_school}<br>
${student.will}<br>
${student.create_at}<br>
${student.update_at}<br>
</body>
</html>
StudentController类
package com.xiuzhen.controller;
import com.xiuzhen.domain.Student;
import com.xiuzhen.service.StudentService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
/**
* Created by ${MIND-ZR} on 2017/10/20.
*/
@Controller
public class StudentController{
@Resource
private StudentService studentService;
@RequestMapping("/")
public ModelAndView getIndex(){
ModelAndView mav = new ModelAndView("index");
Student student= studentService.selectStudentById(3);
mav.addObject("student", student);
return mav;
}
}
打包带走~~~~
【2】为了把服务器部署到linxu,先是安装了tomcat。
但是安装过后发现8080端口被,调用,-修改接口。
然后启动,成功。
但是网页打开失败。
开始排查问题,首先发现阿里云本身没有配置firewall。需要自己安装。
成功。
发现centos7取消了iptables ,只能使用firewall。
依旧不行,发现问题,卸载iptables 采用了yum remove iptables.
划重点!卸载iptables一定不要用yum remove iptables,不然服务器会炸。BOOM!
重新搭服务器。
装java,mysql。
今天的收获
学习了一下单元测试转web和打包
遇到的问题
配置tomcat浪费了一点时间,不过也算搞清楚了还摸了摸linux的坑。
明天的计划
23.将部署自己服务到服务器上,包括Maven,Mysql客户端等。直接用Maven命令跑单元测试。
24.直接执行Main方法,去在服务器上跑通流程。
25.测试一下不关闭连接池的时候,在Main函数里写1000个循环调用会出现什么情况。
评论