{"id":15735391,"url":"https://github.com/franz-see/spring-with-mn-data","last_synced_at":"2026-04-16T10:32:04.722Z","repository":{"id":41005769,"uuid":"272968443","full_name":"franz-see/spring-with-mn-data","owner":"franz-see","description":"Spring Boot with Micronaut-Data","archived":false,"fork":false,"pushed_at":"2023-12-05T22:27:26.000Z","size":84,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-22T04:49:07.624Z","etag":null,"topics":["java","java-11","lombok","maven","micronaut-data","mysql","spring-boot","testcontainers"],"latest_commit_sha":null,"homepage":null,"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/franz-see.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-17T12:29:41.000Z","updated_at":"2020-06-18T16:10:59.000Z","dependencies_parsed_at":"2024-10-25T00:18:01.846Z","dependency_job_id":"dee17725-42b4-4957-a0a7-e2b44771906c","html_url":"https://github.com/franz-see/spring-with-mn-data","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"7e34de9042c28dffa35567059693d37d44a3d78b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/franz-see/spring-with-mn-data","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franz-see%2Fspring-with-mn-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franz-see%2Fspring-with-mn-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franz-see%2Fspring-with-mn-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franz-see%2Fspring-with-mn-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/franz-see","download_url":"https://codeload.github.com/franz-see/spring-with-mn-data/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franz-see%2Fspring-with-mn-data/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31882052,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T09:23:21.276Z","status":"ssl_error","status_checked_at":"2026-04-16T09:23:15.028Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","java-11","lombok","maven","micronaut-data","mysql","spring-boot","testcontainers"],"created_at":"2024-10-04T01:13:09.673Z","updated_at":"2026-04-16T10:32:04.701Z","avatar_url":"https://github.com/franz-see.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring-Boot with Micronaut-Data\n\nThis is a sample project that uses Spring for dependency injection and controller, and uses Micronaut-Data for the \npersistence\n\n## TLDR; To inject Micronaut beans into a Spring project\n\nSee `com.example.springwithmndata.config.MicronautConfig`\n\n```\n@Configuration\npublic class MicronautConfig {\n    \n    @Bean\n    public ApplicationContext micronautApplicationContext() {\n        ApplicationContext applicationContext = ApplicationContext.build(emptyMap()).build();\n        applicationContext.start();\n        return applicationContext;\n    }\n    \n    @Bean\n    public BookRepository bookRepository(ApplicationContext applicationContext) {\n        return applicationContext.getBean(BookRepository.class);\n    }\n    \n    @Bean\n    public SynchronousTransactionManager\u003cConnection\u003e transactionManager(ApplicationContext applicationContext) {\n        return (SynchronousTransactionManager\u003cConnection\u003e ) applicationContext.getBean(SynchronousTransactionManager.class);\n    }\n    \n}\n```\n\nAlso, you might also want to check `com.example.springwithmndata.aspect.MicronautTransactionAspect` on how I did \ntransactions. I could not use micronaut's integration with spring transaction (as of this writing) because it seems like\nI would need to downgrade my spring in order for me to do that. If you want to try that path, check the spring version \nthat your version of `io.micronaut.data:micronaut-data-spring` depends on. For example, for \n[io.micronaut.data:micronaut-data-spring:1.0.2](https://search.maven.org/artifact/io.micronaut.data/micronaut-data-spring/1.0.2/jar), \nit depends on `org.springframework.data:spring-data-commons:2.2.6.RELEASE` and \n`org.springframework:spring-jdbc:5.2.5.RELEASE`, if your current versions of these artifacts are substantially higher \nthan these, then you might encounter some runtime issues (like dependency injection not even working) (see \nhttps://github.com/micronaut-projects/micronaut-data/issues/602)\n\n## Project Requirements\n\n1. Java 11\n2. Docker (_to run the tests which uses mysql testcontainer_)\n\n## Project Structure\n\n```\n`-- src/main/java\n    `-- com.example.springwithmndata\n        |-- aspect\n        |   |-- MicronautTransactionAspect\n        |   `-- @Transactional\n        |-- config\n        |   `-- MicronautConfig\n        |-- controller\n        |   |-- BookController\n        |   `-- Paths\n        |-- entity\n        |   `-- Book\n        |-- repository\n        |   `-- BookRepository\n        |-- service\n        |   `-- BookService\n        `-- Application\n```\n\n * `Application` is the starting class of this application. This starts the Spring Boot application.\n * `BookController` is the entry point for the `GET:/book/{id}` and `POST:/book/` endpoints. This delegates to \n   `BookService`\n * `BookService` is a simple service. This is just to test if we can inject the spring-managed bean `BookService` into \n   `BookController`. This uses the micronaut-data class `BookRepository`\n * `BookRepository` is micronaut-data `JdbcRepository`.\n * `Book` is the micronaut-data-based entity used by `BookRepository`\n * `MicronautConfig` is what exposes the micronaut managed beans into Spring\n * `MicronautTransactionAspect` is a Spring-based aspect in order to intercept method invocations of `@Transactional` \n   methods in order to start a micronaut transaction. \n\n## Commands\n\n| Description              | Command                  |\n|--------------------------|:-------------------------|\n| Application : Build      | `./mvnw clean install`   |\n| Application : Run        | `./mvnw -Prun`           |\n| MySQL : Create Database  | `./mvnw -Pmysql-create`  |\n| MySQL : Start Database   | `./mvnw -Pmysql-start`   |\n| MySQL : Stop Database    | `./mvnw -Pmysql-stop`    |\n| MySQL : Destroy Database | `./mvnw -Pmysql-destroy` |\n| MySQL : Follow Tail      | `./mvnw -Pmysql-logs`    |\n\n## Manual Testing\n\n### Creating a Book\n\n```\ncurl --location --request POST 'http://localhost:8080/book/' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n    \"title\" : \"My First Book\"\n}'\n```\n\n### Retrieving Saved Book\n\n```\ncurl --location --request GET 'http://localhost:8080/book/1'\n```\n\n### Postman\n\nI have also added a postman collection under `./postman/` directory. This collection contains the saving and retrieving \nof book. You can import this into your postman and run the test to see how it exactly works.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranz-see%2Fspring-with-mn-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffranz-see%2Fspring-with-mn-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranz-see%2Fspring-with-mn-data/lists"}