Java LazyList.decoration-InstanceFactory:构造函数必须存在并且是公共的

Java LazyList.decoration-InstanceFactory:构造函数必须存在并且是公共的,java,spring,spring-mvc,Java,Spring,Spring Mvc,我有这样的密码: public class User ... private List<Country> countries = LazyList.decorate(new ArrayList(), FactoryUtils.instantiateFactory(Country.class)); private String country; ... public void setCountries(List<Country> countries) {

我有这样的密码:

public class User   
...
private List<Country> countries = LazyList.decorate(new ArrayList(), FactoryUtils.instantiateFactory(Country.class));
    private String country;

...
public void setCountries(List<Country> countries) {
        this.countries = countries;
    }

    public List<Country> getCountries() {
        return countries;
    }
...
创建新用户对象时,我会给出以下例外情况:

java.lang.IllegalArgumentException:InstanceFactory:构造函数必须存在并且是公共的


有人知道为什么吗?

似乎你唯一的构造函数是:

public Country(int countryId, String countryName)
虽然工厂希望找不到arg构造函数(常见要求):

将它添加到您的
国家
课程中,您就会没事了

public Country(int countryId, String countryName)
public Country()