Hexo


  • 首页

  • 归档

  • 标签

修改tomcat端口

发表于 2016-05-17   |   分类于 dialy   |  

问题背景

当一个机器中安装多个tomcat并需要同时启动时,会出现端口被占用而无法同时启动的问题

问题分析

如果都是用的默认的端口,当启动一个tomcat时,就已经占用了默认端口,再启动其他tomcat就无法使用已经被占用的端口。

解决方法:修改tomcat端口

本例使用tomcat6.0,其他版本类似。主要需要修改3个端口:

1.修改监听HTTP1.1请求的端口

1
2
3
4
<Connector port="8080" protocol="HTTP/1.1" 
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="UTF-8"/>

修改其中的port="8080"为其他端口,如:port="8081"

2.修改监听AJP请求的端口,该端口接收由其他服务器转发过来的请求

1
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

修改其中的port="8009"为其他端口,如:port="8010"

3.修改监听tomcat关闭请求的端口

1
<Server port="8005" shutdown="SHUTDOWN">

修改其中的port="8005"为其他端口,如:port="8006"

确定修改后的端口没有其他地方使用的,修改以上端口后重启启动tomcat即可

tomcat server结构图

tocmcat-srartup

更多阅读

  1. Tomcat Server.xml详解
  2. 当装了两个tomcat后,如何修改tomcat端口

唐人街探案中的一些对白

发表于 2016-05-17   |   分类于 movie   |  
  • TOC
    {:toc}

电影唐人街探案中的一些对白和场景

1. 最后神探小结巴(当然此时已经不结巴了)和”腹黑”小萝莉的对话

(神探走进小萝莉的病房,小萝莉坐在病床上看书,看到小结巴来了,露出天真无邪的笑脸)

1
小萝莉:你不是今天回国吗?
1
小结巴:我...我想给你讲个故事(刚开始还是接吧了一下)
1
小萝莉:你怎么和那个大叔一样,都爱讲故事
1
2
3
小结巴:一个男孩失踪了,他的父亲一直在找他。他后来怀疑他儿子死了,更重要的是,他怀疑杀害他儿子的可能是一个女孩。  
女孩发现了,她担心暴露,所以,想除掉这个父亲。她知道养父对自己异常的爱,所以,她编造了一本日记,并故意让养父看到。
我一直在想这本日记后边被撕掉的部分会是什么,是什么不想给我们看到。也许,是杀人方法吧。

(小萝莉配音旁白)

我如果能杀死他
我会先找到一辆报废的车
和一个替死鬼
我会在监控录像覆盖前潜入他家
我要让他受到千倍万倍的惩罚

(当然电影里面的笔记片段更详细:)

如果我能杀死他,我会先找一辆报废的汽车和一个替死鬼。
我知道他们家周围的监控录像是七天覆盖一次,我会再一周前就潜伏进去。
我会找到一个提货的人,再我杀死他的那天晚上去工坊提货。我会打扮成他的样子,钻到他的箱子里去,我会把他的尸体放到工作室里,让他以为死的人还活着。
让他以为运出去的是佛像。监控录像里,只会拍下送货的人,他便会成为凶手。
我会让他受到千倍万倍的惩罚
我会让他受到千辈万倍的惩罚
我会让他受到千倍万倍的惩罚
我会让他受到千辈万倍的惩罚
我会让他受到千倍万倍的惩罚
我会让他受到千辈万…(还在手写。这句重复这么多遍,强调恨的有多深!!)

1
2
女孩没想到我们会找上门,她改变了计划。正好可以利用我们,摆脱她变态的养父。  
那本日记出现的时间、燃烧的速度都太巧了。但女孩没想到一点,她诬陷非礼她的那个男人,是个同性恋
1
小萝莉:你说话好像不结巴了(转移话题)
1
小结巴:当然,这些都是假设,也没有证据可以证明一个死人的性取向。
1
小萝莉:可是我真的听不懂 (还在装无辜)
1
小结巴:当我没说

(小结巴说完转头准备离开病房)

1
2
3
4
5
6
7
小萝莉:这本书上说,个体生命不同,但这世界善恶总量不变。每个人从出生就注定扮演各自的角色,  
有的是善,有的是恶。你呢?
(小结巴转过身,看到小萝莉**惊悚的笑脸**,从之前天真无邪到如此惊悚阴险的转变!!!!!
这个我给年度最佳惊悚瞬间奖)
恶人是不是该这么笑?
(小结巴走上前,拿出桌子上的一张纸,对折树立放在小萝莉面前,这里是和电影前面有对应。
可能是表示【万物两级,善恶对立。有恶的,才需要善的】)

