腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
1
回答
Spring
Boot
中
的
完全
验证
测试
,
注入
失败
、
、
、
大家好,我想在我
的
Spring
Boot
应用程序
中
测试
一个请求
的
完整
验证
,我
的
意思是不是一次只
测试
一个
验证
器,而是在目标对象上
测试
所有
验证
器)public class UserCreationRequest= null;}@RunWith(SpringRunner.clas
浏览 4
提问于2018-01-10
得票数 2
回答已采纳
1
回答
java.lang.IllegalArgumentException:无法实例化接口org.springframework.context.ApplicationListener
、
、
、
、
我是Mockito
的
新手,我正在尝试为Main Class编写单元
测试
,面临一些无法实例化bean
的
问题。请任何人帮助我解决这个问题。如果有人给我建议,如何在mockito
中
为下面的类编写单元
测试
。主类import org.springframework.
boot
.autoconfigure.SpringBootApplication; import
浏览 7
提问于2021-11-09
得票数 0
5
回答
在类级别进行
验证
时,ConstraintValidator依赖项
注入
会导致ValidationException
、
、
、
在类级别评估
的
ConstraintValidator中使用依赖
注入
时,我遇到了意外
的
行为。DemoEntity { @GeneratedValue(strategy = GenerationType.IDENTITY)
验证
注释DemoEntity demoEntity, ConstraintValidatorContext constraintValidatorContext) { }
浏览 5
提问于2019-06-27
得票数 8
1
回答
使用Http.outboundGateway()和已配置
的
RestTemplate
测试
spring
集成流程
、
、
、
我遇到过这样一种情况:我正在为依赖于执行身份
验证
的
configure RestTemplate
的
IntegrationFlow编写单元
测试
。) } } 我在建立@Autowired是模拟
的
restTemplate
的
测试
时遇到了困难。flowRegistration.getMessagingTempl
浏览 26
提问于2021-09-13
得票数 1
回答已采纳
2
回答
将bean
注入
到使用mockito创建
的
mock
中
、
、
、
、
更确切地说,我无法将userRepository bean
注入
到我
的
模拟服务
中
。对于依赖
注入
,我使用
Spring
Boot
。createToken(user); // creates token to my user }在我
的
测试
方法
中
UserService.class); doNothing(userServi
浏览 3
提问于2018-05-23
得票数 3
1
回答
NPE使用嵌入式Kafka
测试
Kafka生成器
、
、
、
、
当且仅当该
测试
类
中
的
测试
使用项目根目录
中
的
“mvn clean”与
失败
的
测试
一起运行时,NPE才会出现。注释掉这个类
中
的
测试
或者用@DirtiesContext注释它可以解决这个问题。显然,这个
测试
类加载到
spring
上下文中
的
某些东西会导致另一个
测试
中
的
时间/事件
浏览 22
提问于2021-04-21
得票数 1
回答已采纳
1
回答
@CurrentSecurityContext总是在mockMvc集成
测试
中
注入
null?
、
、
、
、
我使用
spring
安全注释@CurrentSecurityContext
注入
身份
验证
对象。这在应用程序运行时运行良好,但在@SpringBootTest
中
,它总是
注入
null,即使使用@WithMockUser也是如此。添加断点时,SpringSecurityContext
中
的
身份
验证
对象正确地填充了模拟用户主体,但是@CurrentSecurityContext解析器,即:从未使用CurrentSecurityContextArgumentResol
浏览 13
提问于2021-12-22
得票数 0
1
回答
强制断开
的
Resilience4j断路器属性
、
、
我可以使用以下代码以编程方式将状态设置为强制打开:CircuitBreaker Forced Open State 但是,有没有办法设置一个属性,以便在应用程序启动时立即将状态设置为此状态,以便可以用于
测试
浏览 14
提问于2019-09-21
得票数 1
回答已采纳
1
回答
有谁知道@Valid为什么在javax.validation
中
失败
并使用
spring
验证
吗?
、
、
、
中
我使用
的
是javax.validation依赖项,当我使用该依赖项运行
测试
时,@Valid注释没有工作,因为它返回了HttpStatus.OK (200)而不是坏
的
请求(400),这是应该
的
,因为该书
的
以下是使用javax设置gradle文件
中
的
依赖项部分
的
方式: implementation 'org.springframework.
boot
:
spring<
浏览 2
提问于2021-07-26
得票数 0
回答已采纳
2
回答
Spring
Boot
:存储库在自定义
验证
器
中
不自动更新
、
、
我有一个自定义
验证
器,它使用存储库
验证
针对DB
的
数据:@Target(ElementType.FIELD)依赖项: <groupId>org.springframework.
boot
</groupId> <artifactId>
spring
-
boot
-starter-data-jpa><e
浏览 8
提问于2022-05-07
得票数 0
1
回答
应用
Spring
Boot
插件时找不到包
、
、
、
'org.springframework.
boot
:
spring
-
boot
-starter-tomcat' implementation project' exclude,
测
浏览 69
提问于2020-11-30
得票数 1
回答已采纳
1
回答
捆绑包激活后未激活OSGI组件
、
我在OSGI中使用了
spring
-
boot
。在bundle activator
中
,
spring
-
boot
应用程序成功启动。我有一个组件类,如下所示 @Service //
spring
-
boot
annotationpublicReference public void set(ServiceComponentXXX a) {
浏览 13
提问于2019-04-10
得票数 0
2
回答
Spring
Boot
@ConfigurationProperties
验证
测试
失败
、
我想写一个@NotNull
的
测试
,@ConfigurationProperties
的
@NotEmpty
验证
。@Validated @NotNull private String baseUrl;我
的
测试
如下所示,它报告在运行
测试
之前启动应用程序
失败
:APPLICATION FAILED
浏览 5
提问于2018-07-26
得票数 4
1
回答
Junit5
测试
无法
注入
依赖项,但正常运行
的
应用程序可以
注入
依赖项
、
、
、
、
我创建了一个服务,就像其他现有的服务一样,然后尝试将该@Service注释类
注入
到带有@RestController注释
的
控制器
中
。它工作得很好,能够正常运行应用程序,没有问题,也就是没有
注入
问题。现在,当我尝试运行现有项目的
测试
时,它
失败
了,因为我
的
服务无法
注入
到控制器类
中
。Dependency annotations: {} 现在我厌倦了字段和构造器
注入
,每次都得到相同
的
问题,但我遵循了项目以前
浏览 103
提问于2021-04-06
得票数 2
回答已采纳
1
回答
Spring
Boot
+
Spring
Security Restful登录
、
、
、
、
我该如何使用java配置而不是xml来保护具有
spring
安全性
的
spring
boot
web服务?我需要这是一个伪RESTful服务,它在身份
验证
失败
时返回401响应码,并且不涉及自定义登录页面。在成功进行身份
验证
时,应该返回JSESSIONID,然后随每个请求一起发送。 有没有人能在我
完全
迷路
的
情况下提供一个如何做到这一点
的
示例?
Spring
指南(无论出于何种原因)都没有涵盖使用
spr
浏览 3
提问于2015-03-04
得票数 1
2
回答
Spring
boot
验证
CGLIB增强型控制器组件未自动连接
、
、
、
我已经创建了一个带有Rest控制器
的
spring
引导应用程序(用户
spring
-
boot
-starter-parent V.2.2.RELEASE),工作正常,现在我添加了一个依赖项到: <groupId>org.springframework.
boot
</groupId> <artifactId>
spring
-
boot
-starter-v
浏览 20
提问于2020-11-22
得票数 0
2
回答
Spring
Cloud Contract --没有名为“
验证
”
的
bean可用
、
、
我有一个运行
spring
cloud contract
的
spring
启动应用程序Contract.make { headers { }} 我
的
测试
失败
了,当我查看build文件夹中生成
的<
浏览 0
提问于2017-12-12
得票数 1
1
回答
如何在
测试
中
的
yaml文件中使用值
、
中有以下内容,并希望在
测试
中使用组部分
中
的
值。我得到
的
错误是属性必须初始化或者是抽象
的
更新:在我
的
测试
中
,我返回一个空指针异常,下面是我设置
的
内容。文件类
中
的
:@EnableAutoConfiguration @ConfigurationProperties(
浏览 8
提问于2022-10-14
得票数 -1
3
回答
Spring
Boot
Oauth2刷新令牌-
Spring
、
、
、
因此,我可以使用标准
的
CURL获取访问令牌,但只要我尝试获取访问令牌,应用程序就会抛出一个“IllegalStateException- UserDetailsService Required”。据我所知,一旦我们有了刷新令牌,我们就不需要再次
验证
用户详细信息了吗?但不管怎样,它应该在那里,考虑到它必须在第一次
验证
访问令牌。请看下面我
的
Oauth2配置:public class OAuth2Config { @EnableResourceServer prot
浏览 6
提问于2015-03-30
得票数 0
4
回答
在ConstraintValidator中
注入
服务[Bean Validator -JSR303]
Spring
、
、
下午好,当我使用我
的
服务时,它抛出NullPointerException;Exception in thread "main" javax.validation.ValidationException
浏览 3
提问于2012-11-13
得票数 22
回答已采纳
点击加载更多
热门
标签
更多标签
云服务器
ICP备案
腾讯会议
云直播
对象存储
活动推荐
运营活动
广告
关闭
领券