@Nullable注解
| @Nullable |
| public String add(){ |
| } |
| public String add(@Nullable String id){ |
| } |
| @Nullable |
| private String id; |
GenericApplicationContext
| # 实体类 |
| public class User { |
| } |
| |
| # 测试方法 |
| @Test |
| public void testGenericApplicationContext1() { |
| |
| GenericApplicationContext context = new GenericApplicationContext(); |
| |
| context.refresh(); |
| context.registerBean(User.class, () -> new User()); |
| |
| User user = (User)context.getBean("com.atguigu.spring5.test.User"); |
| System.out.println(user); |
| } |
| |
| # 控制台 |
| org.example.demo10.test.User@55182842 |
| # 实体类 |
| public class User { |
| } |
| |
| # 测试方法 |
| @Test |
| public void testGenericApplicationContext2() { |
| |
| GenericApplicationContext context = new GenericApplicationContext(); |
| |
| context.refresh(); |
| context.registerBean("user1",User.class,() -> new User()); |
| |
| User user = (User)context.getBean("user1"); |
| System.out.println(user); |
| } |
| |
| # 控制台 |
| org.example.demo10.test.User@55182842 |
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决
· 提示词工程——AI应用必不可少的技术