在windows操作系统中使用redis

发表于 2016-05-17   |   分类于 technology   |  
redis官方支持类unix(linux和mac)系统,在Linux和mac中使用只要按官方文档来即可。但是官方不支持windows操作系统,只是微软开源技术组织()Microsoft Open Tech group)在Github开发了一个win64的redis版本。
阅读全文 »

未命名

发表于 2016-05-17   |  

linux开机自动启动oracle服务

发表于 2016-05-17   |   分类于 dialy   |  

本例使用环境

  • Linux RedHat6.5发行版_64位
  • Oracle11g_R2_64位
  • Xshell 4:远程登录主机软件

配置步骤

1.使用root账号登录服务器(可以使用远程登录方法)

2.更改oratab配置:
先使用vim打开/etc/oratab文件

1
# vim /etc/oratab

将oracle:/opt/oracle/app/product/11.2.0/dbhome_1:N 改为oracle:/opt/oracle/app/product/11.2.0/dbhome_1:Y
其中:oracle为实例名;/opt/oracle/app/product/11.2.0/dbhome_1为oracle的安装路径,会因安装的情况不同而有所不同。如下图所示:
01-05-01-oratab

3.更改启动配置文件/etc/rc.d/rc.local文件

1
# vim /etc/rc.d/rc.local

添加以下两句:

1
2
su oracle -lc "/opt/oracle/app/product/11.2.0/dbhome_1/bin/lsnrctl start"
su oracle -lc /opt/oracle/app/product/11.2.0/dbhome_1/bin/dbstart

其中/opt/oracle/app/product/11.2.0/dbhome_1为oracle安装目录。如下图所示:
01-05-02-rc.local

使用spring发送邮件

发表于 2016-05-17   |   分类于 dialy   |  

本文主要介绍使用Spring3.x框架中的JavaMail支持来实现邮件发送功能,并添加附件。

1.需要用到的jar包:mail-1.4.jar,spring
如果使用maven,pom.xml中添加依赖

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<properties>
<!-- 依赖公共包版本定义-->
<log4j.version>1.2.14</log4j.version>
<spring.version>3.1.0.RELEASE</spring.version>
</properties>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>

2.spring-mail配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd"
>
<!-- 注意:这里的参数(如用户名、密码)都是针对邮件发送者的 -->
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<!-- SMTP发送邮件的服务器的IP和端口 -->
<property name="host" value="${mail.host}" />
<property name="port" value="${mail.port}" />

<!-- 登陆SMTP邮件发送服务器的用户名和密码 -->
<property name="username" value="${mail.username}" />
<property name="password" value="${mail.password}" />

<!-- 获得邮件会话属性,验证登录邮件服务器是否成功 -->
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop>
<prop key="prop">true</prop>
<prop key="mail.smtp.timeout">25000</prop>
</props>
</property>
</bean>

<!-- 定时任务:每月2号发送邮件 corn:秒 分钟 小时 天(月) 月 天(星期) 年份 -->
<task:scheduled-tasks>
<task:scheduled ref="taskJob" method="sendMailJob" cron="0 0 0 2 * ? *" /> <!-- 每月2号的凌晨 -->
</task:scheduled-tasks>

<context:component-scan base-package="cn.com.starit.kanms.task" />

</beans>

properties 文件配置

1
2
3
4
5
6
7
8
9
10
# 发送邮件配置
mail.host=smtp.163.com
mail.port=25
mail.username=maxinchun0215@163.com
mail.password=********
# 接收邮件的邮箱,多个用','分割
# 发送给
mail.to=maxinchun0215@qq.com,ma.xinchun@ustcinfo.com
# 抄送给
mail.copy=ha.chuanchi@ustcinfo.com,zhong.jinkai@ustcinfo.com

3.java类分别为
SendMailUtil类:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package cn.com.starit.kanms.util.mail;

import java.io.File;
import java.util.List;
import java.util.Map;

import javax.mail.internet.MimeMessage;

import org.apache.log4j.Logger;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;

