When using the following code snippet:
public class MyUrls {
// properties get initialized using static{...}
public final static String URL_HOMEPAGE = properties.getProperty("app.homepage");
}
@Controller
public class HomepageController {
@RequestMapping(MyUrls.URL_HOMEPAGE)
public String homepage() {
return "/homepage/index";
}
}
I get the following error:
The value for annotation attribute RequestMapping.value must be a constant expression
But in fact, URL_HOMEPAGE
does be a constant, since it is declared as public final static
. Am I wrong? How to solve this issue?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…