spring 注解使用
来源:互联网 发布:java经典书籍推荐 编辑:程序博客网 时间:2024/06/04 23:21
<context:annotation-config>
1 autowired
@Autowired(required=false) //允许null
@Qualifier("name1")
@Strummed
private Object value;
<bean class=""><qualifier value="name1"/></bean>
2 inject
@Inject //不允许null
@Named("name1")//标记id
private Object value2;
3 value表达式
@Value("#{systemProperties.myFavoriteSong}")
private String song; //spel表达式
-------------------------------------------------------------------------------
自动注册bean
<context:component-scan base-package="" />
@component
@Controller
@RequestMapping
<context:component-scan base-package="" ><context:include-filter type="assignable" expression=""/></context:component-scan>
<context:component-scan base-package="" ><context:exclude-filter type="annotation" expression=""/></context:component-scan>
@Configuration
public class Stage {
@Bean
private Performer duke(){
return new Juggler(15);
}
@Bean
private Juggler duke2(){
return new PoeticJuggler(duke());
}
}
- spring 注解使用小结
- spring 注解使用
- 在spring使用注解
- Spring注解使用
- spring注解的使用
- Spring使用注解装配
- spring @Qualifier注解使用
- Spring使用IOC注解
- spring chache 注解使用
- Spring注解的使用
- spring注解的使用
- Spring注解的使用
- 如何使用Spring 注解
- Spring 使用注解
- Spring使用注解事务管理
- spring 注解使用
- 使用注解配置spring
- spring注解的使用
- java设计模式之外观模式(门面模式)
- Spring之配置文件加载方式
- 使用Mybatis做批量Insert
- PHPExcel使用(二)
- Python安装及Scrapy配置中遇到的BUG及解决方案
- spring 注解使用
- JVM调优1
- 2016北航机试枚举类型转换
- js 浮点加减乘除
- 蓝桥杯 ADV-173 算法提高 淘淘的名单
- VMware + ubuntu 编译android7.0
- 阿里云linux上安装Java
- 35选7不重复
- DelephiForm的borderstyle