腾讯云
开发者社区
文档
建议反馈
控制台
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
登录/注册
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
(9999+)
视频
沙龙
1
回答
Spring
测试
中
的
@
ActiveProfiles
不再
支持
占位
符
placeholder
、
spring-test
、
spring-boot-2
、
spring5
我正在从
Spring
4.3升级到
Spring
5.3,似乎@ActiveProviles注释
不再
支持
占位
符
。以下代码适用于旧
的
Spring
版本: @RunWith(SpringRunner.class)@
ActiveProfiles
({"${profileA}","someProfileWithoutPlaceholdersAutowiredAnnotationBeanPo
浏览 43
提问于2021-01-27
得票数 0
2
回答
@值不能正常使用@
ActiveProfiles
java
、
spring
、
spring-boot
、
testing
、
spring-test
在我
的
项目中,我有几个使用@Value和概念
的
bean。 profiles:但是如果我使用@
ActiveProfiles
,就会有例外 “不能解析
占位
符
XXX”。@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironmen
浏览 4
提问于2021-12-19
得票数 2
回答已采纳
1
回答
@
ActiveProfiles
不适用于AbstractTestNGSpringContextTests
java
、
spring
我在
Spring
Boot应用程序
中
引入了配置文件,并将一些属性从application.properties转移到了application-puppet.properties。这在运行应用程序时工作得很好,但在
测试
时就不行了。在application.properties文件
中
添加了以下内容:并将一个属性从application.properties移动到应用程序-puppet.properties person.fileName=perso
浏览 1
提问于2016-03-09
得票数 3
1
回答
在春天从库伯奈特那里取回秘密
java
、
spring
、
spring-boot
、
kubernetes
我在Kubernetes
中
创建了一个秘密,并将其挂载到一个卷
中
,因此yaml文件
的
一部分如下所示: - name: test-keyreadOnly: true然后秘密本身包含:当试图在
Spring
中使用它时,我
的
问题就出现了。到目前为止,我尝试
的
是在application.properties
中
设置-> <em
浏览 5
提问于2022-08-23
得票数 0
1
回答
替换弹簧截面轮廓特定属性文件
中
的
属性
占位
符
java
、
spring
、
spring-boot
、
testing
、
spring-boot-test
我正在为一个
spring
boot应用程序编写一个
测试
,并且在特定于配置文件
的
应用程序属性文件中使用
占位
符
替换时,我遇到了一个奇怪
的
行为。我有一个这样
的
测试
类:@
ActiveProfiles
("mytestprofile") ....以及test/resources
中
相应
的
<em
浏览 13
提问于2020-05-26
得票数 0
1
回答
Spring
@
ActiveProfiles
不再
支持
逗号分隔
的
配置文件
spring
、
spring-boot
、
spring-boot-test
我们目前正在更新到
Spring
Boot 2.4.8 (
Spring
5.3.8),我们
的
集成
测试
失败了。 经过长时间
的
调试,我发现我们
的
@
ActiveProfiles
注解
不再
适用于两个配置文件。我们将其定义如下: @
ActiveProfiles
("dev,postgres") 然而,对于新
的
Spring
Boot版本,这
不再
加载我们
的
appl
浏览 38
提问于2021-08-27
得票数 0
2
回答
spring
boot在运行
测试
类时不挑选
测试
属性
spring-boot
、
spring-boot-test
我尝试了一个
spring
boot 2.4.0应用程序,写了一些
测试
。这是我
的
测试
类 @SpringBootTest@TestPropertySource(locations = "classpath:application-test.propertiespublic class SampleTest { public void testMethod1() { //
浏览 11
提问于2021-03-22
得票数 0
1
回答
@
ActiveProfiles
注释升级到2.4.2版本后无法工作
java
、
spring-boot
、
spring-test
以前,我们
的
应用程序基于SpringBootVersion2.2.2,我们
的
测试
之一是使用@
ActiveProfiles
("test")覆盖来自application.xml文件
的
SPRING
_PROFILES_ACTIVE
spring
.profiles.active=${
SPRING
_PROFILES_ACTIVE:} 但是,在我们将springboot升级到2.4.2版本之后,它就
不再
工作了,我们只能在
浏览 2
提问于2021-02-10
得票数 1
1
回答
Spring
安全x509
测试
不像我预期
的
那样工作。
spring
、
spring-boot
、
spring-security
、
x509
我有一个简单
的
应用程序做相互
的
TLS。实际上,当运行该应用程序时,一切都如我所期望
的
那样工作。@RunWith(SpringRunner.class)@WebMvcTest
浏览 2
提问于2018-08-29
得票数 2
回答已采纳
1
回答
Spring
:从
Spring
4.1.3
中
的
SPEL表达式中指定@调度
中
的
cron属性
spring
、
spring-batch
、
scheduling
、
spring-el
、
spring-scheduled
returnCron(){} 在我使用
的
Spring
4.1.3
中
,注释似乎不
支持
cron属性
的
占位
符
(我假设这就是出现错误
的
原因)。然而,在
中
,文档声明它
支持
占位
符
。
浏览 1
提问于2019-08-22
得票数 0
2
回答
导入具有特定配置文件
的
spring
上下文
spring
、
classpath
、
maven-3
、
spring-profiles
在我
的
web应用程序
中
,我使用多个
spring
上下文(每个项目的单个上下文)。现在,我
的
系统中有两个弹簧配置文件:
测试
和production,它们是由我
的
上下文使用
的
(为每个配置文件加载不同
的
属性位置持有者)。<!testMethod() { }在本例
中
,a.xml加载在“
测试
”配置文件
中
,并按预期
浏览 3
提问于2013-10-22
得票数 2
1
回答
元注释和
测试
类
中
的
@
ActiveProfiles
不起作用
spring
、
junit
、
annotations
、
spring-annotations
、
spring-test
我创建了一个meta注释@EmbeddedMongoDBUnitTest,它激活了两个配置文件,用于基于春季
的
单元
测试
中
。SpringJUnit4ClassRunner.class)@ContextConfiguration(...) ...现在,当尝试使用
测试
类本身
的
另一个@
ActiveProfiles
注释激活另一个配置文件时,@EmbeddedMongoDBUnit
浏览 4
提问于2014-10-03
得票数 7
回答已采纳
3
回答
在
Spring
PropertyPlaceHolderConfigurer
中
重写系统属性以进行集成
测试
spring
我使用一个系统属性来定义特定于环境
的
属性文件
的
位置。但是,对于集成
测试
,我想将该值重写为不同
的
值。<--
Spring
configuration in file service-
spring
-beans.xml这一切都如预期
的
那样起作用。但是,对于集成
测试
,我想将
浏览 3
提问于2013-07-19
得票数 1
回答已采纳
1
回答
Spring
@ConfigurationProperties
中
的
占位
符
spring-boot
您知道
Spring
是否
支持
@ConfigurationProperties
中
的
占位
符
吗?当我设置
spring
.boot.admin.client.serviceUrl=http://${server.address}:${server.port}${server.context-path}时,它将绑定到,但是
Spring
不会替换
占位
符
。
浏览 2
提问于2015-09-29
得票数 2
2
回答
如何禁用属性
占位
符
中
的
属性值插值
spring
我在应用程序上下文中使用
Spring
3和
Spring
的
属性
占位
符
:my.properties包含:key2=some JSP code ${some-model-attr} 问题是,my.properties
中
的
值也是根据
占位
符
计算
的
浏览 5
提问于2012-02-05
得票数 5
回答已采纳
1
回答
跨不同Spock
测试
重用
Spring
应用程序上下文
java
、
spring
、
testing
、
integration-testing
、
spock
我想在Spock框架
中
编写
的
几个集成
测试
中
重用相同
的
Spring
上下文。根据上下文缓存是基于classes属性
的
@ContextConfiguration注释。extends Specification { expect: }第二个
测试</em
浏览 0
提问于2019-04-10
得票数 0
1
回答
为什么我看到
spring
.embedded.kafka.brokers已经存在,但应用程序-test.yaml
中
没有填充${
spring
.embedded.kafka.brokers}?
java
、
spring
、
apache-kafka
、
spring-kafka
、
spring-kafka-test
我们使用
的
是@EmbeddedKafka,在application-test.yml
中
我们有 confluentBootstrapAddress: ${
spring
.embedded.kafka.brokers但是,如果在调试模式下选中此选项然后我可以看到这个值是存在
的
可能
的<
浏览 1
提问于2021-03-30
得票数 0
1
回答
基于XML
的
Spring
配置
中
与“属性
占位
符
”相结合
的
Spring
启动器
spring-boot
、
property-placeholder
> 根据下面的,
Spring
父程序将maven-resources-plugin
的
默认筛选令牌从${maven.token}更改为@maven.token@,以防止与
Spring
样式
占位
符
的
冲突。
的
键
的
属性扩展
不再
起作用。在我
的
"application-core.xml“
中
,我使用一个特定于
Spring
的
”属性-
占位
符</
浏览 3
提问于2016-12-18
得票数 0
1
回答
忽略属性
占位
符
-
Spring
java
、
spring
、
spring-boot
我使用下面的语句对应用程序依赖
的
jar文件
中
定义
的
所有bean进行组件扫描-我在其中一个寻找属性
占位
符
file:${service.propDir}.
的
spring
.xml
中
定义了一个beanbean
不再
是必需
的
,但我无法删除它,因为它是jar文件<em
浏览 5
提问于2017-01-03
得票数 0
1
回答
使用活动配置文件作为war构建
spring
引导应用程序
gradle
、
spring-boot
、
spring-profiles
我希望将我
的
春季引导应用程序打包为war,以获得特定
的
配置文件。这可以通过在
spring
.profiles.active=profile文件
中
设置application.properties名称来完成。在建立战争时,是否可以将其作为参数设置。
浏览 2
提问于2014-07-16
得票数 7
回答已采纳
点击加载更多
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
JPA+SpringData 操作数据库-使用正宗JPA语法操作数据库
传统Spring项目使用FeignClient组件访问微服务
在SpringBoot应用启动后,我们在调用某个实例之前想修改实例的属性应该怎么办?
Spring Cloud 2.x系列之配置中心
基于 SSM 集成sharding-jdbc2.0.3
热门
标签
更多标签
云服务器
即时通信 IM
ICP备案
对象存储
实时音视频
活动推荐
运营活动
广告
关闭
领券