implement lightweight IOC/DI framework
- Add annotation system (@Component, @Service, @Configuration, @Bean, @Inject, @Qualifier, @Primary, @Scope, @PostConstruct, @Import, @TimiInjectApplication) - Implement BeanContext for managing bean instances and definitions - Implement BeanScanner for component scanning (file system and jar) - Implement BeanFactory with constructor injection and lifecycle support - Support @Configuration and @Bean factory methods - Support @Qualifier and @Primary for multi-implementation - Support @Scope (singleton/prototype) - Support @PostConstruct lifecycle callback - Support @Import and Module extension - Add circular dependency detection - Add dependency graph export - Add demo and test cases Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -1,26 +1,22 @@
|
||||
package com.imyeyu.inject.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 控制反转(工具),注解在类上后该类将被 TimiInject 实例化并控制反转,后续执行注入
|
||||
* 工具类组件注解
|
||||
*
|
||||
* @author 夜雨
|
||||
* @version 2023-05-18 00:36
|
||||
*/
|
||||
@Target({ElementType.TYPE})
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Component
|
||||
public @interface Util {
|
||||
|
||||
/**
|
||||
* 工具名称,非空时注入需要明确执行
|
||||
*
|
||||
* @return 工具名称
|
||||
*/
|
||||
String value() default "";
|
||||
}
|
||||
/**
|
||||
* Bean 名称,默认为类名首字母小写
|
||||
*/
|
||||
String value() default "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user