@Scope、@Singleton源码翻译
来源:互联网 发布:成都网络车新规 编辑:程序博客网 时间:2024/05/16 15:09
package javax.inject;import java.lang.annotation.Target;import java.lang.annotation.Retention;import java.lang.annotation.Documented;import static java.lang.annotation.RetentionPolicy.RUNTIME;import static java.lang.annotation.ElementType.ANNOTATION_TYPE;/** * 目的:定义bean的作用域 * 标识@scope注解,该注解用在可注解构造器的一个类上,决定注射器怎样重新使用实例。默认,若果没有该注解时, * 注射器通过构造器创建一个实例,之后便忽略它。使用该注解时,注入之后,注射器可能重用该实例。多线程访问域内 * 访问实例,则是线程安全的。注射器能够决定注入实例的使用范围。 * * 以下例子,@Singleton(单例模式)注解范围用在日志实例: * @Singleton * class Log { * void log(String message) { ... } * } * @author TCM * @create 2017年10月19日下午3:58:28 * @see javax.inject.Singleton @Singleton */@Target(ANNOTATION_TYPE)@Retention(RUNTIME)@Documentedpublic @interface Scope {}
package javax.inject;import java.lang.annotation.Documented;import java.lang.annotation.Retention;import static java.lang.annotation.RetentionPolicy.RUNTIME;/** * 目的:注解为单例实例,不能继承 * @author TCM * @create 2017年10月20日上午9:19:21 * @see javax.inject.Scope @Scope */@Scope@Documented@Retention(RUNTIME)public @interface Singleton {}
阅读全文
0 0
- @Scope、@Singleton源码翻译
- spring scope="prototype" 和scope="singleton"区分
- spring scope="prototype" 和scope="singleton"区分
- spring scope="prototype" 和scope="singleton"区分
- spring scope="prototype" 和scope="singleton"区分
- spring scope="prototype" 和scope="singleton"区分
- spring scope="prototype" 和scope="singleton"区分
- spring scope prototype与singleton区别
- 【Spring】scope:"singleton"与"prototype"学习记录
- Spring中scope singleton 和 prototype详解
- spring scope prototype与singleton区别
- spring scope prototype与singleton区别
- bean的scope属性和singleton属性
- spring scope prototype与singleton区别
- spring 中scope的singleton和prototype区别
- Spring 受管理 Bean scope 的 prototype 和 singleton 区别
- Spring Bean Scope Singleton Prototype 相互引用说明
- Spring中scope属性singleton和prototype使用的区别
- 洛谷3928 一道简单题
- 获取Linux下的IP地址
- NOIP2011选择客栈
- 熊猫学猿--第五竹(输出)
- PHP实现保留两位小数的三种方法
- @Scope、@Singleton源码翻译
- 怎么学习C++
- 读《一碟腌菜》
- 谈谈自己对链表的理解
- 数据结构--线性表的顺序表示及操作
- 将相同后缀的所有文件复制到指定的路径下
- Layui 代码装饰器
- 块级元素
- Codeforces Round #441 E. National Property (2-sat tarjan后输出任意一组合法解)