본문 바로가기
데이터베이스/mongoDB

[mongoDB] Spring boot mongDB 연동(mongoTemplate)

by 연어바케트 2022. 11. 7.
반응형

mong

@Configuration
public class MongoDbConfiguration extends AbstractMongoClientConfiguration {

    @Value("${mongoDbUrl}")
    private String mongoDdUrl ;
    @Override
    public MongoClient mongoClient() {
        final ConnectionString connectionString = new ConnectionString(mongoDdUrl);
        final MongoClientSettings mongoClientSettings = MongoClientSettings.builder()
                .applyConnectionString(connectionString)
                .build();
        return MongoClients.create(mongoClientSettings);
    }
}

 

반응형

'데이터베이스 > mongoDB' 카테고리의 다른 글

[mongoDB] MongoDB Atlas 사용법  (0) 2022.11.17

댓글