Spring使用注解的方式注入属性时的xml文件配置
2013-05-21 13:42
661 查看
@Resource默认按名称进行装配,如果找不到符合的名称,则按类型装配;@Autowired默认按类型进行装配
<?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-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <context:annotation-config/>
</beans>
<?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-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <context:annotation-config/>
</beans>
相关文章推荐
- 使用Spring配置shiro时,自定义Realm中属性无法使用注解注入解决办法
- Spring 配置bean, 注解方式配置 xml方式要生产set方法方便属性注入,注解方式不需要,利用反射机制注入
- Spring4----使用注解方式配置bean和bean的属性
- spring详解:使用注解方式注入属性
- Spring中使用事务搭建转账环境方法二 相对简便的注解方法 ——配置文件注入对象属性需要setter方法 注解方法,不需要生成setter方法
- 使用Spring配置shiro时,自定义Realm中属性无法使用注解注入解决办法
- Spring中使用事务搭建转账环境方法二 相对简便的注解方法 ——配置文件注入对象属性需要setter方法 注解方法,不需要生成setter方法
- 使用Spring配置shiro时,自定义Realm中属性无法使用注解注入解决办法
- Spring使用注解的方式配置bean的属性-bean之间的引用关系
- 使用Spring配置shiro时,自定义Realm中属性无法使用注解注入解决办法
- 使用Spring配置shiro时,自定义Realm中属性无法使用注解注入解决办法
- Spring AOP注解通过@Autowired,@Resource,@Qualifier,@PostConstruct,@PreDestroy注入属性的配置文件详解
- 详解Spring通过@Value注解注入属性的几种方式
- Spring中使用XML文件的方式配置事务
- spring学习笔记(12)——使用注解方式配置bean
- spring通过注解依赖注入和获取xml配置混合的方式
- Spring使用Aspectj注解的方式来配置AOP
- Spring框架 注解annotation和配置文件混合使用(生成对象与属性注入) xml配置文件没有提示解决
- Spring AOP注解通过@Autowired,@Resource,@Qualifier,@PostConstruct,@PreDestroy注入属性的配置文件详解
- Spring AOP注解通过@Autowired,@Resource,@Qualifier,@PostConstruct,@PreDestroy注入属性的配置文件详解