E.g. this works:
@ConfigurationProperties("config")
class Props {
@NotEmpty
private String value = "";
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
this doesn't
@ConfigurationProperties("config")
class Config {
@NotNull
// this works
private Props props = new Props();
public Props getProps() {
return props;
}
public void setProps(Props props) {
this.props = props;
}
@Validated // shouldn't be necessary, just tried it in case
public static class Props {
@NotEmpty
private String value = "";
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
}
This works:
@ConfigurationProperties("config")
class Config {
@NotNull
@Valid
private Props props = new Props();
public Props getProps() {
return props;
}
public void setProps(Props props) {
this.props = props;
}
public static class Props {
@NotEmpty
// doesn't work here
private String value = "";
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
}
@dsyer
why use it here? but others all wrong.
public static class Props
@shipengyan I'm not sure I understand the question, but here's not the best place to ask it. We like to keep the issue tracker purely for bugs and enhancements. The issue has also been closed for 2 years.
If have a general question you should ask on http://stackoverflow.com, or you can join us on http://gitter.im.
This comment is for people who still face this issue:
For me, the salvation was this:
@ConfigurationProperties("config")
@Validated <---------THIS
class Config {
It wasn't necessary the static class
Most helpful comment
This comment is for people who still face this issue:
For me, the salvation was this:
@ConfigurationProperties("config")
@Validated <---------THIS
class Config {
It wasn't necessary the static class