import cn.com.starit.commons.service.ApplicationContextProvider;
import cn.com.starit.commons.web.util.ExportUtil;
import cn.com.starit.kanms.dao.GridDao;
import cn.com.starit.kanms.service.DataSerive;
import cn.com.starit.kanms.util.CustomizedPropertyPlaceholderConfigurer;

import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeUtility;

/**
* 发送邮件工具
*
* @author maxinchun
*
*/

public class SendMailUtil {
private static Logger logger = Logger.getLogger(SendMailUtil.class);
private static JavaMailSender sender;
// 获取JavaMailSender bean
static {
if (sender == null) {
sender = (JavaMailSender) ApplicationContextProvider.getBean("mailSender");
}
}


/**
* 以附件形式发送email
* @param sendTo 收件人email地址
* @param copyTo 抄送对象的email地址
* @param mailSubject 邮件主题
* @param mailBody 内容
* @param files 附件
*/

public static void sendFileMail(String[] sendTo,String[] copyTo, String mailSubject, String mailBody, File[] files) {

MimeMessage mimeMessage = sender.createMimeMessage();
try {
if(logger.isDebugEnabled()){
logger.debug("带附件和图片的邮件正在发送...");
}
// 设置utf-8或GBK编码,否则邮件会有乱码
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage,true,"UTF-8");
// 设置发送人名片
String from = (String)CustomizedPropertyPlaceholderConfigurer.getContextProperty("mail.username");
helper.setFrom(from);
// 设置收件人邮箱
helper.setTo(sendTo);
if(copyTo.length != 0 && !copyTo[0].equals("")){
helper.setCc(copyTo);
}

// 主题
helper.setSubject(mailSubject);
// 邮件内容,注意加参数true,表示启用html格式
helper.setText(mailBody,true);

if (files != null && files.length > 0) {
for (int i = 0; i < files.length; i++)
// 加入附件
helper.addAttachment(MimeUtility.encodeText(files[i]
.getName()), files[i]);
}
// 加入插图(图片附件)
// helper.addInline(MimeUtility.encodeText("pic01"), new File("E:\\test\\slide-5.png"));

sender.send(mimeMessage);
logger.info("带附件和图片的邮件发送成功!");
} catch (Exception e) {
logger.info("带附件和图片的邮件发送失败!!!");
e.printStackTrace();
}

}

public static String createExecl(Long id) {
GridDao gridDao = DataSerive.getGridDao();
try {
Map<String,Object> map = gridDao.getGridInfoByGridId(id);
if(map !=null){
String fileName = map.get("TITLE").toString();
String columns = map.get("COLMN").toString();
String sql = map.get("SQL").toString();
List dataList = gridDao.getDataInfo(sql);
String path = ExportUtil.createExcel(dataList, columns, fileName);
return path;
}else{
logger.info("没有需要的导出数据,请查看girdId:【"+id+"】是否正确");
}
} catch (Exception e) {
logger.info("生成excel失败!!!!");
e.printStackTrace();
}
return "";

}

public static void main(String[] args) throws Exception {

File noPay = new File(SendMailUtil.createExecl(143L));
File toPay = new File(SendMailUtil.createExecl(142L));

// File noPay = new File("E:\\test\\无交费记录接入点_20160105040144.xls");
// File toPay = new File("E:\\test\\需要交费接入点_20160105050105.xls");
// String to = "maxinchun0215@qq.com"; //ma.xinchun@ustcinfo.com
String subject = "需要交费的接入点信息";
String[] sendTo = CustomizedPropertyPlaceholderConfigurer.getContextProperty("mail.to").toString().split(",");
String[] copyTo = CustomizedPropertyPlaceholderConfigurer.getContextProperty("mail.copy").toString().split(",");
String body = "<html><head></head><body><h1>您好:</h1>&nbsp;&nbsp;附件为本月需要交费的接入点信息。其中,附件1为系统中暂时还<span style='color:red'>没有交费记录</span>的接入点信息;附件2为已超时但还<span style='color:red'>未交费</span>的接入点信息<br>提示:本邮件为系统每月自动发送</body></html>";
// String body = "您好,附件为需要交费的接入点信息。其中,附件1为系统中暂时还没有交费记录的接入点信息;附件2为已超时但还未交费的接入点信息。请查收(提示:本邮件为每月自动发送)";
File[] files = new File[]{noPay,toPay};
SendMailUtil.sendFileMail(sendTo, copyTo, subject, body, files);
}
}

