在Spring Boot中,为什么解析了@Value("#{servletContext.contextPath}")而不解析了@Value("${servletContext.contextPath}")?
发布于 2018-08-06 17:49:25
#{servletContext.contextPath}使用servletContext bean对表达式求值,从而调用ServletContext.getContextPath()。
${servletContext.contextPath}解析了一个名为servletContext.contextPath的属性,该属性通常不存在。
在Spring Framework文档的4. Spring Expression Language (SpEL)章中详细解释了SpEL。
https://stackoverflow.com/questions/51704774
复制相似问题