我正在与以下配置的春天启动应用程序增加默认大小
@ConfigurationProperties(prefix= "app.sample")
@Component
public class PropGenerator{
private List<String> list;
public List<String> getList() {
return list;
}
public void setList(List<String> list) {
this.list = list;
}
}
我application.properties
以格式配置如下
app.sample.list 300项[0] =值1 。 。
app.sample.list [299] = value300
当我运行程序时,我得到下面的错误
Invalid list index in property path 'list[279]'; nested exception is java.lang.IndexOutOfBoundsException: Index: 279, Size: 251
Caused by: java.lang.IndexOutOfBoundsException: Index: 279, Size: 251
我如何可以手动覆盖列表的大小,让所有300值将自动填充在list
变量中?我遇到@InitBinder,但无法让它工作。