今天在整合Spring和其他框架的时候在配置文件中添加<context:annotation-config />时一直有红色的波浪线在这个代码的下面,后来发现应该xml的头部没有申明context前缀。
所以使用下面的spring文件就可以
Spring 3.X如下:
<?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"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
Spring 2.x则将后缀
"...-3.x.xsd"
改为
"...-2.x.xsd"
分享到:
相关推荐
<context:annotation-config /> <context:component-scan base-package="com.mvc" /> <mvc:annotation-driven /> <mvc:resources mapping="/resources/**" location="/resources/" /> <mvc:default-servlet-...
<description>Spring公共配置文件</description> <!-- mes 的數據庫 --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" ...
<context:annotation-config></context:annotation-config> <context:component-scan base-package="org.whvcse"></context:component-scan> <tx:annotation-driven transaction-manager="txManager" /> <!-- ...
<context:annotation-config /> <!-- <bean id="sessionFactory"--> <!-- class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">--> <!-- <property name="configLocation"--> <!-- value=...
<context:annotation-config/> <!-- 扫描包 --> <context:component-scan base-package="com.org"/> <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver...
</beans><context:annotation-config/> <context:component-scan base-package="com.spring.*"/> 两行为开启spring的注解配置 <aop:aspect id="aspect" ref="logIntercepter"> 引入具体的AOP操作类 <aop:pointcut ...
<context:annotation-config/> <context:component-scan base-package="com.org.*" /> <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property...
<context:annotation-config/> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass" value="com.mysql.jdbc.Driver"></property> <property name="jdbc...
3,在web.xml中配置 spring 的 OpenSessionInView 过滤器(解决抛LazyInitializationException的问题) 1,配置 <!-- 配置 spring 的 OpenSessionInView 过滤器 --> <filter> <filter-name>...
<context:annotation-config/> <!-- 扫描包 --> <context:component-scan base-package="com.org.core"/> <bean id="jspViewResolver" class="org.springframework.web.servlet.view....
10. <context:annotation-config /> 11. <!-- 把标记了@Controller注解的类转换为bean --> 12. <context:component-scan base-package="com.mvc.controller" /> 13. <!-- 启动Spring MVC的注解功能,...
学习spring组件扫描(Component Scanning)的代码 ...<context:annotation-config /> <context:component-scan base-package="com.test"></context:component-scan> 2.在需要装配的类的上面全部加上@Component
<context:annotation-config/> <context:property-placeholder location="classpath:system.properties"/> <!--客户端配置--> <bean id="rpcClient" class="com.yingjun.rpc.client.RPCClient"> ...
spring mvc aop <context:annotation-config />
context:annotation-config:作用是可以使用@ Autowired,@ Inject等来省略xml配置文件中的属性属性,简化配置; context:component-scan:作用是可以使用@ Component,@ Controller,@ Service等等来省略xml...
在Spring1.2或之前的版本中,实现AOP的传统方式就是通过实现Spring的AOP API来定义Advice,并设置代理对象。Spring根据Adivce加入到业务流程的时机的不同,提供了四种不同的Advice:Before Advice、After Advice、...
查询出列表,也就是返回list, 在我们这个例子中也就是 List<User> , 这种方式返回数据,需要在User.xml 里面配置返回的类型 resultMap, 注意不是 resultType, 而这个resultMap 所对应的应该是我们自己配置的 ...
<tx:annotation-driven transaction-manager="txManager"/> * 创建dao层共同的接口,放置在cn.itcast.crm.dao下 public interface ICommonDao<T> { public void save(T entity); } * ...
spring配置文件中唯一需要配置的bean是WeixinConfigurer类,<context:component-scan base-package="com.github.jweixin.jwx.weixin.service" />是可选配置,但里面封装了微信接口服务类,建议一定要配置进spring...