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,29 +1,21 @@
|
||||
package com.imyeyu.inject.annotation;
|
||||
|
||||
import com.imyeyu.inject.TimiInject;
|
||||
|
||||
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 注入程序,{@link TimiInject} 核心将基于此注解类的位置(或注解参数)进行包扫描和控制反转
|
||||
* 标记应用入口类并指定组件扫描路径
|
||||
*
|
||||
* @author 夜雨
|
||||
* @version 2022-03-04 23:32
|
||||
*/
|
||||
@Target({ElementType.TYPE})
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface TimiInjectApplication {
|
||||
|
||||
/**
|
||||
* 扫描包位置(如:com.imyeyu.inject),此包下的所有类将检测控制反转和注入,留空则使用注解的类所在包作为扫描位置。
|
||||
* <p><u>TimiInject 的所有注解在此包扫描范围内有效</u></p>
|
||||
*
|
||||
* @return 扫描包位置
|
||||
*/
|
||||
String[] value() default {};
|
||||
/**
|
||||
* 组件扫描的包路径
|
||||
*/
|
||||
String[] value() default {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user