使用Spring IDE向spring配置添加新的命名空间声明

时间:2009-11-11 08:19:08

标签: eclipse spring-ide

我有一个带有以下命名空间声明的Spring配置文件spring-idol.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans  
  http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

     ....

</beans>

我想为AOP添加名称空间声明

<?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:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop 
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

    ...

</beans>

有没有办法使用Spring IDE?现在,我能想到的唯一方法是使用aop命名空间声明创建一个新的spring配置文件,然后将声明从那里复制并粘贴到我的bean所在的配置文件中。

1 个答案:

答案 0 :(得分:6)

Open with -> Spring Config Editor为您提供标签式视图。其中一个选项卡是命名空间选项卡,您可以在其中添加其他命名空间。在那里,您可以为aop,context,util,batch等选择版本化或非版本化的模式文件

顺便说一句。如果要添加非spring命名空间(例如对于apache cxf),请使用Open with -> XML Editor并在根元素上执行edit namespaces