報錯信息:Expected '$(student - name)' to be an inline constant of type java.lang.String in @org.springframework.beans.factory.annotation.Value
這樣使用會報錯,原因是 Gradle和Springboot佔位符衝突;解決方法就是將$符號轉義以下即可
@Value("\${student-name}")
private String fooBar;
報錯信息:Expected '$(student - name)' to be an inline constant of type java.lang.String in @org.springframework.beans.factory.annotation.Value
這樣使用會報錯,原因是 Gradle和Springboot佔位符衝突;解決方法就是將$符號轉義以下即可
@Value("\${student-name}")
private String fooBar;