# springboot **Repository Path**: prince850412/springboot ## Basic Information - **Project Name**: springboot - **Description**: sprintboot+mongodb实现RESTFUL接口 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-02-29 - **Last Updated**: 2024-03-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # springboot-mongo-demo Use springboot+MongoDB to implement the restful interface. # mongodb配置 use mydb db.createCollection("springboot_mongo_db") db.springboot_mongo_db.insert({"id":"1","userName":"李一","password":"18","firstName":"李","lastName":"一","email":"123@qq.com","phone":"123","address":"苏州"}) db.springboot_mongo_db.insert({"id":"2","userName":"张大","password":"33","firstName":"张","lastName":"大","email":"456@qq.com","phone":"456","address":"苏州"}) db.springboot_mongo_db.insert({"id":"3","userName":"王五","password":"80","firstName":"王","lastName":"五","email":"789@qq.com","phone":"789","address":"苏州"}) @Document(collection="mongodb 对应 collection 名") 若未加 @Document ,该 bean save 到 mongo 的 user collection 若添加 @Document ,则 save 到 reUser collection #查找所有用户 curl -X GET "http://localhost:8081/getAllUser" WEBSOCKET 在WebSocket中使能@ServerEndpoint("/ws")后,自定义WebServerHander无效 WEBSOCKET ws://localhost:8081/ws?token=1