application.properties 中的 SpringBoot 未知属性 [英] SpringBoot unknown property in application.properties

查看:172
本文介绍了application.properties 中的 SpringBoot 未知属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Spring Initializr 生成了一个 Spring Boot Web 应用程序,使用嵌入式 Tomcat + Thymeleaf 模板引擎.

我将此属性放在我的 application.properties 中

default.to.address=nunito.calzada@gmail.com

我使用 Spring Tool Suite 版本:3.8.4.RELEASE 作为开发环境,但我在编辑器中收到此警告 'default.to.address' is an unknown property.>

我应该将此属性放在另一个属性文件中吗?

解决方案

这是因为它由 STS 属性编辑器打开,该编辑器验证属性以及其他内容.将它放在 application.properties 文件中没有坏处,您甚至可以为该属性添加自己的元数据.

http://docs.spring.io/spring-boot/docs/current/reference/html/configuration-metadata.html

I've generated a Spring Boot web application using Spring Initializr, using embedded Tomcat + Thymeleaf template engine.

I put this property in my application.properties

default.to.address=nunito.calzada@gmail.com

I am using Spring Tool Suite Version: 3.8.4.RELEASE as a development environment, but I got this warning in the Editor 'default.to.address' is an unknown property.

Should I put this property in another property file ?

解决方案

It's because it's being opened by the STS properties editor which validates properties amongst other things. There's no harm in having it in the application.properties file, you can even add your own meta-data for the property.

http://docs.spring.io/spring-boot/docs/current/reference/html/configuration-metadata.html

这篇关于application.properties 中的 SpringBoot 未知属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