利用MyEclipse添加Spring2.5的支持库开发AOP的话,虽然引入了AOP的支持包,但是配置文件却不支持AOP配置。Eclipse自动生成的ApplicationContext.xml文件命名空间如下:
<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.5.xsd"></beans>。
为了支持AOP,需要加入spring-aop-2.5.xsd。给文件位于%SPRING_HOME%dist esources目录中。这个目录有很多资源文件,根据不同的需要选择添加,我们只需要spring-aop-2.5.xsd。修改后的头部变成了这样:
<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.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"></beans>。
这样Eclipse就支持AOP配置了。配合代码提示键就可以方便开发了。
版权声明
本文仅代表作者观点,不代表百度立场。
本文系作者授权百度百家发表,未经许可,不得转载。




