一、 xml文件添加自动提示功能
xml文件的自动提示功能需要导入不同的相关xsd文件,下面以常用的beans及context来说明配置方法。
1.xml文件添加beans自动提示功能
Eclipse窗口选择
window – preferences – myeclipse – xml – xml catalog
选择User Specified Entries并点击add
Location:添加spring-beans-2.5.xsd文件所在路径
Key type:选择Schema location
Key:自动填充
确认后即有提示如图,
2. xml文件添加context自动提示功能
同理,
导入相关xsd文件
要想使用的话,还要在xml文件中加上下面几句话才行
<pre name="code" class="javascript">xmlns:context="http://www.springframework.org/schema/context"
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
<context:annotation-config />
<span style="font-size:18px;"><strong><span style="color:#ff00;"></textarea></span></strong></span>
如图,
二、java文件及注释自动提示
成功啦!一般的Java文件提示如图,
注释提示功能如图,
不过使用annotation注释功能也是要在xml配置文件中补充几句话的
用annotation必须加上四句话如下,
<pre name="code" class="html">xmlns:context="http://www.springframework.org/schema/context"
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
<context:annotation-config />
如图,
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<context:annotation-config />
<context:component-scan base-package="com.bjsxt"/>
<aop:aspectj-autoproxy />
要使用不同的注释的前提也是已经导入过相应的jar包了,不同的注释要导入的包不同,举例来说,
@RequestMapping 对应spring-web-3.2.8.RELEASE.jar
@Aspect 对应aspectjweaver-1.6.9.jar和aspectjrt-1.6.9.jar
具体的版本好像是无所谓的,我选的时候就是找了本地库中版本最新的,似乎版本不一致也没有什么太大影响的