Home > database >  Best way to connect mongoDB to spring boot applications
Best way to connect mongoDB to spring boot applications

Time:06-29

I used this 2 properties to connect mongodb. is there any way to do this without URI

spring.data.mongodb.uri=

spring.data.mongodb.database=

CodePudding user response:

in vs code we can use this dpendancies

  1. Spring boot dev tools
  2. lombok
  3. Spring web
  4. Spring data MongoDB

extentions

  1. java extentions
  2. maven extentions

CodePudding user response:

spring.data.mongodb.host=127.0.0.1
spring.data.mongodb.port=27017
spring.data.mongodb.authentication-database=admin
spring.data.mongodb.username=<username specified on MONGO_INITDB_ROOT_USERNAME>
spring.data.mongodb.password=<password specified on MONGO_INITDB_ROOT_PASSWORD>
spring.data.mongodb.database=<the db you want to use>

CodePudding user response:

can you help for this

<BrowserRouter>
                <nav>
                    <Link to={'/'} style={{ "marginRight": "10px" }}>Home</Link>

                    <Link to={'/customer/create'} style={{ "marginRight": "10px" }}>Create customer</Link>
                    <Link to={'/customer/list'} style={{ "marginRight": "10px" }}>Customer list</Link>


                    <Link to={'/trader/create'} style={{ "marginRight": "10px" }}>Create trader</Link>

                    <Link to={'/item/create'} style={{ "marginRight": "10px" }}>Create item</Link>
                    <Link to={'/item/list'} style={{ "marginRight": "10px" }}>Item list</Link>


                    <Link to={'/cart/view'} style={{ "marginRight": "10px" }}>View cart</Link>

                    <Link to={'/promotion/create'} style={{ "marginRight": "10px" }}>Create promotion</Link>
                    <Link to={'/promotion'} style={{ "marginRight": "10px" }}>Promotion list</Link>

                </nav>
                <Routes>
                    <Route path='/' element={<Home />}></Route>

                    <Route path='/customer/create' element={<CustomerForm />}></Route>
                    <Route path='/customer/list' element={<CustomerList />}></Route>


                    <Route path='/trader/create' element={<TraderForm />}></Route>


                    <Route path='/item/create' element={<ItemForm />}></Route>
                    <Route path='/item/list' element={<ItemList />}></Route>
                    <Route path='/item/:id' element={<EditViewItem />}></Route>

                    <Route path='/cart/view' element={<CartItemList />}></Route>

                    <Route path='/promotion/create' element={<PromotionForm />}></Route>
                    <Route path='/promotion' element={<PromotionList />}></Route>



                </Routes>

            </BrowserRouter>
  • Related