{"id":1233,"date":"2018-01-31T03:05:19","date_gmt":"2018-01-31T11:05:19","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/couchbase-spring-boot-spring-data\/"},"modified":"2018-01-31T03:05:19","modified_gmt":"2018-01-31T11:05:19","slug":"couchbase-spring-boot-spring-data","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/es\/couchbase-spring-boot-spring-data\/","title":{"rendered":"Couchbase With Spring-Boot and Spring Data"},"content":{"rendered":"\n<p><span>One of the biggest barriers for anyone who wants to start using new technologies is usually the learning curve. Often while starting a new project, we end up choosing to use what we already know to avoid any friction right at the beginning.<\/span><\/p>\n\n\n\n<p><span>I have spent most of my career working as a Java developer, and in the last few years I fell in love with the <a href=\"https:\/\/docs.oracle.com\/javaee\/5\/tutorial\/doc\/?wp406143&amp;PersistenceIntro.html#wp78460\">JPA<\/a> + <a href=\"https:\/\/projects.spring.io\/spring-boot\/\">Spring-Boot<\/a> + <a href=\"https:\/\/projectlombok.org\/\">Lombok<\/a> + <a href=\"https:\/\/docs.spring.io\/spring-data\/jpa\/docs\/current\/reference\/html\/\">Spring Data<\/a> combination, but the one thing that still annoyed me was mapping relationships.<\/span><\/p>\n\n\n\n<p><span>JPA is known for loading unnecessary data from the database, and over time you are forced to revisit some of your entities to change a few relationships from EAGER to LAZY. It can significantly improve your performance as you will avoid a lot of unnecessary JOINS but it does not come for free. You will be required to do a lot of refactoring to load those new lazy objects whenever they are required. <\/span><\/p>\n\n\n\n<p><span>This common pattern always bothered me and I was really happy when I found that Spring Data and Couchbase can connect (<a href=\"https:\/\/docs.spring.io\/spring-data\/couchbase\/docs\/current\/reference\/html\/\">full doc here<\/a>). It is simply the best part of two worlds, I can program like I would in a relational database but still leveraging all the speed of Couchbase and the power of N1QL. Let\u2019s see how to set up a simple project.<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Setting-Up Spring Data, Spring Boot, and Couchbase<\/b><\/h3>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><b>Prerequisites: <\/b><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span>I will assume that you already have Couchbase installed, if you don\u2019t, please <\/span><a href=\"https:\/\/www.couchbase.com\/downloads\/\"><span>download it here<\/span><\/a><\/li>\n\n\n<li><span>I am also using Lombok, so you might need to install Lombok\u2019s plugin on your IDE: E<\/span><a href=\"https:\/\/projectlombok.org\/setup\/eclipse\"><span>clipse<\/span><\/a><span> and <\/span><span><a href=\"https:\/\/plugins.jetbrains.com\/plugin\/6317-lombok-plugin\">IntelliJ IDEA<\/a><\/span><\/li>\n\n<\/ul>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>First, you can clone my project:<\/span><\/p>\n\n\n<p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]git clone https:\/\/github.com\/deniswsrosa\/couchbase-spring-data-sample.git[\/crayon]<\/p>\n\n\n\n<p><span>or simply go to <\/span><a href=\"https:\/\/start.spring.io\/\"><span>Spring-Boot Initialzr<\/span><\/a><span> and add Couchbase and Lombok as dependencies:<\/span><\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-4546\" src=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/sites\/5\/2026\/05\/Spring-boot-initialzr-1024x451-1.png\" alt=\"\" width=\"730\" height=\"321\"><\/p>\n\n\n\n<p><b>Note:<\/b><span> Lombok is not a required dependency, but it helps to significantly reduce your code base.<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>Now, let\u2019s define your bucket configuration in the <em><strong>application.properties<\/strong><\/em> file:<\/span><\/p>\n\n\n<p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]spring.couchbase.bootstrap-hosts=localhost<br \/>\nspring.couchbase.bucket.name=test<br \/>\nspring.couchbase.bucket.password=couchbase<br \/>\nspring.data.couchbase.auto-index=true[\/crayon]<\/p>\n\n\n\n<p><span>And that&#8217;s it! You are already able to start up your project using:<\/span><\/p>\n\n\n<p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]mvn spring-boot:run[\/crayon]<\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Mapping an Entity<\/b><\/h3>\n\n\n\n<p><span>So far, our project does not do anything. Let\u2019s create and map our first entity:<\/span><\/p>\n\n\n<p>[crayon lang=&#8221;java&#8221; decode=&#8221;true&#8221;]@Document<br \/>\n@Data<br \/>\n@AllArgsConstructor<br \/>\n@NoArgsConstructor<br \/>\n@EqualsAndHashCode<br \/>\npublic class Building {<\/p>\n<p>    @NotNull<br \/>\n    @Id<br \/>\n    private String id;<\/p>\n<p>    @NotNull<br \/>\n    @Field<br \/>\n    private String name;<\/p>\n<p>    @NotNull<br \/>\n    @Field<br \/>\n    private String companyId;<\/p>\n<p>    @Field<br \/>\n    private List&lt;Area&gt; areas = new ArrayList&lt;&gt;();<\/p>\n<p>    @Field<br \/>\n    private List&lt;String&gt; phoneNumbers = new ArrayList&lt;&gt;();<br \/>\n}<br \/>\n[\/crayon]<\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>@Document:<\/b><span> Couchbase\u2019s annotation which defines an entity, similar to <em><strong>@Entity<\/strong><\/em> in JPA. Couchbase will automatically add a property called <\/span><b><i>_class<\/i><\/b><span> in the document to use it as the document type.<\/span><\/li>\n\n\n<li><b>@Data: \u00a0<span>Lombok\u2019s annotation, auto-generate getters and setters<\/span><\/b><\/li>\n\n\n<li><strong>@AllArgsConstructor:<\/strong><span> Lombok\u2019s annotation, auto-generate a constructor using all fields of the class, this constructor <a href=\"https:\/\/github.com\/deniswsrosa\/couchbase-spring-data-sample\/blob\/master\/src\/test\/java\/com\/cb\/springdata\/sample\/BuildingServiceIntegrationTest.java\">is used in our tests<\/a>.<\/span><\/li>\n\n\n<li><strong>@NoArgsConstructor:<\/strong> <span>Lombok\u2019s annotation, auto-generate a constructor with no args (required by Spring Data)<\/span><\/li>\n\n\n<li><strong>@EqualsAndHashCode:<\/strong> <span>Lombok\u2019s annotation, auto-generate equals and hashcode methods, also used in our tests.<\/span><\/li>\n\n\n<li><strong>@NotNull:<\/strong> <span>Yes! You can use javax.validation with Couchbase.<\/span><\/li>\n\n\n<li><strong>@Id:<\/strong><span> The document&#8217;s key<\/span><\/li>\n\n\n<li><strong>@Field:<\/strong> <span>\u00a0Couchbase\u2019s annotations, similar to <em><strong>@Column<\/strong><\/em><\/span><\/li>\n\n<\/ul>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>Mapping entities in Couchbase is really simple and straightforward, the biggest difference here is the <\/span><b>@Field<\/b><span> entity which is used in 3 different ways:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>Simple property:<\/b><span> In cases like <\/span><i><span>id<\/span><\/i><span>, <\/span><i><span>name\u00a0<\/span><\/i><span>and <\/span><i><span>companyId,<\/span><\/i><span> the <em><strong>@Field<\/strong><\/em> acts pretty much like the <em><strong>@Column<\/strong><\/em> in JPA. \u00a0It will result in a simple property in the document:<\/span><\/li>\n\n<\/ul>\n\n\n<p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]{<br \/>\n\u00a0&#8220;id&#8221;: &#8220;building::1&#8221;,<br \/>\n\u00a0&#8220;name&#8221;: &#8220;Couchbase&#8217;s Building&#8221;,<br \/>\n\u00a0&#8220;companyId&#8221;: &#8220;company::1&#8221;<br \/>\n}[\/crayon]<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>Arrays<\/b><span>: In the phoneNumbers\u2019s case it will result in an array inside the document:<\/span><\/li>\n\n<\/ul>\n\n\n<p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]{<br \/>\n\u00a0&#8220;phoneNumbers&#8221;: [&#8220;phoneNumber1&#8221;, &#8220;phoneNumber2&#8221;]<br \/>\n}<br \/>\n[\/crayon]<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>Entities<\/b><span>: Finally, in the areas\u2019s case, <\/span><b>@Field<\/b><span> acts like a <\/span><em><b>@ManyToOne<\/b><\/em><span> relationship, the main difference is that you are not required to map anything in the Area entity:<\/span><\/li>\n\n<\/ul>\n\n\n<p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]@EqualsAndHashCode<br \/>\n@AllArgsConstructor<br \/>\n@NoArgsConstructor<br \/>\n@Data<br \/>\npublic class Area {<\/p>\n<p>    private String id;<\/p>\n<p>    private String name;<\/p>\n<p>    private List&lt;Area&gt; areas = new ArrayList&lt;&gt;();<br \/>\n}<br \/>\n[\/crayon]<\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Repositories<\/b><\/h3>\n\n\n\n<p><span>Your repositories will look very similar to standard Spring Data repositories but with a few extra annotations:<\/span><\/p>\n\n\n<p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]@N1qlPrimaryIndexed<br \/>\n@ViewIndexed(designDoc = &#8220;building&#8221;)<br \/>\npublic interface BuildingRepository extends CouchbasePagingAndSortingRepository&lt;Building, String&gt; {<\/p>\n<p>    List&lt;Building&gt; findByCompanyId(String companyId);<\/p>\n<p>    Page&lt;Building&gt; findByCompanyIdAndNameLikeOrderByName(String companyId, String name, Pageable pageable);<\/p>\n<p>    @Query(&#8220;#{#n1ql.selectEntity} where #{#n1ql.filter} and companyId = $1 and $2 within #{#n1ql.bucket}&#8221;)<br \/>\n    Building findByCompanyAndAreaId(String companyId, String areaId);<\/p>\n<p>    @Query(&#8220;#{#n1ql.selectEntity} where #{#n1ql.filter} AND ANY phone IN phoneNumbers SATISFIES phone = $1 END&#8221;)<br \/>\n    List&lt;Building&gt; findByPhoneNumber(String telephoneNumber);<\/p>\n<p>    @Query(&#8220;SELECT COUNT(*) AS count FROM #{#n1ql.bucket} WHERE #{#n1ql.filter} and companyId = $1&#8221;)<br \/>\n    Long countBuildings(String companyId);<br \/>\n}<br \/>\n[\/crayon]<\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>@N1qlPrimaryIndexed<\/b><span>: This\u00a0<\/span><a href=\"https:\/\/docs.spring.io\/spring-data\/couchbase\/docs\/current\/api\/index.html?org\/springframework\/data\/couchbase\/core\/query\/N1qlPrimaryIndexed.html\"><span>annotation<\/span><\/a><span>\u00a0makes sure that the bucket associated with the current repository will have a N1QL primary index<\/span><\/li>\n\n\n<li><b>@ViewIndexed: \u00a0<\/b><span>This\u00a0<\/span><a href=\"https:\/\/docs.spring.io\/spring-data\/couchbase\/docs\/current\/api\/index.html?org\/springframework\/data\/couchbase\/core\/query\/ViewIndexed.html\"><span>annotation<\/span><\/a><span>\u00a0lets you define the name of the design document and View name as well as a custom map and reduce function.<\/span><\/li>\n\n<\/ul>\n\n\n\n<p><span>In the repository above, we are extending <\/span><b><i>CouchbasePagingAndSortingRepository<\/i><\/b><span>, which allows you to paginate your queries by simply adding a <\/span><b><i>Pageable<\/i><\/b><span> param at the end of your method definition<\/span><\/p>\n\n\n\n<p><span>As it is essentially a repository, you can leverage all <\/span><a href=\"https:\/\/docs.spring.io\/spring-data\/couchbase\/docs\/current\/reference\/html\/#couchbase.repository.querying\"><span>Spring Data keywords<\/span><\/a><span> like <\/span><b><i>FindBy<\/i><\/b><span>, <\/span><b><i>Between<\/i><\/b><span>, <\/span><b><i>IsGreaterThan<\/i><\/b><span>, <\/span><b><i>Like<\/i><\/b><span>, <\/span><b><i>Exists<\/i><\/b><span>, etc. So, you can start using Couchbase with almost no previous knowledge and still be very productive.<\/span><\/p>\n\n\n\n<p><span>As you might have noticed, you can create full <\/span><a href=\"https:\/\/query-tutorial.couchbase.com\/tutorial\/\"><span>N1QL<\/span><\/a><span> queries but with a few syntax-sugars:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>#(#n1ql.bucket):<\/b><span> \u00a0Use this syntax avoids hard-coding your bucket name in your query<\/span><\/li>\n\n\n<li><b>#{#n1ql.selectEntity}:<span> syntax-sugar to <\/span><i>SELECT * FROM #(#n1ql.bucket)<\/i>:<span> \u00a0<\/span><\/b><\/li>\n\n\n<li><strong>#{#n1ql.filter}:<\/strong><span> syntax-sugar to filter the document by type, technically it means <\/span><strong><i>class = \u2018myPackage.MyClassName\u2019<\/i><\/strong><i><span> (<\/span><\/i><span><em><strong>_class<\/strong><\/em> is the attribute automatically added in the document to define its type when you are working with Couchbase on Spring Data )<\/span><\/li>\n\n\n<li><b>#{<\/b><b>#n1ql.fields}\u00a0<\/b>will be replaced by the list of fields (eg. for a SELECT clause) necessary to reconstruct the entity.<\/li>\n\n\n<li><b>#{<\/b><b>#n1ql.delete}\u00a0<\/b><span>will be replaced by the\u00a0delete from\u00a0statement.<\/span><\/li>\n\n\n<li><b>#{<\/b><b>#n1ql.returning}\u00a0<\/b><span>will be replaced by the returning clause needed for reconstructing the entity.<\/span><\/li>\n\n<\/ul>\n\n\n\n<p><span>To demonstrate some of the cool capabilities of N1QL, let\u2019s go a little deeper in two methods of our repository: <\/span><b><i>findByPhoneNumber<\/i><\/b><span> and <\/span><b><i>findByCompanyAndAreaId:<\/i><\/b><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><b>findByPhoneNumber<\/b><\/h4>\n\n\n<p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]@Query(&#8220;#{#n1ql.selectEntity} where #{#n1ql.filter} AND ANY phone IN phoneNumbers SATISFIES phone = $1 END&#8221;)<br \/>\nList&lt;Building&gt; findByPhoneNumber(String telephoneNumber);[\/crayon]<\/p>\n\n\n\n<p><span>In the case above we are simply searching for buildings by telephone numbers. In a relational world, you would normally need 2 tables to accomplish nearly the same thing. With Couchbase we can store everything in a single document, which makes loading a \u201cbuilding\u201d much faster than what you would get using any RDBMS.<\/span><\/p>\n\n\n\n<p><span>Additionally, you can speed up your query performance even more by <\/span><a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/current\/n1ql\/n1ql-language-reference\/indexing-arrays.html\"><span>adding an index on the phoneNumbers attribute<\/span><\/a><span>.<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><b>findByCompanyAndAreaId<\/b><\/h4>\n\n\n<p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]@Query(&#8220;#{#n1ql.selectEntity} where #{#n1ql.filter} and companyId = $1 and $2 within #{#n1ql.bucket}&#8221;)<br \/>\nBuilding findByCompanyAndAreaId(String companyId, String areaId);[\/crayon]<\/p>\n\n\n\n<p><span>In the query above we are basically trying to find the root node (Building) giving a random child node (Area). Our data is structured as a tree because an Area could also have a list of other areas:<\/span><\/p>\n\n\n\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]spring.couchbase.bootstrap-hosts=localhost<br \/>\nspring.couchbase.bucket.name=test<br \/>\nspring.couchbase.bucket.password=couchbase<br \/>\nspring.data.couchbase.auto-index=true[\/crayon]<\/p>\n0<\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p>This type of querying is one of the most expensive and complex operations when you are working with a relational database, in most of the cases you either find the root node <em>by hand<\/em> or by using some big fat query with <em><b>UNIONs<\/b><\/em> and <b><i>CONNECTED BYs<\/i><\/b>.<\/p>\n\n\n\n<p><span>Here you can solve this problem by using a magical keyword called <\/span><a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/current\/n1ql\/n1ql-language-reference\/collectionops.html\"><span>WITHIN<\/span><\/a><span>.<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Services<\/b><\/h3>\n\n\n\n<p><span>By default, you will inject and use your repositories in your Services like you normally would, but you can additionally access Couchbase\u2019s specific repositories capabilities using the method <\/span><b>getCouchbaseOperations()<\/b><\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-4547\" src=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase_operations-1024x478-1.png\" alt=\"\" width=\"699\" height=\"326\"><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Everything in Action<\/b><\/h3>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p>Using\u00a0 services are to exactly what you would expect:<\/p>\n\n\n\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]spring.couchbase.bootstrap-hosts=localhost<br \/>\nspring.couchbase.bucket.name=test<br \/>\nspring.couchbase.bucket.password=couchbase<br \/>\nspring.data.couchbase.auto-index=true[\/crayon]<\/p>\n1<\/p>\n\n\n\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]spring.couchbase.bootstrap-hosts=localhost<br \/>\nspring.couchbase.bucket.name=test<br \/>\nspring.couchbase.bucket.password=couchbase<br \/>\nspring.data.couchbase.auto-index=true[\/crayon]<\/p>\n2<\/p>\n\n\n\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]spring.couchbase.bootstrap-hosts=localhost<br \/>\nspring.couchbase.bucket.name=test<br \/>\nspring.couchbase.bucket.password=couchbase<br \/>\nspring.data.couchbase.auto-index=true[\/crayon]<\/p>\n3<\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>Check out the integration test class <a href=\"https:\/\/github.com\/deniswsrosa\/couchbase-spring-data-sample\/blob\/master\/src\/test\/java\/com\/cb\/springdata\/sample\/BuildingServiceIntegrationTest.java\">BuildingServiceIntegrationTest<\/a> to see everything in action.<\/span><\/p>\n\n\n\n<p><span>If you have any questions, tweet me at <a href=\"https:\/\/twitter.com\/deniswsrosa\">@deniswsrosa<\/a> or ask a question on our <\/span><a href=\"https:\/\/www.couchbase.com\/forums\/\"><span>forum<\/span><\/a><\/p>\n\n\n\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the biggest barriers for anyone who wants to start using new technologies is usually the learning curve. Often while starting a new project, we end up choosing to use what we already know to avoid any friction right at the beginning. I have spent most of my career working as a Java developer, [&hellip;]<\/p>\n","protected":false},"author":8754,"featured_media":18,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[136,144],"tags":[],"ppma_author":[287],"class_list":["post-1233","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-best-practices-and-tutorials","category-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.6 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Spring-Boot and Spring Data: Setting Up with Couchbase<\/title>\n<meta name=\"description\" content=\"Need to learn how to set up Spring Data, Spring Boot, and Couchbase? This blog post will show your prerequisites, repositories, and everything in action.\" \/>\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\/es\/couchbase-spring-boot-spring-data\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Couchbase With Spring-Boot and Spring Data\" \/>\n<meta property=\"og:description\" content=\"Need to learn how to set up Spring Data, Spring Boot, and Couchbase? This blog post will show your prerequisites, repositories, and everything in action.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/es\/couchbase-spring-boot-spring-data\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-01-31T11:05:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1800\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Denis Rosa, Developer Advocate, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@deniswsrosa\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Denis Rosa, Developer Advocate, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-spring-boot-spring-data\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-spring-boot-spring-data\\\/\"},\"author\":{\"name\":\"Denis Rosa, Developer Advocate, Couchbase\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/fe3c5273e805e72a5294611a48f62257\"},\"headline\":\"Couchbase With Spring-Boot and Spring Data\",\"datePublished\":\"2018-01-31T11:05:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-spring-boot-spring-data\\\/\"},\"wordCount\":1488,\"commentCount\":11,\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-spring-boot-spring-data\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/couchbase-nosql-dbaas.png\",\"articleSection\":[\"Best Practices and Tutorials\",\"Java\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-spring-boot-spring-data\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-spring-boot-spring-data\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-spring-boot-spring-data\\\/\",\"name\":\"Spring-Boot and Spring Data: Setting Up with Couchbase\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-spring-boot-spring-data\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-spring-boot-spring-data\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2018-01-31T11:05:19+00:00\",\"description\":\"Need to learn how to set up Spring Data, Spring Boot, and Couchbase? This blog post will show your prerequisites, repositories, and everything in action.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-spring-boot-spring-data\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-spring-boot-spring-data\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-spring-boot-spring-data\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-spring-boot-spring-data\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Couchbase With Spring-Boot and Spring Data\"}]},{\"@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\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/06\\\/logo.svg\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/06\\\/logo.svg\",\"width\":\"1024\",\"height\":\"1024\",\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/fe3c5273e805e72a5294611a48f62257\",\"name\":\"Denis Rosa, Developer Advocate, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f8d1f5c13115122cab89d0f229b904480bfe20d3dfbb093fe9734cda5235d419?s=96&d=mm&r=gbe0716f6199cfb09417c92cf7a8fa8d6\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f8d1f5c13115122cab89d0f229b904480bfe20d3dfbb093fe9734cda5235d419?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f8d1f5c13115122cab89d0f229b904480bfe20d3dfbb093fe9734cda5235d419?s=96&d=mm&r=g\",\"caption\":\"Denis Rosa, Developer Advocate, Couchbase\"},\"description\":\"Denis Rosa is a Developer Advocate for Couchbase and lives in Munich - Germany. He has a solid experience as a software engineer and speaks fluently Java, Python, Scala and Javascript. Denis likes to write about search, Big Data, AI, Microservices and everything else that would help developers to make a beautiful, faster, stable and scalable app.\",\"sameAs\":[\"https:\\\/\\\/x.com\\\/deniswsrosa\"],\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/author\\\/denis-rosa\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Spring-Boot and Spring Data: Setting Up with Couchbase","description":"Need to learn how to set up Spring Data, Spring Boot, and Couchbase? This blog post will show your prerequisites, repositories, and everything in action.","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\/es\/couchbase-spring-boot-spring-data\/","og_locale":"es_MX","og_type":"article","og_title":"Couchbase With Spring-Boot and Spring Data","og_description":"Need to learn how to set up Spring Data, Spring Boot, and Couchbase? This blog post will show your prerequisites, repositories, and everything in action.","og_url":"https:\/\/www.couchbase.com\/blog\/es\/couchbase-spring-boot-spring-data\/","og_site_name":"The Couchbase Blog","article_published_time":"2018-01-31T11:05:19+00:00","og_image":[{"width":1800,"height":630,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png","type":"image\/png"}],"author":"Denis Rosa, Developer Advocate, Couchbase","twitter_card":"summary_large_image","twitter_creator":"@deniswsrosa","twitter_misc":{"Written by":"Denis Rosa, Developer Advocate, Couchbase","Est. reading time":"5 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-spring-boot-spring-data\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-spring-boot-spring-data\/"},"author":{"name":"Denis Rosa, Developer Advocate, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/fe3c5273e805e72a5294611a48f62257"},"headline":"Couchbase With Spring-Boot and Spring Data","datePublished":"2018-01-31T11:05:19+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-spring-boot-spring-data\/"},"wordCount":1488,"commentCount":11,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-spring-boot-spring-data\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png","articleSection":["Best Practices and Tutorials","Java"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/couchbase-spring-boot-spring-data\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-spring-boot-spring-data\/","url":"https:\/\/www.couchbase.com\/blog\/couchbase-spring-boot-spring-data\/","name":"Spring-Boot and Spring Data: Setting Up with Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-spring-boot-spring-data\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-spring-boot-spring-data\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png","datePublished":"2018-01-31T11:05:19+00:00","description":"Need to learn how to set up Spring Data, Spring Boot, and Couchbase? This blog post will show your prerequisites, repositories, and everything in action.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-spring-boot-spring-data\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/couchbase-spring-boot-spring-data\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-spring-boot-spring-data\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-spring-boot-spring-data\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Couchbase With Spring-Boot and Spring Data"}]},{"@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":"es"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/06\/logo.svg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/06\/logo.svg","width":"1024","height":"1024","caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/fe3c5273e805e72a5294611a48f62257","name":"Denis Rosa, Developer Advocate, Couchbase","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/secure.gravatar.com\/avatar\/f8d1f5c13115122cab89d0f229b904480bfe20d3dfbb093fe9734cda5235d419?s=96&d=mm&r=gbe0716f6199cfb09417c92cf7a8fa8d6","url":"https:\/\/secure.gravatar.com\/avatar\/f8d1f5c13115122cab89d0f229b904480bfe20d3dfbb093fe9734cda5235d419?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f8d1f5c13115122cab89d0f229b904480bfe20d3dfbb093fe9734cda5235d419?s=96&d=mm&r=g","caption":"Denis Rosa, Developer Advocate, Couchbase"},"description":"Denis Rosa is a Developer Advocate for Couchbase and lives in Munich - Germany. He has a solid experience as a software engineer and speaks fluently Java, Python, Scala and Javascript. Denis likes to write about search, Big Data, AI, Microservices and everything else that would help developers to make a beautiful, faster, stable and scalable app.","sameAs":["https:\/\/x.com\/deniswsrosa"],"url":"https:\/\/www.couchbase.com\/blog\/es\/author\/denis-rosa\/"}]}},"acf":[],"authors":[{"term_id":287,"user_id":8754,"is_guest":0,"slug":"denis-rosa","display_name":"Denis Rosa, Developer Advocate, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/1233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/users\/8754"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/comments?post=1233"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/1233\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media\/18"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media?parent=1233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/categories?post=1233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/tags?post=1233"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/ppma_author?post=1233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}