{"id":18325571,"url":"https://github.com/ganchix/morphia-spring-boot-starter","last_synced_at":"2025-08-01T14:13:41.093Z","repository":{"id":57733289,"uuid":"90375338","full_name":"ganchix/morphia-spring-boot-starter","owner":"ganchix","description":"Spring boot starter for use Morphia in a Spring way easily.","archived":false,"fork":false,"pushed_at":"2020-07-20T12:33:18.000Z","size":113,"stargazers_count":14,"open_issues_count":2,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-16T02:13:01.882Z","etag":null,"topics":["java-8","mongodb","morphia","spring","spring-boot","spring-boot-starter"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ganchix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-05T12:52:30.000Z","updated_at":"2024-07-04T11:16:01.000Z","dependencies_parsed_at":"2022-09-26T22:11:20.498Z","dependency_job_id":null,"html_url":"https://github.com/ganchix/morphia-spring-boot-starter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ganchix/morphia-spring-boot-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganchix%2Fmorphia-spring-boot-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganchix%2Fmorphia-spring-boot-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganchix%2Fmorphia-spring-boot-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganchix%2Fmorphia-spring-boot-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ganchix","download_url":"https://codeload.github.com/ganchix/morphia-spring-boot-starter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganchix%2Fmorphia-spring-boot-starter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268241286,"owners_count":24218374,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["java-8","mongodb","morphia","spring","spring-boot","spring-boot-starter"],"created_at":"2024-11-05T18:44:14.902Z","updated_at":"2025-08-01T14:13:41.074Z","avatar_url":"https://github.com/ganchix.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring boot starter Morphia [![Build Status](https://travis-ci.org/ganchix/morphia-spring-boot-starter.svg?branch=master)](https://travis-ci.org/ganchix/morphia-spring-boot-starter) [![codecov](https://codecov.io/gh/ganchix/morphia-spring-boot-starter/branch/master/graph/badge.svg)](https://codecov.io/gh/ganchix/morphia-spring-boot-starter) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.ganchix/morphia-spring-boot-parent/badge.svg?style=plastic)](https://maven-badges.herokuapp.com/maven-central/io.github.ganchix/morphia-spring-boot-parent) [![GitHub stars](https://img.shields.io/github/stars/badges/shields.svg?style=social\u0026label=Star)](https://github.com/ganchix/morphia-spring-boot-starter)\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fganchix%2Fmorphia-spring-boot-starter.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fganchix%2Fmorphia-spring-boot-starter?ref=badge_shield)\n\nSpring boot starter for use [Morphia](https://mongodb.github.io/morphia/) in a Spring way easily.\n\n# Table of Contents\n \n- [Overview](#overview)\n- [Getting started](#getting-started)\n- [License](#license)\n\n\n### Overview\n\nThis implementation offers a Spring way to use [Morphia](https://mongodb.github.io/morphia/) framework, \nwe use the configuration of Spring Data Mongo to instantiate Morphia and Datastore objects, both objects can be \ninjected.\n\nThe starter scan Entity annotations to add in datastore and ensure indexes.\n\n\n### Getting started\n#### Code example\n\nFirst of all need to configure your properties like Spring Data Mongo, a example of `application.properties` :\n\n```\nspring.data.mongodb.uri=mongodb://user:password@ip:port/database\nspring.data.mongodb.repositories.enabled=true\n```\n\nCreate your domain classes, for example:\n\n```java\nimport lombok.Data;\nimport org.bson.types.ObjectId;\nimport org.mongodb.morphia.annotations.Entity;\nimport org.mongodb.morphia.annotations.Id;\n\n@Data\n@Entity\npublic class Account {\n    \n    @Id\n    private ObjectId id;\n    private String user;\n    private Double amount;\n    private Long createdDate;\n    \n}\n```\n\nCreate your repositories:\n\n```java\nimport org.mongodb.morphia.Datastore;\nimport org.mongodb.morphia.query.Query;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.stereotype.Component;\n    \n@Component\npublic class AccountRepositoryImpl implements AccountRepository {\n    \n    @Autowired\n    private Datastore datastore;\n    \n    @Override\n    public void delete(String user) {\n        Query\u003cAccount\u003e removeQuery = datastore.createQuery(Account.class)\n                    .filter(\"user\", user);\n        datastore.delete(removeQuery);\n    }\n}\n```\n\n\n#### Integration using `@SpringBootApplication` or `@EnableAutoConfiguration` \n\nOnly add Maven dependency:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.ganchix\u003c/groupId\u003e\n    \u003cartifactId\u003emorphia-spring-boot-starter\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.1\u003c/version\u003e\n\u003c/dependency\u003e\n\n```\n\n#### Without `@SpringBootApplication` or `@EnableAutoConfiguration` \n\nYou need a `@ComponentScan` in the root package.\n\nAdd Maven dependency:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.ganchix\u003c/groupId\u003e\n    \u003cartifactId\u003emorphia-spring-boot\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.1\u003c/version\u003e\n\u003c/dependency\u003e\n\n```\n\nImport auto configuration `MorphiaAutoConfiguration`:\n\n```java\nimport org.springframework.context.annotation.Configuration;\nimport org.springframework.context.annotation.Import;\n    \n@Configuration\n@Import(MorphiaAutoConfiguration.class)\npublic class MorphiaConfig {\n    \n}\n```\n\n\n### License\n\nSpring boot starter Morphia is licensed under the MIT License. See [LICENSE](LICENSE.md) for details.\n\nCopyright (c) 2017 Rafael Ríos Moya\n\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fganchix%2Fmorphia-spring-boot-starter.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fganchix%2Fmorphia-spring-boot-starter?ref=badge_large)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fganchix%2Fmorphia-spring-boot-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fganchix%2Fmorphia-spring-boot-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fganchix%2Fmorphia-spring-boot-starter/lists"}