ApplicationContextProvider类:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package cn.com.starit.commons.service;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


public class ApplicationContextProvider {

private static ApplicationContext context = null;

/**
*
* @methodName 得到spring访问类
* @return
* @author ymiao
* @DateTime Aug 27, 2008
* @since 1.0.0
*/
public static ApplicationContext getContext(){

if(context == null){

initContext(null);
}

return context;
}

/**
*
* @methodName 得到spring访问类
* @param contextFilePath 配置文件名称
* @return
* @author ymiao
* @DateTime Aug 27, 2008
* @since 1.0.0
*/
public static ApplicationContext getContext(String contextFilePath){
if(context == null)
initContext(contextFilePath);
return context;
}



/**
* @methodName 得到实列bean
* @param beanName Bean名称
* @return
* @author ymiao
* @DateTime Aug 27, 2008
* @since 1.0.0
*/
public static Object getBean(String beanName)
{
return getContext().getBean(beanName);
}

/**
* @methodName 得到实列bean
* @param beanName Bean名称
* @param clsType Bean 类
* @return
* @author ymiao
* @DateTime Aug 27, 2008
* @since 1.0.0
*/
public static Object getBean(String beanName, Class clsType)
{
return getContext().getBean(beanName, clsType);
}

/**
*
* @methodName:初始化spring
* @param contextFilePath
* @author ymiao
* @DateTime Aug 27, 2008
* @since 1.0.0
*/
private static void initContext(String contextFilePath){
if(contextFilePath == null)
contextFilePath = "applicationContext.xml";
context = new ClassPathXmlApplicationContext(contextFilePath);
}
}

CustomizedPropertyPlaceholderConfigurer类:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package cn.com.starit.kanms.util;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

public class CustomizedPropertyPlaceholderConfigurer extends
PropertyPlaceholderConfigurer {

private static Map<String, Object> ctxPropertiesMap;

@Override
protected void processProperties(
ConfigurableListableBeanFactory beanFactoryToProcess,
Properties props) throws BeansException {

super.processProperties(beanFactoryToProcess, props);
ctxPropertiesMap = new HashMap<String, Object>();
for (Object key : props.keySet()) {
String keyStr = key.toString();
String value = props.getProperty(keyStr);
ctxPropertiesMap.put(keyStr, value);
}
}

public static Object getContextProperty(String name) {
return ctxPropertiesMap.get(name);
}

}

spring task定时器的运用

发表于 2016-05-17   |   分类于 dialy   |  

Spring3.0以后自主开发的定时任务工具spring task ,可以将它看成是一个轻量级的Quartz,而且使用起来很简单,除spring相关的包外不需要额外的包,而且支持注解和配置文件两种。

第一种:配置文件

java web项目使用CORS方法实现跨域请求方案

发表于 2016-05-17   |   分类于 dialy   |  

问题产生背景

需要实现这样一个需求,在当前站点中使用ajax发送一个请求到另一个站点获取数据。js中使用jquery的ajax如下:

