refactor: optimize string concatenation and add startup statistics

- Replace string concatenation with .formatted() method for better readability
- Add StartupStatistics class to track initialization metrics
- Add detailed startup logging with timing information
  - Scan time
  - IOC time
  - Injection time
  - PostConstruct time
  - Total startup time
- Add banner output support (banner.txt or defBanner.txt)
- Add @Lazy annotation support for lazy initialization

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Timi
2026-01-13 01:41:49 +08:00
parent 93bcc9b5c6
commit f5c6dcd275
10 changed files with 890 additions and 659 deletions

View File

@@ -6,11 +6,11 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 标记用于依赖注入的构造器
* 标记用于依赖注入的构造器或字段
*
* @author 夜雨
*/
@Target(ElementType.CONSTRUCTOR)
@Target({ElementType.CONSTRUCTOR, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Inject {
}

View File

@@ -0,0 +1,17 @@
package com.imyeyu.inject.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 标记 Bean 为懒加载
* 等同于 @Scope(value = ScopeType.SINGLETON, lazy = true)
*
* @author 夜雨
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Lazy {
}

View File

@@ -18,4 +18,11 @@ public @interface Scope {
* 作用域类型
*/
ScopeType value() default ScopeType.SINGLETON;
/**
* 是否懒加载(仅对 SINGLETON 作用域有效)
* true - 首次使用时才创建
* false - 启动时立即创建(默认)
*/
boolean lazy() default false;
}