发表于: 2019-03-02 19:28:55
1 613
今天完成的事
Ubuntu安装nginx:
安装参考:https://www.cnblogs.com/wyd168/p/6636529.html
排错参考:https://blog.csdn.net/sungaochao/article/details/80641669
启动:
浏览器访问:
本地配置Host,通过域名在浏览器,Postman等测试数据
Spring messageSource 配置错误信息,在接口处做校验,根据错误的类型返回对应的错误信息
信息文件
messages.properties
#CRUD操作
1001=查询成功
1002=增加成功
1003=删除成功
1004=编辑成功
1005=查询失败
1006=增加失败
1007=删除失败
1008=编辑失败
StudentController
//学生列表与分页Action
@RequestMapping(value = "/list",produces = {"application/json;charset=UTF-8"},method= RequestMethod.GET)
public String list(Model model, @RequestParam(required = false,defaultValue = "1")int pageNO){
int size=5;
model.addAttribute("size",size);
model.addAttribute("pageNO",pageNO);
model.addAttribute("count",studentService.getStudentsCount());
model.addAttribute("students",studentService.getStudentsPager(pageNO, size));
model.addAttribute("code",1001);
return "/index";
// return "students/list";
}
applicationContext.xml
<!--ref需要注入一个类,即messageSource中要有 private/public UserBO userBO; 定义的并有其对应的get/set方法,-->
<!--userBO 要与name后的值一样,-->
<!--这样你在messageSource中就可以直接使用UserBO 里面的方法了-->
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<!--<property name="parentMessageSource" ref="userBO"/>-->
<property name="fallbackToSystemLocale"><value>false</value></property>
<property name="basenames">
<list>
<value>classpath:messages</value>
</list>
</property>
<property name="useCodeAsDefaultMessage" value="true"/>
<!-- 解决 ValidationMessage.properties错误信息文件的中文乱码问题 -->
<!--<property name="defaultEncoding" value="UTF-8" />-->
<!-- 资源文件编码格式 -->
<property name="fileEncodings" >
<props>
<prop key="classpath:messages">UTF-8</prop>
</props>
</property>
<!-- 对资源文件内容缓存时间,单位秒 -->
<property name="cacheSeconds" value="120" />
</bean>
Postman
明天计划的事
任务三
遇到的问题
message中文乱码问题
收获
message配置,以及用处,
1.常用的性能统计命令
TOP:查看服务器整体的性能;(uptime)
vmstat:查看CPU的性能;vmstat -n 2 3
free:查看内存使用的情况; free -m
iostat:查看磁盘读取速度; iostat -d 2 3(需要sysstat包);
ping:查看网络连通性,与Windows类似
netstat:查看端口号,一般都不使用这个命令,一般情况下都使用ps命令来查看
评论