Похожие чаты

"Message": "org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error

creating bean with name 'mongoRC' defined in ru.majordomo.hms.service.config.MongoConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.mongodb.MongoClient]: Factory method 'mongoRC' threw exception; nested exception is java.lang.IllegalArgumentException: The connection string is invalid. Connection strings must start with either 'mongodb://' or 'mongodb+srv://",

——

datasource:
mongodbRc:
uri: mongodb://dev.internal:27017/database
database: database

^ is 100% correct

——


@Value("${datasource.mongodbRc.uri}")
private String mongodbRCUri;


@Bean("mongoRC")
public MongoClient mongoRC() {
return new MongoClient(new MongoClientURI(mongodbRCUri));
}

eh? What's the problem

17 ответов

19 просмотров

verify if the YAML formatting is correct

Please use del.dog or hastebin.com to share long snippets of code. It helps preserve formatting and can give you suntax highlighting

Пользователь-61024 Автор вопроса
Manav | avoid unnecessary messaging me
Please use del.dog or hastebin.com to share long s...

I didn't know about del.dog and hastebin.com won't save anything for me Sorry

Which spring boot and spring-data-mongo are you using? I tried couple of versions I work with, in both of them MongoClient is an *interface*, not a concrete class

Basically, configuration looks correct. but the way how you create client - does not. at a glance

Пользователь-61024 Автор вопроса
Dmytro Buryak
Basically, configuration looks correct. but the wa...

It wasn't me who wrote, so I'll look into this then now, thanks! Maybe I'll rewrite if it's simple or just drop the idea of using mongoOperations

Manav | avoid unnecessary messaging me
That's fine, any code pasting website will do.

Hello Manav! pastebin didn't worked for me, I got two warnings when ttried to share code here. Is pastebin somehow special ? It's not explicitly mentioned in rules that pastebin is not allowed here

Пользователь 61024
It wasn't me who wrote, so I'll look into this the...

MongoOperations depends on MongoClient. Basically every interaction with mongo needs a properly configured MongoClient ))) And your failure shows that it's misconfigured. So it's not about mongoOperations. I suggest to give a glance at the documentation: https://docs.spring.io/spring-data/mongodb/docs/current/reference/html/#mongodb-connectors

Dmytro Buryak
Hello Manav! pastebin didn't worked for me, I got ...

Any pasting service should work. Did you mention someone? It was probably a mistake. Lemme ask other admins

Martin Rys
What did you send exactly?

Hello! Hard to tell exactly, as the full message was automatically deleted. But I can try sharing same link again. Should I?

Пользователь-61024 Автор вопроса
Dmytro Buryak
MongoOperations depends on MongoClient. Basically ...

I added qualifier instead of getting certain bean with ctx and it works now

Пользователь 61024
I added qualifier instead of getting certain bean ...

Can you please share how you solved it (if it's non-nda of course)?

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта