首页 > 编程知识 正文

始终初始化成员变量(type.6),注解和注释

时间:2023-05-03 11:15:28 阅读:58889 作者:3523

新功能支持@Nullable注释

函数表达式样式GenericApplicationContext、annotationconfigapplicationcontext

bean API注册基本支持

@Nullable注释可用于方法、属性和参数

指示值为空

@空私有字符串id; @Nullable String getId (; publictvoidregisterbean @ nullablestringbeanname,ClassT beanClass,@Nullable SupplierT supplier,beandefinitioncustomion . }函数式样式genericapplicationcontextpackagecom.bri up.study.test; import com.bri up.study.entity.user; importorg.JUnit.Jupiter.API.test; importorg.spring framework.context.support.genericapplicationcontext; public class test _ spring5{ @ testpublicvoidtest _ genericapplicationcontext ()//1.genericapplicationcontext对象genenener context.registerbean('user ',User.class,()-new User ) ); //IOC上的User类//object user=context.get bean (' com.bri up.study.entity.user ' ); 对象用户1=context.get bean (user ); system.out.println(user1; }

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。