【发布时间】:2022-04-22 13:56:38
【问题描述】:
这是一个例子:
public class Dog implements Animal{
private String color;
@Inject
private Owner owner;
//This constructor always used to build the Dog object.
public Dog(){}
public Dog(String random){}
}
这是限制还是默认行为?有没有办法使用参数化构造函数来构建 Dog 对象?这似乎是一个限制,所以我必须遗漏一些东西。
【问题讨论】:
标签: java constructor dependencies guice code-injection