MyEclipse手工添加spring XML文件模板
2013-06-15 19:55
267 查看
近断时间在看Spring(夏昕的开发指南),试着在Eclipse中试试,没想不懂还就是不懂啊,第1个例子都没整出来,后来才弄明白是那个bean.xml没写对。往后看了几页才晓得,我的Eclipse3.1.1装了MyEclipse4.0.2GA,但是那个里面的XML(for Template)中模板只有4个,有WEB和Structs的,没有Spring,于是就有了这个念头,自己加一个模板进去。这样以后开发就不用记那样条目了。
在Eclipse中新建XML文件:
已安装了MyEclipse插件,新建中在MyEclipse分支下有个XML,点击XML(from Template)利用其自带模板新建.
现举例加入Spring的bean.xml配置文件的模板.
1.打开目录 myeclipse\eclipse\plugins\com.genuitec.eclipse.wizards_4.0.1
其中涉及文件为:templates.properties,这是一个模板的配置文件
打开可以见到:
# HTML Templates
xml.template.1=Templates/Xml.xml
xml.template.1.label=Default XML template
xml.template.2=Templates/WebXml.xml
xml.template.2.label=XML template for a web.xml file
xml.template.3=Templates/WebXmlStruts.xml
xml.template.3.label=XML template for a web.xml file with Struts
xml.template.4=Templates/StrutsConfig.xml
xml.template.4.label=XML template for a struts-config.xml file
这样(39-47行).这既为在Eclipse中向导中出现的项目
2.现在手工进行更改配置文件
在其中加入:
xml.template.5=Templates/Spring.xml
xml.template.5.label=XML template for a Spring file
意为添加一项,模板文件是templates目录下的spring.xml文件
3.加入模板文件
在/Templates目录下新建一个"Spring.xml"文件:
4.完成.重入Eclipse即可见到效果
这个XML的内容是照书上抄的。
原文出处:http://www.blogjava.net/tw-ddm/articles/34402.html
在Eclipse中新建XML文件:
已安装了MyEclipse插件,新建中在MyEclipse分支下有个XML,点击XML(from Template)利用其自带模板新建.
现举例加入Spring的bean.xml配置文件的模板.
1.打开目录 myeclipse\eclipse\plugins\com.genuitec.eclipse.wizards_4.0.1
其中涉及文件为:templates.properties,这是一个模板的配置文件
打开可以见到:
# HTML Templates
xml.template.1=Templates/Xml.xml
xml.template.1.label=Default XML template
xml.template.2=Templates/WebXml.xml
xml.template.2.label=XML template for a web.xml file
xml.template.3=Templates/WebXmlStruts.xml
xml.template.3.label=XML template for a web.xml file with Struts
xml.template.4=Templates/StrutsConfig.xml
xml.template.4.label=XML template for a struts-config.xml file
这样(39-47行).这既为在Eclipse中向导中出现的项目
2.现在手工进行更改配置文件
在其中加入:
xml.template.5=Templates/Spring.xml
xml.template.5.label=XML template for a Spring file
意为添加一项,模板文件是templates目录下的spring.xml文件
3.加入模板文件
在/Templates目录下新建一个"Spring.xml"文件:
#---------------------------------------------# # <aw:description>Template for a WebXml file for Spring</aw:description> # <aw:version>1.0</aw:version> # <aw:date>02/22/2006</aw:date> # <aw:author>Tw DDM</aw:author> #---------------------------------------------# <?xml version="1.0" encoding="<aw:encoding/>"?> <!DOCTYPE web-app PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <description>This a description</description> <bean id="TheAction" class="net.ddm.MyAction" singleton="true" init-method="init" destory-method="close" depends-on="ActionManager" > <property name="message"> <value>HeLLo</value> </property> <property name="desc"> <null/> </property> <property name="dataSource"> <ref local="dataSource"/> </property> </bean> <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean" > <property name="jndiName"> <value>java:comp/env/jdbc/sample</value> </property> </bean> </beans>
4.完成.重入Eclipse即可见到效果
这个XML的内容是照书上抄的。
原文出处:http://www.blogjava.net/tw-ddm/articles/34402.html
相关文章推荐
- MyEclipse添加xml文件自动提示方法,以spring配置文件为例
- myeclipse中手工添加dtd支持
- 使用自定义模板为Myeclipse添加新建Filter的功能
- MyEclipse中修改和添加常用文件模板
- 在myeclipse10环境下,用hibernate反向生成工具生成pojo文件,并自动按照模板文件添加注释
- 如何为Myeclipse手工添加dtd支持
- MYECLIPSE FOR SPRING2014添加tomcat8服务器(win8.1,64位)
- SpringBoot添加freemarker模板引擎
- 新浪旧事-把自己的jsp或html模板添加到myeclipse中
- MyEclipse 添加xml文件alt+/快捷提示功能
- 使用myeclipse搭建SpringBoot框架,整合thymeleaf模板和mybatis
- myeclipse中手工添加dtd支持
- myeclipse 10 添加xml文件所使用的dtd
- Spring Boot添加JSP模板
- (转)添加eclipse、MyEclipse、Spring Tool Suite的反编译插件
- Spring Boot添加JSP模板
- Spring 4 使用Freemarker模板发送邮件&添加附件
- MyEclipse中添加Spring
- 添加eclipse、MyEclipse、Spring Tool Suite的反编译插件
- MyEclipse中Spring的jar包未添加完整处理方法