腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
(9999+)
视频
沙龙
2
回答
Spring-boot:将
默认值
设置为可配置的属性
、
、
、
@Componentpublic class MyProperties { private String property2; }@Component @
ConfigurationProp
浏览 3
提问于2015-06-17
得票数 23
1
回答
使用
默认值
参数化Spring @Scheduled
、
、
我需要使用属性文件
中
的值来参数化@Scheduled方法,如果存在,则使用
默认值
。我们可以通过以下方式从配置文件属性
中
参数化:public void scheduledTask() {我尝试使用带有
默认值
的@
ConfigurationProperties
bean,但没有成功:@
ConfigurationProperties
(prefix = &qu
浏览 3
提问于2016-08-31
得票数 6
回答已采纳
2
回答
@
ConfigurationProperties
:绑定类
中
的
默认值
@Configurationpublic class FooConfig { private Integer iterations; 在我的类Foo
中
,当没有在属性文件
中
显式设置时config is bound (wins) in Foo
浏览 9
提问于2018-07-31
得票数 16
1
回答
ConfigurationProperties
中
默认值
、
、
对于Spring Boot @
ConfigurationProperties
,有没有指定
默认值
的方法?@
ConfigurationProperties
(prefix = "test.metrics", ignoreUnknownFields = false)@Data在Spring文档
中
似乎也找不到任何东西。
浏览 39
提问于2018-03-04
得票数 0
3
回答
Micronaut配置属性
默认值
假设我有以下配置类public class ApplicationConfiguration { Could not resolve placeholder ${app.uri} in value: ${app.uri}/some/pathapp: ur
浏览 0
提问于2019-03-30
得票数 1
回答已采纳
1
回答
Spring boot @Value SPEL
如果属性不存在或为null,我希望注入
默认值
prop.yml security: @Value("${security.disable ?security.disable : false}") 它工作正常,但是当我添加disable: true时,它不能读取值和注入
默认值
(False)
浏览 8
提问于2021-07-01
得票数 0
1
回答
静态使用@
ConfigurationProperties
-例如在@RequestMapping上
、
、
我有一个包含所有配置值及其
默认值
的@
ConfigurationProperties
(prefix = "my.configs")类,例如:private String path = "default-path" 理想情况下,我可以像这样在控制器
中
引用:@RequestMapping(path=${my.configs.path}),但这不起作用,Spring报告它无法找到该配置参数,如果我将其放入属性文件
中
,而不是放入类型安全的@
ConfigurationProperties
浏览 2
提问于2016-11-16
得票数 1
1
回答
Spring @
ConfigurationProperties
继承/嵌套
、
、
、
、
"size": 10, // default } }到目前为止,我已经尝试过跟踪,但它在继承
中
缺少
默认值
换句话说,
默认值
永远不会变成Shape的对象。@lombok.Data@
ConfigurationProperties
(prefix = "store") public class Catalog
浏览 1
提问于2017-03-28
得票数 3
回答已采纳
1
回答
带有@
ConfigurationProperties
和@Value的Spring注入值
、
、
如果yaml支持文件
中
没有定义属性,如何从yaml注入值并设置
默认值
?像下面这样使用
ConfigurationProperties
和Value是否是一个很好的用途?如果不是,我们如何才能做到这一点?prop1: test map: key2: value2@Data@
ConfigurationProperties
浏览 9
提问于2022-01-21
得票数 2
回答已采纳
2
回答
@
ConfigurationProperties
vs @PropertySource vs @Value
、
、
我知道我们可以在任何POJO类中使用@Value来设置application.properties或application.yml文件
中
字段的
默认值
。 Q1),但为什么我们还需要另外两个?@
ConfigurationProperties
和@PropertySource。Q2) @
ConfigurationProperties
和@PropertySource,都可以用来加载application.properties或application.yml文件中提到的外部数据吗
浏览 1
提问于2019-11-04
得票数 11
回答已采纳
1
回答
如何在Kotlin中使用@
ConfigurationProperties
、
、
my-map: - "test": "test" first: "abc"使用这个类:@
ConfigurationProperties
浏览 51
提问于2019-07-23
得票数 2
回答已采纳
1
回答
在spring application.properties
中
展开时缺少maven属性的
默认值
、
、
、
、
如果在application.properties
中
定义的属性@property.absent@无法展开(它不是在pom.xml
中
定义的),则绑定值为文字@property.absent@。有没有一种简单的方法可以用自定义
默认值
(例如null)覆盖它,例如。在与@
ConfigurationProperties
结合的自动配置
中
浏览 4
提问于2020-04-19
得票数 1
1
回答
在spring应用程序
中
,使用as字符串作为环境变量的值。
、
、
、
在我的spring引导应用程序
中
,我在
ConfigurationProperties
中
定义了一个具有
默认值
的模板字段(在Ascii
中
):@Setter@
ConfigurationProperties
("app.template") String greeting = "\u00bfQu那么,我应该如何从环境变量
中
获得正
浏览 5
提问于2021-02-27
得票数 0
回答已采纳
2
回答
我可以为Spring
中
的@Component类创建构造函数吗?
、
、
、
这是我的组件类@
ConfigurationProperties
(prefix = "default-values") countries.put("965 - Kuwait", "965"); 在我的application.yaml文件
中
,因为如果我想将它注入到另一个类
中
,就不能使用New关
浏览 3
提问于2019-12-12
得票数 1
回答已采纳
1
回答
如何调试Spring Boot @
ConfigurationProperties
?
、
、
它们都在同一个包
中
,它们都有相同的注释:@PropertySource("classpath:xxx.properties") @
ConfigurationProperties
浏览 13
提问于2018-07-25
得票数 3
2
回答
Spring
ConfigurationProperties
未从application.yml加载值(
默认值
)
、
PropertyLoader类不从application.yml加载"testValue“的
默认值
。@
ConfigurationProperties
(prefix="my-property")public class PropertyLoader { String testValue
浏览 1
提问于2021-04-21
得票数 0
2
回答
基于@
ConfigurationProperties
值的Spring条件
、
、
Spring使用@
ConfigurationProperties
注释为我们提供了类型的配置对象。其中一个优点是在使用Spring注释处理器时,可以在IDE
中
免费完成属性名。另一个是:验证。因此,我想在@
ConfigurationProperties
对象
中
声明这个属性:@
ConfigurationProperties
(prefix = "foo")bar; publ
浏览 0
提问于2018-03-07
得票数 29
1
回答
为什么在Spring
中
构建DataSource需要@
ConfigurationProperties
?
、
、
如果@
ConfigurationProperties
将属性绑定到一个对象
中
,那么@
ConfigurationProperties
在构建DataSource
中
的用途是什么?database1.datasource.driver-class-name=com.mysql.jdbc.Driver 数据源Bean: @Bean(name = "datasource1") @
ConfigurationProperties
进行了绑定,我们还需要将相同的注释放到data source builder
浏览 145
提问于2020-10-29
得票数 0
回答已采纳
1
回答
ConfigurationProperties
@DefaultValue @ConditionalOnProperty的分析组合
我得到了一个类(更具体地说,是一个记录) MyappProperties,它用@
ConfigurationProperties
注释,其中有很多配置选项。这些是类
中
的几个内部类(更具体地说,是内部记录),它们包含特定于我的应用程序的特定功能的配置选项。其中一个内部类
中
的配置选项writerImplementation具有一个带有@DefaultValue注释的
默认值
。@
ConfigurationProperties
(prefix = "myapp", ignoreUnknownField
浏览 10
提问于2022-07-21
得票数 1
5
回答
Spring
ConfigurationProperties
文件-提供
默认值
、
、
我有一个
ConfigurationProperties
类,看起来像这样(为了显示我需要的东西,去掉它) @
ConfigurationProperties
(prefix = "something")} 当我在我的application.yml文件中提供这段代码时,一切工作正常 something: otherProps: true 但是,如果我在yml文件
中
根本没有提供otherProps,那么在构造函数
中
自动装入OtherProps时,我会得到一个空指针异常。
浏览 1060
提问于2020-06-22
得票数 0
回答已采纳
点击加载更多
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
Python中定义函数时参数有默认值的小陷阱
MySQL 之默认值
python参数默认值
Jmeter元件HTTP请求默认值
Kotlin基础十一函数默认值
热门
标签
更多标签
云服务器
ICP备案
云直播
对象存储
腾讯会议
活动推荐
运营活动
广告
关闭
领券