cost 305 ms
@Autowired 在多模块应用程序中不起作用 - @Autowired not working in multi-module application

我需要@Autowire 数据库服务或存储库形成“游戏”模块中的“数据库”模块。 已经在主“应用程序”class 中添加了这些注释: 将它们添加到构造函数中要困难得多,因为我需要在 StrategySelector 中创建这些类的实例列表: 或者,对于 StrategySelector 逻辑,也许有 ...

Spring 引导:使用数组过滤 - Spring Boot: Filter by using array

spring 的新手,我想知道如何在以下示例中按多种类型进行搜索。 基本上,我现在所拥有的返回包含流派数组中任何字符串的所有内容,而我希望它提供包含流派数组中所有内容的所有内容。 例如,假设我们有两部电影 movie1 有戏剧和喜剧两种类型,movie2 有犯罪和戏剧两种类型。 当流派数组包含喜剧 ...

Spring 一对多连接和字段总和的规范查询大于给定值 - Spring specification query for one to many join and sum of field is grater then given value

我正在使用加入这三个实体seeker_job_application 、 seeker_profile和seeker_experience创建过滤器。 我想在哪里实现如下查询的结果。 在过滤器中,我想找出seeker_profile的total_moth of experience 应该大于或等于给 ...

如何在存储库 class 的单元测试中模拟 lombok @data stackoverflow 错误? - How to simulate lombok @data stackoverflow error within unit tests for repository class?

如果使用来自 Lombok 的 @Data 批注而不是单独的 @Getter 和 @Setter 批注,我会在抛出堆栈溢出错误的实体之间建立关系。 现在已修复,但我想在我的存储库测试中为它编写一个单元测试。 但是,我不确定如何实现这一点,也无法找到它的样本。 这是我的实体类: 这是我对一个没有例外 ...

spring 引导注释@Repository 是否也自动带有@Transactional 注释? - Does the spring boot annotation @Repository also automatically come with the @Transactional annotation too?

所以就在这里 ^ 例如,这个 spring 引导注释 @Repository 是否也自动带有 @Transactional 注释? 还是我需要特别声明@Transactional? 谢谢我不知道如何测试这个,也找不到任何相关文档,所以我问堆栈溢出专家哈哈。 ...

com.earworm.backendearworm.UserService 中构造函数的参数 0 需要一个类型的 bean - Parameter 0 of constructor in com.earworm.backendearworm.UserService required a bean of type

我和我的团队在让我们的 spring boot 应用程序运行时遇到了问题,我们试图修复一件事然后导致另一个错误。 我一直在环顾四周,但似乎找不到答案。 这是我们项目的 github 的链接。 https://github.com/matfitchell/Earworm/tree/main/Sou ...

Neo4jRepository 和 ReactiveNeo4jRepository 有什么区别? - What is difference between Neo4jRepository and ReactiveNeo4jRepository?

我目前正在使用 REST API 构建一个 Spring 启动后端,它由 Neo4j 数据库支持。 因此,在浏览 Spring 数据 Neo4j 的官方文档时,我观察了ReactiveNeo4jRepository和Neo4jRepository作为数据存储库的用法,用于通过我们的程序与数据库交互 ...

如何使用 mockk 模拟对 Spring 存储库 `saveAll()` 方法的调用? - How can I mock a call to Spring's repository `saveAll()` method using mockk?

在测试我的 Spring 引导数据存储库接口时,我使用Mockk作为我的 mocking 框架。 其实我在做以下事情 应该模拟以下行为 我收到的错误消息如下: 错误消息说left matchers: [any(), any()]指出我不知何故没有定义预期的 arguments 权利。 我可以在我的 ...

Spring 数据 JPA。 将记录(插入数据)添加为“外键 ID”,而不是“实体”。 有区别吗? - Spring data JPA. Add record (insert data) as "foreign key id" opposed to as a "entity". Is there a difference?

我找不到我的问题的答案,我希望这不是一个重复的问题。 下面是图解的组成的例子。 数据库 model 数据表“用户”: 我想知道在以下情况下有什么区别: 实体(联系人)以“userId”映射为外键值(例如1 )的方式保存到数据库保存的实体(联系人)以“userId”用于从数据库中检索相应用户实体并 ...

如何使用 Spring 存储库接口在 MongoDB 中使用排序和位置创建查询? - How can I create queries with sort and where in MongoDB with Spring Repository interface?

我正在尝试使用 SpringBoot 在 MongoDB 集合中进行特定查询。 查询的结果很多,可以在这里看到。 我正在尝试像在屏幕截图中的 MongoDB 指南针中那样对结果进行排序和过滤,并仅获取查询结果中的最新条目。 TaskRepo.java ...

如何使用 deleteAll() 获取删除的行数? - How to get number of rows deleted using deleteAll()?

我想使用 SpringRepository 获取deleteAll()删除的行数。 如果我编写自己的函数,就很容易获得这个,就像在这个线程中一样。 但是,我想覆盖deleteAll()方法。 以下代码不起作用: 因为我得到 返回类型与 CrudRepository<Calculatio ...

如何使用 MongoRepositoty @Query 删除 mongodb 集合的所有文档中的字段 - How to delete a field in all documents of mongodb collection using MongoRepositoty @Query

我有一个收藏: 我想删除所有文档中的字段age 。 所以架构看起来像这样: 我正在使用 MongoRepositoty 并且一直在尝试编写此方法: 我尝试了不同的括号和引号,但都以错误告终。 我的语法有什么问题? 我发现它与我们在 mongo 控制台中编写查询的方式不同。 例如,此处不允 ...

com.xxservice.UserServiceImpl 中的字段 userRepository 需要找不到类型为“com.xxrepository.UserRepository”的 bean - Field userRepository in com.x.x.service.UserServiceImpl required a bean of type 'com.x.x.repository.UserRepository' that could not be found

早上好 ! 尽管我进行了所有研究,但我无法通过应用程序 spring 解决这个问题,有人可以帮助我使用 jdk 17; 我的服务类 我的存储库类 } 4.0.0 org.springframework.boot spring-boot-starter-parent 2.6.7 co ...

由于无法为公共抽象 java.util.optional 创建查询而导致创建 bean userController 时出错 - Error in creating bean userController caused by Could not create query for public abstract java.util.optional

堆栈跟踪:org.springframework.beans.factory.UnsatisfiedDependencyException:创建名称为“userController”的 bean 时出错:通过字段“userRepository”表示的不满足依赖关系; 嵌套异常是 org.spring ...


 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM