@Repository
@AllArgsConstructor
public class DataProvider {
@Value("${db.url}")
private String dbUrl;
}
IDE - idea
在IDE中安装插件,安装依赖项
import @ value from import org.springframework.beans.factory.annotation.Value;它是
1-验证您的导入,也许您从lombok导入的值是错误的,所以更改您的导入:
import lombok.Value;
:
import org.springframework.beans.factory.annotation.Value;