Eclipse中Java、XML文件、注释等各种自动提示功能配置

一、 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

具体的版本好像是无所谓的,我选的时候就找了本地库中版本最新的,似乎版本不一致也没有什么太大影响

  • 5
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值