腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
(9999+)
视频
沙龙
1
回答
使用
默认值
参数化Spring @Scheduled
、
、
我需要使用属性文件中
的
值来参数化@Scheduled方法,如果存在,则使用
默认值
。Scheduled(cron = "${my.task.cron-exec-expr}") // do something但是如果这个属性
不存在
我尝试使用带有
默认值
的
@
ConfigurationProperties
bean,但没有成功:@
Configuratio
浏览 3
提问于2016-08-31
得票数 6
回答已采纳
1
回答
@
ConfigurationProperties
的
默认值
不存在
、
、
在Spring Boot应用程序中,我有一个带有验证和
默认值
的
属性对象。考虑下面这个示例Spring Boot应用程序:public class DummyApplication { @
ConfigurationProperties
但它不应该为空,因为我在上面定义了一个
默认值
,并且没有在我
的
代码之外设置一个不同
的
值。怎么了?
浏览 4
提问于2018-08-14
得票数 1
回答已采纳
1
回答
如何将application.yml值默认为仅为空格?
、
我
的
application.yml
的
值如下:my-value: ${SOME_ENV_VAR:" "}如果SOME_ENV_VAR
不存在
,我希望它默认为三个空格字符。不幸
的
是,当我使用@
ConfigurationProperties
将其读入字符串时,其中包含引号。如果删除引号,则yaml格式错误,无法启动应用程序。有没有办法让我
的
默认值
只有3个空格字符?
浏览 1
提问于2021-10-18
得票数 0
1
回答
带有@
ConfigurationProperties
和@Value
的
Spring注入值
、
、
如果yaml支持文件中没有定义属性,如何从yaml注入值并设置
默认值
?像下面这样使用
ConfigurationProperties
和Value是否是一个很好
的
用途?如果不是,我们如何才能做到这一点?prop1: test map: key2: value2@Data@
ConfigurationProperties
浏览 9
提问于2022-01-21
得票数 2
回答已采纳
1
回答
无法解析application.properties中缺少属性
的
占位符值错误
、
我有以下Java类: @Component@
ConfigurationProperties
("audit")@Getteraudit.planner.collection-blacklist}'.split(',')}") } 这里,Application.properties文件中
不存在
audit.planner.c
浏览 22
提问于2020-10-29
得票数 1
回答已采纳
2
回答
Spring-boot:将
默认值
设置为可配置
的
属性
、
、
、
在我
的
spring-boot项目中,我有一个下面的属性类。文件中将
默认值
设置为其他一些属性。,其中"default value“被分配为property
的
默认值
,@
ConfigurationProperties
(prefix = "myprefix") private String pr
浏览 3
提问于2015-06-17
得票数 23
1
回答
Spring boot @Value SPEL
如果属性
不存在
或为null,我希望注入
默认值
prop.yml security: @Value("${security.disable ?security.disable : false}") 它工作正常,但是当我添加disable: true时,它不能读取值和注入
默认值
(False)
浏览 8
提问于2021-07-01
得票数 0
2
回答
@
ConfigurationProperties
:绑定类中
的
默认值
我有一个配置类FooConfig,其中我有一个绑定
的
类'Foo‘。@Configurationpublic class FooConfig { private Integer iterations; 在我
的
类Foo中,当没有在属
浏览 9
提问于2018-07-31
得票数 16
3
回答
Micronaut配置属性
默认值
作为一个事实,这可能是预期
的
行为。假设我有以下配置类public class ApplicationConfiguration { Could not resolve placeholder ${app.uri} in value: ${app.uri}/some/pathapp: uri: &
浏览 0
提问于2019-03-30
得票数 1
回答已采纳
1
回答
ConfigurationProperties
中
默认值
、
、
对于Spring Boot @
ConfigurationProperties
,有没有指定
默认值
的
方法?@
ConfigurationProperties
(prefix = "test.metrics", ignoreUnknownFields = false)@Data
浏览 39
提问于2018-03-04
得票数 0
1
回答
静态使用@
ConfigurationProperties
-例如在@RequestMapping上
、
、
让我们暂时忽略这样做是否是一个好主意,但是我正在为一个内部库创建Spring Boot AutoConfiguration,并且作为其中
的
一部分,我想自动注册一个接受GET/POST/DELETE请求
的
控制器我有一个包含所有配置值及其
默认值
的
@
ConfigurationProperties
(prefix = "my.configs")类,例如:private String path = "default-path我可以像这样在控制器中引用:@Request
浏览 2
提问于2016-11-16
得票数 1
1
回答
如何在Kotlin中使用@
ConfigurationProperties
、
、
我有这个自定义对象: var first: String = "1",) - "abc": "123"pair: second: "123"@Conf
浏览 51
提问于2019-07-23
得票数 2
回答已采纳
1
回答
Spring @
ConfigurationProperties
继承/嵌套
、
、
、
、
如何加载配置以创建形状
的
列表,该列表继承默认设置并支持重写? "id": "rectangle" ]}@Component @<
浏览 1
提问于2017-03-28
得票数 3
回答已采纳
1
回答
Spring Boot @
ConfigurationProperties
验证
、
、
我知道在Spring Boot @
ConfigurationProperties
中使用JSR303注释
的
可能性,但我有一些用例超出了这种可能性:现在,我在@PostConstruct中使用初始化方法,它工作得很好。我想知道是否有一种更具声明性
的
方式来验证
ConfigurationPr
浏览 1
提问于2016-04-05
得票数 3
2
回答
@
ConfigurationProperties
vs @PropertySource vs @Value
、
、
我是Spring/Spring Boot
的
新手。我想在Java文件中使用application.properties / application.yml
的
键值对数据。我知道我们可以在任何POJO类中使用@Value来设置application.properties或application.yml文件中字段
的
默认值
。 Q1),但为什么我们还需要另外两个?@
ConfigurationProperties
和@PropertySource。Q2) @
ConfigurationPrope
浏览 1
提问于2019-11-04
得票数 11
回答已采纳
2
回答
Spring
ConfigurationProperties
未从application.yml加载值(
默认值
)
、
PropertyLoader类不从application.yml加载"testValue“
的
默认值
。@
ConfigurationProperties
(prefix="my-property")public class PropertyLoader { String testValue
浏览 1
提问于2021-04-21
得票数 0
1
回答
为什么在Spring中构建DataSource需要@
ConfigurationProperties
?
、
、
如果@
ConfigurationProperties
将属性绑定到一个对象中,那么@
ConfigurationProperties
在构建DataSource中
的
用途是什么?Primary return DataSourceBuilder.create().build(); } 另外,如果数据源属性已经在单独
的
bean中使用@
ConfigurationProperties
进行了绑定,我们还需要将相同
的
注释放到data s
浏览 145
提问于2020-10-29
得票数 0
回答已采纳
1
回答
如何调试Spring Boot @
ConfigurationProperties
?
、
、
它们都在同一个包中,它们都有相同
的
注释:@PropertySource("classpath:xxx.properties") @
ConfigurationProperties
从现在开始,我应该怎么做才能获得不起作用
的
反馈?
浏览 13
提问于2018-07-25
得票数 3
5
回答
Spring
ConfigurationProperties
文件-提供
默认值
、
、
我有一个
ConfigurationProperties
类,看起来像这样(为了显示我需要
的
东西,去掉它) @
ConfigurationProperties
(prefix = "something")} @Data} 当我在我
的
application.yml我
的
期望是它将缺省为true,我已经尝试使用@NotNul
浏览 1060
提问于2020-06-22
得票数 0
回答已采纳
1
回答
在spring application.properties中展开时缺少maven属性
的
默认值
、
、
、
、
如果在application.properties中定义
的
属性@property.absent@无法展开(它不是在pom.xml中定义
的
),则绑定值为文字@property.absent@。有没有一种简单
的
方法可以用自定义
默认值
(例如null)覆盖它,例如。在与@
ConfigurationProperties
结合
的
自动配置中
浏览 4
提问于2020-04-19
得票数 1
点击加载更多
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
CSS基础之块元素的宽高默认值
Python中定义函数时参数有默认值的小陷阱
简单数据库操作9—默认值的填充default约束
不存在的
解压密码,不存在的!
热门
标签
更多标签
云服务器
ICP备案
云直播
对象存储
腾讯会议
活动推荐
运营活动
广告
关闭
领券