{"id":8945,"date":"2020-07-26T14:35:38","date_gmt":"2020-07-26T21:35:38","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=8945"},"modified":"2025-06-13T22:44:56","modified_gmt":"2025-06-14T05:44:56","slug":"refactoring-spring-microservices-application-to-work-with-couchbase","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/","title":{"rendered":"Refactoring Spring Microservices Apps to work with Couchbase"},"content":{"rendered":"<p>I\u2019m a big fan of online learning platforms, such as <a href=\"https:\/\/udemy.com\/\">Udemy<\/a>. For the price of a bottle of wine, you could learn pretty much anything, from psychology and Thai cooking to programming languages, operating systems and IT certifications.\u00a0 Recently, I decided to take a class with a long title: <strong><a href=\"https:\/\/www.udemy.com\/course\/kubernetes-microservices\/\">\u201cKubernetes Hands-On \u2013 Deploy Microservices to the AWS Cloud\u201d<\/a><\/strong>. It\u2019s a great course and if you want to learn more about nitty-gritty of Kubernetes, Microservices, cloud deployments and much more I would highly recommend it.<\/p>\n<p>As a class hands-on project for deploying microservices on Kubernetes, the course author provided a small application called Fleetman. The app allows monitoring a fleet of trucks (or lorries in Brits terms) moving around the great city of Sheffield UK (though one truck is riding at the heart of London). The application generates geo-positioning data for each truck, stores it either in memory or in the database and feeds location data into a convenient map-based web UI. In the UI we could see the latest position of each truck, its speed and a current journey.\u00a0 An application web front-end screenshot is listed below.<\/p>\n<div id=\"attachment_8946\" style=\"width: 946px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8946\" class=\"wp-image-8946 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/07\/Map1.png\" alt=\"\" width=\"936\" height=\"560\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map1.png 936w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map1-300x179.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map1-768x459.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map1-20x12.png 20w\" sizes=\"auto, (max-width: 936px) 100vw, 936px\" \/><p id=\"caption-attachment-8946\" class=\"wp-caption-text\">Multiple trucks position reports<\/p><\/div>\n<p>While internals of the application code wasn&#8217;t the primary focus of the Udemy course, (it was a Kubernetes and not a software development class anyway), I found application architecture quite fascinating, thanks to the fact that the <a href=\"https:\/\/github.com\/DickChesterwood\/k8s-fleetman\">source code<\/a> is opened to the general public. \u00a0As a persistence database layer, the original Fleetman application uses MongoDB, which arguably is a popular choice for storing and querying simple telemetry data coming from trucks in JSON format.<\/p>\n<p>But what about Couchbase? Couchbase database platform offers a lot of features and capabilities such as N1QL language, Analytics, Eventing and Full-Text search. These features can make a simple telemetry gathering app more powerful. But how difficult would it be to re-wire the Fleetman app to use Couchbase instead of Mongo in the first place?\u00a0 So I spent quite some time plunging into the source code and refreshing my Java programming skills. Let\u2019s start by looking at Fleetman\u2019s architecture in more detail.<\/p>\n<h3><strong>Fleetman architecture<\/strong><\/h3>\n<p>Fleetman application is designed as a set of modules (or microservices) communicating with each other using various methods and protocols. Three microservices: Position Simulator, Position Tracker and Gateway API are written using Spring Boot Java application framework. The front-end module is written in Angular which is a popular Javascript development framework. There are also a messaging system and a database layer. As you might have guessed, each of these microservices would be running in a separate pod in case of Kubernetes deployment.<\/p>\n<div id=\"attachment_8953\" style=\"width: 874px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8953\" class=\"wp-image-8953\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/07\/Fleetman-Architecture-1.png\" alt=\"Depiction of Fleetman Microservices Architecture\" width=\"864\" height=\"567\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Fleetman-Architecture-1.png 2288w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Fleetman-Architecture-1-300x197.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Fleetman-Architecture-1-1024x671.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Fleetman-Architecture-1-768x503.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Fleetman-Architecture-1-1536x1007.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Fleetman-Architecture-1-2048x1343.png 2048w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Fleetman-Architecture-1-20x13.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Fleetman-Architecture-1-1320x865.png 1320w\" sizes=\"auto, (max-width: 864px) 100vw, 864px\" \/><p id=\"caption-attachment-8953\" class=\"wp-caption-text\">Fleetman architecture<\/p><\/div>\n<p>&nbsp;<\/p>\n<ul>\n<li><strong>Position Simulator<\/strong> \u2013 generates vehicle telemetry for each of the 40 trucks in the fleet by reading configuration files with position coordinates. These position reports are written to the Message queue in JSON format, as shown below.<\/li>\n<\/ul>\n<pre class=\"lang:default decode:true\">{time=2020-06-22T11:35:55.174-0400, lat=53.4002010, long=-1.4101460, vehicle=Factory Run D}<\/pre>\n<p>&nbsp;<\/p>\n<ul>\n<li><strong>Position Tracker<\/strong> \u2013 consumes vehicle positions from the queue and stores them in Couchbase. It also calculates the speed of each truck, based on the new and previous position reports. This microservice provides a set of methods for getting the latest position of a specific truck, all trucks, as well as getting a history of all positions for a truck. These methods are available via REST interface. Getting history could be useful, if one of the K8s pods restarts.<\/li>\n<li><strong>API Gateway<\/strong> \u2013 is a simple gateway for the Angular front-end. It reads latest vehicle positions from Position Tracker and feeds those into the web application.<\/li>\n<li><strong>Web Application <\/strong>\u2013 is an Angular based app that allows monitoring truck positions on the map and jumping to a specific truck location while showing its traveled path. On the map below you could see the \u201cLondon Riverside\u201d truck journey.<\/li>\n<\/ul>\n<div id=\"attachment_8951\" style=\"width: 946px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8951\" class=\"wp-image-8951 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/07\/Map3-2.png\" alt=\"\" width=\"936\" height=\"504\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map3-2.png 936w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map3-2-300x162.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map3-2-768x414.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map3-2-20x11.png 20w\" sizes=\"auto, (max-width: 936px) 100vw, 936px\" \/><p id=\"caption-attachment-8951\" class=\"wp-caption-text\">&#8220;London Riverside&#8221; truck journey<\/p><\/div>\n<h3><strong>Migration to Couchbase <\/strong><\/h3>\n<p>Thanks to the modular approach of microservices architecture, most of my migration efforts were spent with Position Tracker module, which deals with the database layer. The original Fleetman code was written a couple of years ago, so my first goal was to recompile all the Java microservices with the newer version of Spring Boot libraries. Spring framework provides developers with fast and easy way to setup and develop regular and web applications. Spring Boot is an extension of Spring framework which comes with embedded HTTP server (Tomcat) and doesn\u2019t require configuration via XML.\u00a0 It\u2019s important to note that Couchbase is a first-class citizen as far as Spring integration goes. In June of this year the latest version 4.x of Couchbase Spring libraries have been released and full documentation is available <a href=\"https:\/\/docs.spring.io\/spring-data\/couchbase\/docs\/4.0.1.RELEASE\/reference\/html\/#metadata\">here<\/a>.<\/p>\n<p>As part of the migration, one of the first things that I had to implement was adding key generation into the code in order to save documents into the database. Every document in Couchbase should have a key. Spring Boot generates the key using @GeneratedValue annotation either with the combination of document attributes or with UUID random generator. I used the later. Entity mapping for the vehicle position is listed below.<\/p>\n<pre class=\"toolbar:1 lang:java decode:true\" title=\"VehiclePosition entity mapping\">public class VehiclePosition implements Comparable&lt;VehiclePosition&gt;\r\n{\r\n\r\n@NotNull\r\n@Id @GeneratedValue(strategy = UNIQUE)\r\nprivate String id;\r\n\r\n@NotNull\r\n@Field\r\nprivate String name;\r\n\r\n@NotNull\r\n@Field\r\nprivate BigDecimal lat;\r\n\r\n@NotNull\r\n@Field\r\nprivate BigDecimal longitude;\r\n\r\n@JsonFormat(shape=JsonFormat.Shape.STRING, pattern=\"yyyy-MM-dd'T'HH:mm:ss.SSSZ\", timezone=\"UTC\")\r\n@NotNull\r\n@Field\r\nprivate Date timestamp;\r\n\r\nprivate BigDecimal speed;\r\n\r\n\u2026.\r\n}\r\n<\/pre>\n<p>It was also necessary to add a Couchbase configuration class with a hostname, user name, password and a couple of converters to deal with storing BigDecimal values for coordinates. By default, Couchbase stores coordinates as an object with scale and precisions. It caused some issues with the application.<\/p>\n<pre class=\"lang:default decode:true\">  \"lat\": {\r\n    \"scale\": 7,\r\n    \"intCompact\": 533783660,\r\n    \"precision\": 9\r\n  },\r\n<\/pre>\n<p>Using converters I was able to store truck positions data in the following format:<\/p>\n<pre class=\"lang:default decode:true\" title=\"Vehicle position report stored in Couchbase\">{\r\n  \"name\": \"Express Delivery1\",\r\n  \"_class\": \"com.virtualpairprogrammers.tracker.domain.VehiclePosition\",\r\n  \"lat\": \"53.3009490\",\r\n  \"speed\": \"1.333069443260374304264\",\r\n  \"longitude\": \"-1.1231240\",\r\n  \"timestamp\": 1595735263364\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>Couchbase configuration class is listed below.<\/p>\n<pre class=\"toolbar:1 lang:java decode:true\" title=\"Couchbase configuration class\">public class CustomCouchbaseConfig extends AbstractCouchbaseConfiguration {\r\n\r\n    @Override\r\n    protected List&lt;String&gt; getBootstrapHosts() {\r\n        return Collections.singletonList(\"localhost\");\r\n    }\r\n\r\n    @Override\r\n    protected String getBucketName() {\r\n        return \"test\";\r\n    }\r\n\r\n    @Override\r\n    protected String getBucketPassword() {\r\n        return \"couchbase\";\r\n    }\r\n\r\n        @Override\r\n    public CouchbaseCustomConversions customConversions() {\r\n       return new CouchbaseCustomConversions(Arrays.asList(BigDecimalToString.INSTANCE, StringToBigDecimalConverter.INSTANCE));\r\n    }\r\n\r\n    @WritingConverter\r\n    public enum BigDecimalToString implements Converter&lt;BigDecimal, String&gt; {\r\n        INSTANCE;\r\n        @Override\r\n        public String convert(BigDecimal source) {\r\n            return source.toString() ;\r\n        }\r\n\r\n       }\r\n    @ReadingConverter\r\n    public enum StringToBigDecimalConverter implements Converter&lt;String, BigDecimal&gt; {\r\n        INSTANCE;\r\n\r\n        @Override\r\n        public BigDecimal convert(String source) {\r\n            return new BigDecimal(source);\r\n        }\r\n     }\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>To configure Couchbase I created a test bucket, added an RBAC user with the same name as the bucket and granted\u00a0 Application access permissions to this user. I also added indexes on name and timestamp since these two attributes are used as access patterns by repository methods. PositionRepository interface has three methods to search trucks by name, \u00a0timestamp and a combination of both.<\/p>\n<pre class=\"toolbar:1 lang:java decode:true\" title=\"Position Repository Interface\">public interface PositionRepository extends CouchbasePagingAndSortingRepository&lt;VehiclePosition, String&gt; {\r\n\r\n   TreeSet&lt;VehiclePosition&gt; findByNameAndTimestampAfterOrderByTimestampAsc(String name, Date timestamp);\r\n\r\n   List&lt;VehiclePosition&gt; findByNameOrderByTimestampAsc(String name);\r\n\r\n   List&lt;VehiclePosition&gt; findByTimestampAfter(Date since);\r\n\r\n}\r\n<\/pre>\n<h3><\/h3>\n<h3><strong>Summary<\/strong><\/h3>\n<p>Overall, migration to Couchbase went pretty smoothly. I tested all the code locally but it can be containerized and deployed on K8s in the cloud using Couchbase Autonomous Operator for Kubernetes. Such an example is presented <a href=\"https:\/\/www.couchbase.com\/blog\/elastic-microservices-with-kubernetes-and-spring-boot\/\">here<\/a>.\u00a0 From the enterprise perspective, using other Couchbase features we could potentially extend Fleetman app capabilities. For instance, using N1QL or Analytics developers might construct a query that would find the top 5 trucks based on the max distance traveled over a certain timeframe. Eventing feature could be used to send alerts if a certain truck exceeds a speed limit. Another opportunity for improvement would be to use Couchbase Geospatial queries. The source code of my version of Fleetman application is located on GitHub right <a href=\"https:\/\/github.com\/pnovok\/Fleetman\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I\u2019m a big fan of online learning platforms, such as Udemy. For the price of a bottle of wine, you could learn pretty much anything, from psychology and Thai cooking to programming languages, operating systems and IT certifications.\u00a0 Recently, I [&hellip;]<\/p>\n","protected":false},"author":45744,"featured_media":10432,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1814,8683,1818,2389,6342,6343,2201],"tags":[2103,1424,1630],"ppma_author":[9095],"class_list":["post-8945","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-application-design","category-geospatial","category-java","category-solutions","category-spring","category-spring-boot","category-tools-sdks","tag-microservices","tag-spring","tag-spring-boot"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.8 (Yoast SEO v25.8) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Refactoring Spring Microservices Apps to work with Couchbase<\/title>\n<meta name=\"description\" content=\"Migrating a Spring Boot microservices app to Couchbase can be done easily. Find out some tips, tricks and how-to in this blog that shows a vehicle tracking app.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Refactoring Spring Microservices Apps to work with Couchbase\" \/>\n<meta property=\"og:description\" content=\"Migrating a Spring Boot microservices app to Couchbase can be done easily. Find out some tips, tricks and how-to in this blog that shows a vehicle tracking app.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-26T21:35:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T05:44:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map3-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"936\" \/>\n\t<meta property=\"og:image:height\" content=\"504\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Pavel Novokshonov, Sr. Solutions Engineer, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pavel Novokshonov, Sr. Solutions Engineer, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/\"},\"author\":{\"name\":\"Pavel Novokshonov, Sr. Solutions Engineer, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/8ac9ba59b1f70850c9bf1f71afd655cd\"},\"headline\":\"Refactoring Spring Microservices Apps to work with Couchbase\",\"datePublished\":\"2020-07-26T21:35:38+00:00\",\"dateModified\":\"2025-06-14T05:44:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/\"},\"wordCount\":1116,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map3-2-1.png\",\"keywords\":[\"microservices\",\"spring\",\"spring-boot\"],\"articleSection\":[\"Application Design\",\"Geospatial\",\"Java\",\"Solutions\",\"Spring\",\"Spring Boot\",\"Tools &amp; SDKs\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/\",\"name\":\"Refactoring Spring Microservices Apps to work with Couchbase\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map3-2-1.png\",\"datePublished\":\"2020-07-26T21:35:38+00:00\",\"dateModified\":\"2025-06-14T05:44:56+00:00\",\"description\":\"Migrating a Spring Boot microservices app to Couchbase can be done easily. Find out some tips, tricks and how-to in this blog that shows a vehicle tracking app.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map3-2-1.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map3-2-1.png\",\"width\":1200,\"height\":646},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Refactoring Spring Microservices Apps to work with Couchbase\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/8ac9ba59b1f70850c9bf1f71afd655cd\",\"name\":\"Pavel Novokshonov, Sr. Solutions Engineer, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/6418d9373f088b2fa2f9181680ba8513\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ad85c263d3b7299b6152eca0cb0f4c4f500d85e4d2953c6722684b7f7ab19679?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ad85c263d3b7299b6152eca0cb0f4c4f500d85e4d2953c6722684b7f7ab19679?s=96&d=mm&r=g\",\"caption\":\"Pavel Novokshonov, Sr. Solutions Engineer, Couchbase\"},\"description\":\"Pavel is a Sr. Solution Engineer at Couchbase. Previously, he worked at Teradata Corporation, Harrahs Entertainment and NCR in different roles including database management, consulting, performance engineering and technical pre-sales.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/pavel-novokshonov\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Refactoring Spring Microservices Apps to work with Couchbase","description":"Migrating a Spring Boot microservices app to Couchbase can be done easily. Find out some tips, tricks and how-to in this blog that shows a vehicle tracking app.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/","og_locale":"en_US","og_type":"article","og_title":"Refactoring Spring Microservices Apps to work with Couchbase","og_description":"Migrating a Spring Boot microservices app to Couchbase can be done easily. Find out some tips, tricks and how-to in this blog that shows a vehicle tracking app.","og_url":"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/","og_site_name":"The Couchbase Blog","article_published_time":"2020-07-26T21:35:38+00:00","article_modified_time":"2025-06-14T05:44:56+00:00","og_image":[{"width":936,"height":504,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map3-2.png","type":"image\/png"}],"author":"Pavel Novokshonov, Sr. Solutions Engineer, Couchbase","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Pavel Novokshonov, Sr. Solutions Engineer, Couchbase","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/"},"author":{"name":"Pavel Novokshonov, Sr. Solutions Engineer, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/8ac9ba59b1f70850c9bf1f71afd655cd"},"headline":"Refactoring Spring Microservices Apps to work with Couchbase","datePublished":"2020-07-26T21:35:38+00:00","dateModified":"2025-06-14T05:44:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/"},"wordCount":1116,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map3-2-1.png","keywords":["microservices","spring","spring-boot"],"articleSection":["Application Design","Geospatial","Java","Solutions","Spring","Spring Boot","Tools &amp; SDKs"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/","url":"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/","name":"Refactoring Spring Microservices Apps to work with Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map3-2-1.png","datePublished":"2020-07-26T21:35:38+00:00","dateModified":"2025-06-14T05:44:56+00:00","description":"Migrating a Spring Boot microservices app to Couchbase can be done easily. Find out some tips, tricks and how-to in this blog that shows a vehicle tracking app.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map3-2-1.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/07\/Map3-2-1.png","width":1200,"height":646},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/refactoring-spring-microservices-application-to-work-with-couchbase\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Refactoring Spring Microservices Apps to work with Couchbase"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/8ac9ba59b1f70850c9bf1f71afd655cd","name":"Pavel Novokshonov, Sr. Solutions Engineer, Couchbase","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/6418d9373f088b2fa2f9181680ba8513","url":"https:\/\/secure.gravatar.com\/avatar\/ad85c263d3b7299b6152eca0cb0f4c4f500d85e4d2953c6722684b7f7ab19679?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ad85c263d3b7299b6152eca0cb0f4c4f500d85e4d2953c6722684b7f7ab19679?s=96&d=mm&r=g","caption":"Pavel Novokshonov, Sr. Solutions Engineer, Couchbase"},"description":"Pavel is a Sr. Solution Engineer at Couchbase. Previously, he worked at Teradata Corporation, Harrahs Entertainment and NCR in different roles including database management, consulting, performance engineering and technical pre-sales.","url":"https:\/\/www.couchbase.com\/blog\/author\/pavel-novokshonov\/"}]}},"authors":[{"term_id":9095,"user_id":45744,"is_guest":0,"slug":"pavel-novokshonov","display_name":"Pavel Novokshonov, Sr. Solutions Engineer, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/ad85c263d3b7299b6152eca0cb0f4c4f500d85e4d2953c6722684b7f7ab19679?s=96&d=mm&r=g","author_category":"","last_name":"Novokshonov, Sr. Solutions Engineer, Couchbase","first_name":"Pavel","job_title":"","user_url":"","description":"Pavel is a Sr. Solution Engineer at Couchbase. Previously, he worked at Teradata Corporation, Harrahs Entertainment and NCR in different roles including database management, consulting, performance engineering and technical pre-sales."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/8945","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/45744"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=8945"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/8945\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/10432"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=8945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=8945"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=8945"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=8945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}