{"id":20114989,"url":"https://github.com/nikos/springboot-marklogic-sample","last_synced_at":"2025-05-06T13:32:29.597Z","repository":{"id":19899091,"uuid":"23164157","full_name":"nikos/springboot-marklogic-sample","owner":"nikos","description":"Sample web application integrating MarkLogic 7 Java Client API with Spring Boot.","archived":false,"fork":false,"pushed_at":"2015-06-16T14:03:43.000Z","size":680,"stargazers_count":11,"open_issues_count":0,"forks_count":8,"subscribers_count":6,"default_branch":"master","last_synced_at":"2023-08-03T03:28:09.502Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nikos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-20T21:04:22.000Z","updated_at":"2020-04-18T11:41:14.000Z","dependencies_parsed_at":"2022-07-27T00:47:01.667Z","dependency_job_id":null,"html_url":"https://github.com/nikos/springboot-marklogic-sample","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikos%2Fspringboot-marklogic-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikos%2Fspringboot-marklogic-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikos%2Fspringboot-marklogic-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikos%2Fspringboot-marklogic-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikos","download_url":"https://codeload.github.com/nikos/springboot-marklogic-sample/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224504837,"owners_count":17322488,"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":[],"created_at":"2024-11-13T18:33:24.556Z","updated_at":"2024-11-13T18:33:25.180Z","avatar_url":"https://github.com/nikos.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpringBoot MarkLogic Sample [![Build Status](https://travis-ci.org/nikos/springboot-marklogic-sample.svg?branch=master)](http://travis-ci.org/nikos/springboot-marklogic-sample)\n\nUPDATE (2015-04-27): If you are interested in a more complex / real-world example, you might want to checkout the [WM14](https://github.com/jojrg/wm14) demo application. This application is built on the same technology stack and similar ideas, but uses player (plus tweets by the players) and match data from the Soccer Worldcup 2014 in Brazil to demonstrate integrating a Java middle-tier. \n\n## Goal\n\nBuild a simple (thin) web application with [Spring Boot](http://projects.spring.io/spring-boot/) to \ndemonstrate how to access domain-specific data (for the purpose of this sample: products) \nfrom MarkLogic via its Java API. According to [Pivotals web site](https://spring.io/blog/2013/08/06/spring-boot-simplifying-spring-for-everyone)\n\u003e Spring Boot aims to make it easy to create Spring-powered, production-grade applications and services with minimum fuss.\n\nTo interact easily with the exposed REST endpoints there is a small AngularJS web client sitting on top.\nFor better understanding how MarkLogic's Java Client API handles JSON and XML documents\nboth formats are supported in the sample application.\n\n\n## Motivation\n\nSince [February 2013](http://www.marklogic.com/press-releases/marklogic-simplifies-development-of-enterprise-ready-applications-free-developer-license-for-marklogic-enterprise-edition-now-available/) \neveryone can get a [free MarkLogic Developer License](http://developer.marklogic.com/free-developer), \nwhich gives access to a powerful (= \"Enterprise\") NoSQL database and application platform, allowing\nto store and index different kind of document types and search by various ways to quickly drill-down\nto data you are looking for. Note: This sample does only touch the tip of the iceberg regarding\n[MarkLogic's (search) features](http://www.marklogic.com/what-is-marklogic/enterprise-nosql/), \nit is really meant only to give you an idea how easy it is building applications with it.\n\nAs a Java developer I thought it was about time to start learning about MarkLogic server\nand how to use the Java API to deal with JSON and XML documents in regards to creation,\nbinding and also query capabilites. With the recent advent of [Spring Boot](http://projects.spring.io/spring-boot/)\nI wanted to show case how easy and straight forward it is, and how less Java code it requires,\nto get a small (state-of-the-art with microservices, plus bells and whistles ready for production) \nweb application up and running.\n\n\n## Software Requirements\n\n### MarkLogic Server\n\n* [Download MarkLogic server](http://developer.marklogic.com/products/marklogic-server) (version 7), Please note: you need to create an account \n  with the MarkLogic developer community\n\n* [Install, start and setup](http://docs.marklogic.com/guide/installation/procedures#id_28962) your MarkLogic server instance,\n   \n* Bootstraping the database and creating an associated REST API instance (that will run on port 8110, see ```gradle.properties```)\n  is handled by the gradle plug-in [ml-gradle](https://github.com/rjrudin/marklogic-java/wiki/ml-gradle-Overview).\n  This allows you to execute from the command-line ```gradle mlDeploy``` initially,\n  the \"deployment\" also takes care of importing the required search options.\n\n\n### Gradle\n\nTo compile and start the application you require a Java Development Kit (JDK 7) as well\nas [Gradle](http://www.gradle.org/).\n\n\n### Bower\n\nFor managing client-side dependencies (in this sample application: AngularJS and Bootstrap),\nplease install [bower](http://bower.io/) if you haven't already. This requires **Node.js** \nand **NPM**. To install both, the easiest is to follow the instructions on the **[Node.js homepage](http://nodejs.org)**.\n\n    npm install -g bower\n\nThen we need to run Bower (from this project's root directory) the first time to download client-side dependencies\nin the proper directory:\n\n    bower install\n\nTo adjust the target directory bower will save the downloaded dependencies please customize the file ```.bowerrc```.\n\n\n## Try it out\n\nFirst you need to adjust the configuration file which holds specifics about\nhow your MarkLogic server can be connected to, the easiest way is by copying\nthe file and modifying the connection string according to your settings:\n\n    vi src/main/resources/application.yml\n\nNOTE: This will be refactored to make use of spring profiles in a future version.\n\nTo give the sample web application a spin, check out the sources from github \nand start the application directly from the command-line by executing:\n\n    gradle bootRun\n\nIf you want to open the sources with your favorite IDE, you might want to generate project files for Eclipse resp. IntelliJ IDEA with:\n\n    gradle eclipse\n    gradle idea\n\nTo start the app in debug mode (Port 5005 by default), run:\n\n    gradle bootRun --debug-jvm\n\n\n### Interact with the REST endpoints\n\nThe following examples use [httpie](http://httpie.org) as user-friendly cURL replacement.\n\n#### Create a new product\n\n    http POST localhost:8080/products sku=4711 name='Super Duper' description='with bars...'\n\nLook out for the Location HTTP Header allowing to retrieve this entity to a later point in \ntime again.\n\n#### Retrieve a single product\n\n    http GET localhost:8080/products/4711.json\n\n#### Search for products contain a certain string\n\n    http GET localhost:8080/products.json name=='Super Duper'\n\n#### Delete the product\n\n    http DELETE localhost:8080/products/4711.json\n\n\n## Implementation details\n\n### Spring Beans\n\nThe following diagram shows which Spring beans are used by the sample application:\n\n![Spring Beans](https://raw.githubusercontent.com/nikos/springboot-marklogic-sample/master/doc/springbeans.png)\n\n\n### Enable auto-refresh:\n\nBy using spring-loaded (see also https://github.com/spring-projects/spring-boot/issues/887)\nit is possible (to some degree) to exchange recompiled classes while \nyour application stays up running.\n\nSet it up under VM options in your IDE (make auto-compile after save is working):\n\n    -javaagent:/path/to/springloaded-1.2.0.RELEASE.jar -noverify\n\n\n## Further reading\n\n* [Introduction to the MarkLogic Java API](https://docs.marklogic.com/guide/java/intro)\n* [Spring Boot Reference](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/)\n* [Spring Actuator: exposing metrics and allow to monitor the application easily](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#production-ready)\n\n\u003c!--\n   [Freemarker: template engine](http://freemarker.org/)\n--\u003e\n\n\n## Feedback\n\nIn case of any questions or suggestions please get into \n[contact with the author](mailto:niko[at]nava[dot]de)\nof course reporting issues or even contribute pull requests\nvia github are highly welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikos%2Fspringboot-marklogic-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikos%2Fspringboot-marklogic-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikos%2Fspringboot-marklogic-sample/lists"}