1
2
3
4
5
6
7
8
9
10
11
$.ajax({
url:http://219.151.48.39:8085/kanms_appServer/operationer/login,
data:{
"username": "test",
"password": "test"
},
type:'post',
dataType:'json',
success:function(data){
console.info(data);
});

结果在页面上出现以下错误提示:

1
2
3
XMLHttpRequest cannot load http://219.151.48.39:8085/kanms_appServer/operationer/login. 
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'null' is therefore not allowed access.

问题分析

网上查询得知原来是因为跨域的问题,javascript出于安全方面的考虑,不允许跨域调用其他页面的对象。

什么是跨域?
简单的理解就是因为javascript同源策略的限制,a.com域名下的js无法操作b.com或者c.a.com域名下的对象。更详细的说明可以看下表:

URL 说明 是否允许通信
http://www.a.com/a.js
http://www.a.com/b.js
同一域名下 允许
http://www.a.com/lab/a.js
http://www.a.com/script/b.js
同一域名下不同文件夹 允许
http://www.a.com:8000/a.js
http://www.a.com/b.js
同一域名不同端口 不允许
http://www.a.com/a.js
https://www.a.com/b.js
同一域名不同协议 不允许
http://www.a.com/a.js
http://70.32.92.74/b.js
域名和域名对应ip 不允许
http://www.a.com/a.js
http://script.a.com/b.js
主域相同,子域不同 不允许
http://www.a.com/a.js
http://a.com/b.js
同一域名,不同二级域名(同上) 不允许(cookie这种情况下也允许访问)
http://www.cnblogs.com/a.js
http://www.a.com/b.js
不同域名 不允许

经分析得知js中XMLHttpRequest对象不能加载跨域上的资源

解决办法

那么,怎样才能解决跨域访问资源的问题呢,主要有JSONP、flash、iframe、xhr2。这里介绍使用CORS(跨域资源共享,Cross-Origin Resource Sharing)的方法。

CORS原理:
CORS定义一种跨域访问的机制,可以让AJAX实现跨域访问。CORS 允许一个域上的网络应用向另一个域提交跨域 AJAX 请求。实现此功能非常简单,只需由服务器发送一个响应标头即可。

做法为:设置HTTP响应头Access-Control-Allow-Origin,指定服务器端允许进行跨域资源访问的来源域。可以用通配符*表示允许任何域的JavaScript访问资源,但是在响应一个携带身份信息(Credential)的HTTP请求时,Access-Control-Allow-Origin必需指定具体的域,不能用通配符。

这里使用Filter的方式给服务端的所有请求都加上Access-Control-Allow-Origin响应头,代码如下:
SimpleCORSFilter类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.ustcinfo.kanms.support;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;

public class SimpleCORSFilter implements Filter {

@Override
public void init(FilterConfig filterConfig) throws ServletException {

}

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {

HttpServletResponse res = (HttpServletResponse)response;
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
res.setHeader("Access-Control-Max-Age", "3600");
res.setHeader("Access-Control-Allow-Headers", "x-requested-with");
chain.doFilter(request, response);
}

@Override
public void destroy() {

}

}

web.xml中添加过滤器的配置

1
2
3
4
5
6
7
8
9
<!-- cors解决跨域访问问题 -->
<filter>
<filter-name>cors</filter-name>
<filter-class>com.ustcinfo.kanms.support.SimpleCORSFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>cors</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

加上以上代码后,使用原来的ajax访问跨域服务端信息的Response Header如下:

1
2
3
4
5
6
7
Access-Control-Allow-Headers:x-requested-with
Access-Control-Allow-Methods:POST, GET, OPTIONS, DELETE
Access-Control-Allow-Origin:*
Access-Control-Max-Age:3600
Content-Type:application/json;charset=UTF-8
Server:Jetty(8.1.10.v20130312)
Transfer-Encoding:chunked

并且可以通过ajax访问跨域服务器的资源了,大功告成。

更多阅读

  1. CORS维基百科
  2. 启用CORS实现Ajax跨域请求
  3. JavaScript跨域总结与解决办法
  4. SpringMvc+AngularJS通过CORS实现跨域方案

Hello World

发表于 2016-05-17   |  

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

play框架添加crud模块

发表于 2016-05-17   |   分类于 dialy   |  

问题背景

在play中添加模块

测试环境

  • play framework 1.4.1
  • jdk 1.8.0_66
  • Eclipse Luna (4.4)

添加模块的步骤

在一个已有的应用里面添加模块,这里以添加crud为例:

1.在依赖配置文件中添加crud的依赖

1
2
3
4
5
{app}/conf/dependencies.yml
===========================
require:
- play 1.4.1
- play -> crud

2.在控制台输入以下命令添加依赖的jar包或文件

1
2
3
在应用目录下
============
play dependencies

3.重新生成IDE的配置文件,这里是eclipse

1
2
3
4
5
在应用目录下,根据IDE选择其中一个命令
================================
play eclipsify
play netbeansify
play play idealize

4.IDE中(eclipse)刷新项目,crud的相关包和配置文件已加入项目
01-15-01-crud-imported.png

5.在应用中添加crud模块的route路由

1
2
3
4
{app}/config/routes
===================
# Import CRUD routes
* /admin module:crud

更多阅读

  1. Play 框架模块:Divide 和 conquer
  2. Setting up a basic administration area using CRUD
  3. 配置你喜欢的 IDE
12
codecly

codecly

千里之提,溃于蚁穴

16 日志
3 分类
23 标签
© 2016 codecly
由 Hexo 强力驱动
主题 - NexT.Pisces