【问题标题】:I would want to know whether the below code is correct我想知道下面的代码是否正确
【发布时间】:2020-07-12 11:09:01
【问题描述】:

下面的代码是否正确。如果自动装配正确。是在俯瞰什么吗?

 @Component
    public class SampleBean {

    @Autowired
    private Bean1 b1;
    
    @Autowired
    private Bean2 b2;
    
    
    private String property;
    
    public SampleBean(Bean1 b1, Bean2 b2) {
        this.b1 = b1;
        this.b2 = b2;
    }
    
    
    }

【问题讨论】:

    标签: spring dependency-injection


    【解决方案1】:

    这可能是正确的,这取决于其他课程 - 但是在没有具体问题的情况下进入 StackOverflow 比假设某人在 21 世纪的性别更危险,换句话说 - 买一本关于 Spring 和不要只是要求检查您的代码

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-24
      • 1970-01-01
      • 2021-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多