首页>代码>spring bean通过@Lazy注解实现延迟初始化实例>/lazy-initialize-@autowired-dependency-@lazy-example/src/main/java/com/memorynotfound/spring/core/lazy/Person.java
package com.memorynotfound.spring.core.lazy;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

@Component
public class Person {

    private @Autowired @Lazy Address address;

    public Person() {
        System.out.println("Person initialized");
    }

    public Address getAddress() {
        return address;
    }
}
最近下载更多
最代码-宋家辉  LV61 2021年11月7日
最近浏览更多
80730176  LV7 2023年11月28日
szf123  LV12 2023年5月30日
我睡觉时不困  LV7 2022年10月30日
2468867327  LV10 2022年5月17日
xp95323  LV14 2022年1月25日
最代码-宋家辉  LV61 2021年11月7日
好好必须的快乐 2021年10月30日
暂无贡献等级
moonquake_lin  LV2 2021年9月8日
neikoneiko  LV9 2021年6月4日
xiao菜  LV2 2021年6月2日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友