我正在使用spring-boot-starter-data-mongodb:2.2.1.RELEASE,并试图添加对Mongo DB操作的事务支持。
我有下面的帐户服务,其中文档被插入到两个集合accounts和profiles中。如果在插入到profile集合时发生错误,则应该回滚插入到accounts中的操作。我已经使用MongoTransactionManager配置了Spring事务。
@Service
public class AccountService {
@Transactional
public void register(UserAccount userAccou
如何使用BSONObject嵌入嵌入的文档?当我试图插入嵌入的文档时,得到如下所示的错误。 例如,我想保存日期和firstName的空值。我尝试了一些使用Spring Data Mongo的选项,但效果不佳。 我得到了下面的错误: java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:816) [spring-boot-2.1.4.RELEAS
我正在尝试使用Mongodb作为数据存储来设置Spring会话的POC。
出现以下错误
Caused by: org.springframework.boot.autoconfigure.session.SessionRepositoryUnavailableException: No session repository could be auto-configured, check your configuration (session store type is 'mongodb')
有人能帮我找出我遗漏了什么吗?
application.properties
sprin
我正在使用MongoDB atlas (集群)连接到我的spring boot应用程序。我之前能够成功地从集群中插入和获取数据,但在几分钟的不活动之后,我开始获得数据, com.mongodb.MongoSocketReadException: Prematurely reached the end of stream。我尝试在mongodb集群URI中进行一些更改,例如: spring.data.mongodb.uri=mongodb+srv://emuser:empassword@emp-mate-bzmeh.gcp.mongodb.net/emp-mate-db?retryWrites
我是SpringBoot的新手。我已经构建了一个简单的应用程序,它应该在开发环境中使用假数据,并在测试环境中连接到MongoDb。Dev环境没有mongodb设置。
我尝试过使用Spring限定符/概要文件来实现它。
我有一个主要的课程,如下所示:
@SpringBootApplication
public class Main {
public static void main(String[] args) {
SpringApplication.run(Main.class, args);
}
}
我有一个DAO接口StudentDao.java
public i
我正在尝试连接springboot和远程mongodb,在Linux中,我在Win10中操作它。但SpringBoot似乎在连接MongoDB客户端时遇到了问题,下面是例外情况。
***************************
APPLICATION FAILED TO START
***************************
Description:
Field mongotemplate in com.example.demo.controller.SampleController required a bean of type 'org.springfram
我有一个与MongoDB交互的spring引导rest应用程序,但是当我调用控制器方法时,我给出了以下异常:
com.mongodb.MongoQueryException: Query failed with error code 16550 and error message 'not authorized for query on 'tenant' on server 172.16.233.128:27017
at com.mongodb.connection.ProtocolHelper.getQueryFailureException(ProtocolHelp
我正在尝试从spring boot gradle项目创建对mongo数据库的动态查询。我的gradle版本: 5.6.1 这是我的build.gradle文件: plugins {
id 'org.springframework.boot' version '2.2.2.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
}
group = 'com.onssoftware
我正在尝试让Spring Data MongoDB (reactive)与Spring Boot2.1.5(和WebFlux)一起工作。 从启动日志中我怀疑出了什么问题,它似乎被初始化了两次(注意两次存储库扫描,它们甚至返回了不同的结果): 2019.05.19 11:59:53 | INFO | org.springframework.data.repository.config.RepositoryConfigurationDelegate - Bootstrapping Spring Data repositories in DEFAULT mode.
2019.05.19 11:59
我正在创建一个spring boot批处理应用程序。该批处理从postgres加载数据并插入到MongoDB中。我已经编写了代码,但在运行spring boot应用程序时,它显示了找不到application.properties文件的错误。以下是错误代码片段:
'Caused by: java.io.FileNotFoundException: class path resource [application.properties] cannot be opened because it does not exist'
org.springframework.beans.fa
我正在尝试使用spring-boot连接mongodb。当我这样做的时候,我得到了这个错误
[localhost:27107] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server localhost:27107
com.mongodb.MongoSocketOpenException: Exception opening socket
快速搜索一下,建议我将其添加到主类中
@SpringBootApplication
@EnableAu
在将图像上传到控制器时继续获取Required request part 'file' is not present (所有其他服务都正常工作)。我已经排除了邮递员通过成功上传到这个。不知道缺了什么。
Spring可以版本:Edgware.BUILD-快照
控制器:
@RequestMapping(path = "/{account_id}/image", method = RequestMethod.POST)
public ResponseEntity uploadProfileImage(
@RequestParam("file")
使用Mongock https://github.com/cloudyrock/mongock进行数据迁移spring boot 2.3.1版本,之前使用Mongobee,但由于这个错误org.springframework.beans.factory.UnsatisfiedDependencyException:Error creating bean with name 'mongoTemplate'和每个人的建议切换到Mongock An attempt was made to call a method that does not exist, mongo-java-d