{"id":19827343,"url":"https://github.com/sandysanthosh/springboot","last_synced_at":"2026-04-12T17:40:25.537Z","repository":{"id":44508399,"uuid":"253275270","full_name":"sandysanthosh/SpringBoot","owner":"sandysanthosh","description":"Spring Boot Programs","archived":false,"fork":false,"pushed_at":"2022-11-24T06:41:36.000Z","size":5417,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-11T09:24:01.716Z","etag":null,"topics":["mongodb","postman","restful-api","spring","springboot","thymleaf"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sandysanthosh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-05T16:06:27.000Z","updated_at":"2020-07-19T10:01:56.000Z","dependencies_parsed_at":"2022-09-04T04:01:08.522Z","dependency_job_id":null,"html_url":"https://github.com/sandysanthosh/SpringBoot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandysanthosh%2FSpringBoot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandysanthosh%2FSpringBoot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandysanthosh%2FSpringBoot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandysanthosh%2FSpringBoot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sandysanthosh","download_url":"https://codeload.github.com/sandysanthosh/SpringBoot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241183662,"owners_count":19923928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mongodb","postman","restful-api","spring","springboot","thymleaf"],"created_at":"2024-11-12T11:13:04.519Z","updated_at":"2025-11-22T17:00:58.405Z","avatar_url":"https://github.com/sandysanthosh.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpringBoot\n\nSpring Boot Programs\n\n# SpringBoot\n\n * Spring Boot Programs\n * Spring Boot DATAJPA \n * Spring Boot MONGODB \n \n ### Run Programs in POSTMAN:\n\n![image](https://user-images.githubusercontent.com/11579239/87849964-3c7e7d80-c90a-11ea-8b24-36b73c16ae01.png)\n\n### RUN in MongoDB Compass:\n\n![image](https://user-images.githubusercontent.com/11579239/87850005-810a1900-c90a-11ea-993b-cb6d02fc9afd.png)\n\n#### MOngoDB Tables:\n\n![image](https://user-images.githubusercontent.com/11579239/87850017-967f4300-c90a-11ea-98bb-11c761700c75.png)\n\n\n### Book.java:\n\n```\n\npackage com.example.demo.model;\n\nimport org.springframework.data.annotation.Id;\nimport org.springframework.data.mongodb.core.mapping.Document;\n\nimport lombok.Data;\n\n\n@Data\n@Document(collection=\"books\")\npublic class book {\n\t@Id\n\tprivate int id;\n\tprivate String bookName;\n\tprivate String authorName;\n\tpublic int getId() {\n\t\treturn id;\n\t}\n\tpublic void setId(int id) {\n\t\tthis.id = id;\n\t}\n\tpublic String getBookName() {\n\t\treturn bookName;\n\t}\n\tpublic void setBookName(String bookName) {\n\t\tthis.bookName = bookName;\n\t}\n\tpublic String getAuthorName() {\n\t\treturn authorName;\n\t}\n\tpublic void setAuthorName(String authorName) {\n\t\tthis.authorName = authorName;\n\t}\n}\n```\n\n#### BookRepository.Java:\n\n```\n\npackage com.example.demo.repository;\n\nimport org.springframework.data.mongodb.repository.MongoRepository;\nimport org.springframework.stereotype.Repository;\n\nimport com.example.demo.model.book;\n\n@Repository\npublic interface BookRepository extends MongoRepository\u003cbook,Integer\u003e{\n\n}\n\n```\n\n#### BookController.java:\n\n```\n\npackage com.example.demo.Controller;\n\nimport java.util.List;\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.web.bind.annotation.DeleteMapping;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.PathVariable;\nimport org.springframework.web.bind.annotation.PostMapping;\nimport org.springframework.web.bind.annotation.RequestBody;\nimport org.springframework.web.bind.annotation.RestController;\n\nimport com.example.demo.model.book;\nimport com.example.demo.repository.BookRepository;\n\n@RestController\npublic class BookController {\n\t\n\t@Autowired\n\tprivate BookRepository BookRepository;\n\t\n\t@GetMapping(\"/findAllBooks\")\n\tpublic List\u003cbook\u003e getAllBooks()\n\t{\n\t\treturn BookRepository.findAll();\n\t}\n\t\n\t@PostMapping(\"/addBooks\")\n\tpublic String addAllBooks(@RequestBody book book)\n\t{\n\t\t BookRepository.save(book);\n\t\t return \"book id\";\n\t}\n\t\n\t@DeleteMapping(\"/deleteBooks/{id}\")\n\tpublic String deleteBooks(@PathVariable int id)\n\t{\n\t\t BookRepository.deleteById(id);\n\t\t return \"book id\";\n\t}\n\t\n\t@GetMapping(\"/findBook/{id}\")\n\tpublic String getAllBooksById(@PathVariable int id)\n\t{\n\t\tBookRepository.findById(id);\n\t\treturn \"book id\";\n\t}\n}\n\n```\n\n#### Application.properties:\n\n```\n\nspring.data.mongodb.database=booksdetails\nspring.data.mongodb.port=27017\nspring.data.mongodb.host=localhost\n\n```\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandysanthosh%2Fspringboot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsandysanthosh%2Fspringboot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandysanthosh%2Fspringboot/lists"}