{"id":92,"date":"2024-01-31T10:56:22","date_gmt":"2024-01-31T09:56:22","guid":{"rendered":"https:\/\/www.karvala.net\/?post_type=project&#038;p=92"},"modified":"2024-02-01T21:18:41","modified_gmt":"2024-02-01T20:18:41","slug":"biblioteca-java","status":"publish","type":"project","link":"https:\/\/www.karvala.net\/en\/project\/biblioteca-java\/","title":{"rendered":"Library"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; custom_padding_last_edited=&#8221;on|phone&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; background_color=&#8221;#D4ACA0&#8243; custom_padding=&#8221;20px|100px|20px|100px|true|true&#8221; custom_padding_tablet=&#8221;20px|100px|20px|100px|true|true&#8221; custom_padding_phone=&#8221;20px|10px|20px|10px|true|true&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_row admin_label=&#8221;intro&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;25px&#8221; text_line_height=&#8221;2em&#8221; text_font_size_tablet=&#8221;25px&#8221; text_font_size_phone=&#8221;20px&#8221; text_font_size_last_edited=&#8221;on|phone&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<p>I had the fortune of growing up in a house full of books, and several times while growing up, I wanted to organize and arrange them in some way to make it easier to find them and know what books were there. After finishing university, I tried to do it with a couple of applications, but none of them fully convinced me. So, as soon as I started learning programming, I had the idea in my mind to create my own application.<\/p>\n<p>And it all begins here:<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;3_4,1_4&#8243; admin_label=&#8221;t\u00edtol&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;3_4&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; header_font=&#8221;|800|||||||&#8221; header_text_align=&#8221;center&#8221; header_font_size=&#8221;45px&#8221; custom_margin=&#8221;0px||||false|false&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h1>Book Management System API on Java and SpringBoot<\/h1>\n<p>[\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;1_4&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_image src=&#8221;https:\/\/www.karvala.net\/wp-content\/uploads\/2024\/01\/github-logo.png&#8221; alt=&#8221;Logo de Github (s\u00f3lo el contorno del gato)&#8221; title_text=&#8221;github-logo&#8221; url=&#8221;https:\/\/github.com\/KarvalaCode\/Biblioteca&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; background_color=&#8221;RGBA(255,255,255,0)&#8221; width=&#8221;80px&#8221; width_tablet=&#8221;80px&#8221; width_phone=&#8221;50%&#8221; width_last_edited=&#8221;on|phone&#8221; custom_margin=&#8221;0px||||false|false&#8221; hover_enabled=&#8221;0&#8243; global_colors_info=&#8221;{}&#8221; transform_styles__hover_enabled=&#8221;on|hover&#8221; transform_scale__hover_enabled=&#8221;on|hover&#8221; transform_translate__hover_enabled=&#8221;on|desktop&#8221; transform_rotate__hover_enabled=&#8221;on|desktop&#8221; transform_skew__hover_enabled=&#8221;on|desktop&#8221; transform_origin__hover_enabled=&#8221;on|desktop&#8221; transform_scale__hover=&#8221;110%|110%&#8221; background_color__hover=&#8221;RGBA(255,255,255,0)&#8221; sticky_enabled=&#8221;0&#8243;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;resum&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; custom_margin=&#8221;0px||0px||true|false&#8221; custom_padding=&#8221;0px||0px||true|false&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<p>The code provided is a basic Spring Boot application with RESTful API functionality to manage a home library and includes both integration and unit testing.<\/p>\n<p>Here&#8217;s what the code does summarized:<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; ul_line_height=&#8221;1.3em&#8221; custom_margin_tablet=&#8221;&#8221; custom_margin_phone=&#8221;0px||0px||true|false&#8221; custom_margin_last_edited=&#8221;on|phone&#8221; custom_padding_tablet=&#8221;&#8221; custom_padding_phone=&#8221;0px||0px||true|false&#8221; custom_padding_last_edited=&#8221;on|phone&#8221; custom_css_free_form=&#8221;selector li {||  margin-bottom: 10px;||}&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<ul>\n<li><strong>Libro.java (The Book Details):<\/strong> it describes each book. For every book, you can note down its name, author, and where it is in the library.<\/li>\n<li><strong>LibroRepository.java (The Bookkeeper):<\/strong> This part keeps track of all your books. It knows how to save, find, and delete books.<\/li>\n<li><strong>LibroController.java (The Book Manager):<\/strong> It helps you manage your books. It understands commands like &#8220;Show me all the books&#8221; or &#8220;Add a new book.&#8221;<\/li>\n<li><strong>BibliotecaApplication.java (The Starter):<\/strong> This starts the whole library system. It&#8217;s where the adventure begins.<\/li>\n<li><strong>Tests (The Checkers):<\/strong> There are little checkers to make sure everything is working correctly. They&#8217;re like friends who make sure the tool does what it&#8217;s supposed to do.<\/li>\n<\/ul>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; ul_line_height=&#8221;1.3em&#8221; header_font=&#8221;|600|||||||&#8221; header_text_align=&#8221;center&#8221; header_font_size=&#8221;50px&#8221; header_line_height=&#8221;2em&#8221; header_line_height_tablet=&#8221;2em&#8221; header_line_height_phone=&#8221;1.3em&#8221; header_line_height_last_edited=&#8221;on|phone&#8221; custom_css_free_form=&#8221;selector li {||  margin-bottom: 10px;||}&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h1>Project Structure<\/h1>\n<p>The project is structured as a Spring Boot application.<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; ul_line_height=&#8221;1.3em&#8221; header_font=&#8221;|600|||||||&#8221; header_text_align=&#8221;center&#8221; header_font_size=&#8221;50px&#8221; header_line_height=&#8221;2em&#8221; custom_margin=&#8221;20px||||false|false&#8221; custom_css_free_form=&#8221;selector li {||  margin-bottom: 10px;||}&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<ul>\n<li>The main code is located in the <code>src\/main\/java\/net\/Karvala\/Biblioteca<\/code> directory.<\/li>\n<li>The code includes a RESTful controller (<code>LibroController<\/code>), an entity class (<code>Libro<\/code>), a repository interface (<code>LibroRepository<\/code>), and the main application class (<code>BibliotecaApplication<\/code>).<\/li>\n<li>Tests are provided in the <code>src\/test<\/code> directory.<\/li>\n<\/ul>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;3_5,2_5&#8243; admin_label=&#8221;libro entity&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; custom_margin=&#8221;0px||0px||true|false&#8221; custom_padding=&#8221;0px||0px||true|false&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;3_5&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; ul_line_height=&#8221;1.3em&#8221; header_font=&#8221;|600|||||||&#8221; header_text_align=&#8221;center&#8221; header_font_size=&#8221;50px&#8221; header_line_height=&#8221;2em&#8221; header_2_text_align=&#8221;center&#8221; header_2_font_size=&#8221;30px&#8221; custom_margin=&#8221;70px||||false|false&#8221; custom_margin_tablet=&#8221;70px||||false|false&#8221; custom_margin_phone=&#8221;10px||||false|false&#8221; custom_margin_last_edited=&#8221;on|phone&#8221; custom_padding=&#8221;||||false|false&#8221; header_2_line_height_tablet=&#8221;&#8221; header_2_line_height_phone=&#8221;1.3em&#8221; header_2_line_height_last_edited=&#8221;on|phone&#8221; custom_css_free_form=&#8221;selector li {||  margin-bottom: 10px;||}&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h2>Libro Entity (<code>Libro.java<\/code>)<\/h2>\n<p>Represents a book with attributes such as title, author, and shelf.<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; ul_line_height=&#8221;1.3em&#8221; header_font=&#8221;|600|||||||&#8221; header_text_align=&#8221;center&#8221; header_font_size=&#8221;50px&#8221; header_line_height=&#8221;2em&#8221; custom_margin=&#8221;20px||||false|false&#8221; custom_margin_tablet=&#8221;20px||||false|false&#8221; custom_margin_phone=&#8221;0px||0px||true|false&#8221; custom_margin_last_edited=&#8221;on|phone&#8221; custom_css_free_form=&#8221;selector li {||  margin-bottom: 10px;||}&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<ul>\n<li>Annotated with <code>@Entity<\/code> to indicate it is a JPA entity.<\/li>\n<li>Uses <code>@Id<\/code> and <code>@GeneratedValue<\/code> annotations for primary key generation.<\/li>\n<\/ul>\n<p>[\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;2_5&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_image src=&#8221;https:\/\/www.karvala.net\/wp-content\/uploads\/2024\/01\/libro-java.png&#8221; alt=&#8221;captura de pantalla del c\u00f3digo&#8221; title_text=&#8221;libro-java&#8221; show_in_lightbox=&#8221;on&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; background_color=&#8221;RGBA(255,255,255,0)&#8221; custom_margin=&#8221;0px||0px||true|false&#8221; custom_margin_tablet=&#8221;0px||0px||true|false&#8221; custom_margin_phone=&#8221;0px||0px||true|false&#8221; custom_margin_last_edited=&#8221;on|phone&#8221; custom_padding=&#8221;0px||0px||true|false&#8221; border_radii=&#8221;on|25px|25px|25px|25px&#8221; global_colors_info=&#8221;{}&#8221; background_color__hover=&#8221;RGBA(255,255,255,0)&#8221;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;2_5,3_5&#8243; admin_label=&#8221;libro repository&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; custom_margin=&#8221;0px||0px||true|false&#8221; custom_padding=&#8221;0px||0px||true|false&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;2_5&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_image src=&#8221;https:\/\/www.karvala.net\/wp-content\/uploads\/2024\/01\/libro-repository-java.png&#8221; alt=&#8221;captura de pantalla del c\u00f3digo&#8221; title_text=&#8221;libro-repository-java&#8221; show_in_lightbox=&#8221;on&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; background_color=&#8221;RGBA(255,255,255,0)&#8221; custom_margin=&#8221;50px||50px||true|false&#8221; custom_margin_tablet=&#8221;50px||50px||true|false&#8221; custom_margin_phone=&#8221;10px||10px||true|false&#8221; custom_margin_last_edited=&#8221;on|phone&#8221; custom_padding=&#8221;0px||0px||true|false&#8221; border_radii=&#8221;on|25px|25px|25px|25px&#8221; global_colors_info=&#8221;{}&#8221; background__hover_enabled=&#8221;off|desktop&#8221;][\/et_pb_image][\/et_pb_column][et_pb_column type=&#8221;3_5&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; ul_line_height=&#8221;1.3em&#8221; header_font=&#8221;|600|||||||&#8221; header_text_align=&#8221;center&#8221; header_font_size=&#8221;50px&#8221; header_line_height=&#8221;2em&#8221; header_2_text_align=&#8221;center&#8221; header_2_font_size=&#8221;30px&#8221; custom_margin=&#8221;80px||||false|false&#8221; custom_margin_tablet=&#8221;80px||||false|false&#8221; custom_margin_phone=&#8221;0px||0px||true|false&#8221; custom_margin_last_edited=&#8221;on|phone&#8221; custom_padding=&#8221;||||false|false&#8221; custom_css_free_form=&#8221;selector li {||  margin-bottom: 10px;||}&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h2>Libro Repository (<code>LibroRepository.java<\/code>)<\/h2>\n<p>Extends <code>JpaRepository<\/code>, providing CRUD operations for the <code>Libro<\/code> entity.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;3_4,1_4&#8243; admin_label=&#8221;libro controller&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; custom_margin=&#8221;0px||0px||true|false&#8221; custom_padding=&#8221;0px||0px||true|false&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;3_4&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; ul_line_height=&#8221;1.3em&#8221; header_font=&#8221;|600|||||||&#8221; header_text_align=&#8221;center&#8221; header_font_size=&#8221;50px&#8221; header_line_height=&#8221;2em&#8221; header_2_text_align=&#8221;center&#8221; header_2_font_size=&#8221;30px&#8221; custom_margin=&#8221;70px||||false|false&#8221; custom_margin_tablet=&#8221;70px||||false|false&#8221; custom_margin_phone=&#8221;10px||10px||true|false&#8221; custom_margin_last_edited=&#8221;on|phone&#8221; custom_padding=&#8221;||||false|false&#8221; custom_css_free_form=&#8221;selector li {||  margin-bottom: 10px;||}&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h2>Libro Controller (<code>LibroController.java<\/code>)<\/h2>\n<p>Implements CRUD operations for managing books using Spring Web&#8217;s RESTful capabilities.<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; ul_line_height=&#8221;1.3em&#8221; header_font=&#8221;|600|||||||&#8221; header_text_align=&#8221;center&#8221; header_font_size=&#8221;50px&#8221; header_line_height=&#8221;2em&#8221; custom_margin=&#8221;20px||||false|false&#8221; custom_css_free_form=&#8221;selector li {||  margin-bottom: 10px;||}&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<ul>\n<li>Uses dependency injection to inject a <code>LibroRepository<\/code> instance.<\/li>\n<li>Defines methods for listing all books, finding a book by ID, creating a new book, updating a book, and deleting a book.<\/li>\n<\/ul>\n<p>[\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;1_4&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_image src=&#8221;https:\/\/www.karvala.net\/wp-content\/uploads\/2024\/01\/libro-controller-java.png&#8221; alt=&#8221;captura de pantalla de parte del c\u00f3digo&#8221; title_text=&#8221;libro-controller-java&#8221; show_in_lightbox=&#8221;on&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; background_color=&#8221;RGBA(255,255,255,0)&#8221; custom_margin=&#8221;60px||60px||true|false&#8221; custom_margin_tablet=&#8221;60px||60px||true|false&#8221; custom_margin_phone=&#8221;10px||10px||true|false&#8221; custom_margin_last_edited=&#8221;on|phone&#8221; custom_padding=&#8221;0px||0px||true|false&#8221; border_radii=&#8221;on|25px|25px|25px|25px&#8221; global_colors_info=&#8221;{}&#8221; background__hover_enabled=&#8221;off|desktop&#8221;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;2_5,3_5&#8243; admin_label=&#8221;biblioteca application&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; custom_margin=&#8221;0px||0px||true|false&#8221; custom_padding=&#8221;0px||0px||true|false&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;2_5&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_image src=&#8221;https:\/\/www.karvala.net\/wp-content\/uploads\/2024\/01\/bibliotecca-app.png&#8221; alt=&#8221;captura de pantalla de parte del c\u00f3digo&#8221; title_text=&#8221;bibliotecca-app&#8221; show_in_lightbox=&#8221;on&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; background_color=&#8221;RGBA(255,255,255,0)&#8221; custom_margin=&#8221;100px||||false|false&#8221; custom_margin_tablet=&#8221;100px||||false|false&#8221; custom_margin_phone=&#8221;0px||||false|false&#8221; custom_margin_last_edited=&#8221;on|phone&#8221; custom_padding=&#8221;0px||0px||true|false&#8221; border_radii=&#8221;on|25px|25px|25px|25px&#8221; global_colors_info=&#8221;{}&#8221; background__hover_enabled=&#8221;off|desktop&#8221;][\/et_pb_image][\/et_pb_column][et_pb_column type=&#8221;3_5&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; ul_line_height=&#8221;1.3em&#8221; header_font=&#8221;|600|||||||&#8221; header_text_align=&#8221;center&#8221; header_font_size=&#8221;50px&#8221; header_line_height=&#8221;2em&#8221; header_2_text_align=&#8221;center&#8221; header_2_font_size=&#8221;30px&#8221; custom_margin=&#8221;80px||||false|false&#8221; custom_margin_tablet=&#8221;80px||||false|false&#8221; custom_margin_phone=&#8221;0px||0px||true|false&#8221; custom_margin_last_edited=&#8221;on|phone&#8221; custom_padding=&#8221;||||false|false&#8221; custom_css_free_form=&#8221;selector li {||  margin-bottom: 10px;||}&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h2>Biblioteca Application (<code>BibliotecaApplication.java<\/code>)<\/h2>\n<p>The main class that runs the Spring Boot application.<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; ul_line_height=&#8221;1.3em&#8221; header_font=&#8221;|600|||||||&#8221; header_text_align=&#8221;center&#8221; header_font_size=&#8221;50px&#8221; header_line_height=&#8221;2em&#8221; custom_margin=&#8221;20px||||false|false&#8221; custom_css_free_form=&#8221;selector li {||  margin-bottom: 10px;||}&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<ul>\n<li>Demonstrates the usage of the <code>LibroRepository<\/code> by creating, saving, and retrieving books<\/li>\n<\/ul>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;2_5,3_5&#8243; admin_label=&#8221;tests&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; custom_margin=&#8221;50px||0px||false|false&#8221; custom_margin_tablet=&#8221;50px||0px||false|false&#8221; custom_margin_phone=&#8221;0px||0px||true|false&#8221; custom_margin_last_edited=&#8221;on|phone&#8221; custom_padding=&#8221;0px||0px||true|false&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;2_5&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; ul_line_height=&#8221;1.3em&#8221; header_font=&#8221;|600|||||||&#8221; header_text_align=&#8221;center&#8221; header_font_size=&#8221;50px&#8221; header_line_height=&#8221;2em&#8221; header_2_text_align=&#8221;center&#8221; header_2_font_size=&#8221;30px&#8221; custom_margin=&#8221;90px||||false|false&#8221; custom_margin_tablet=&#8221;90px||||false|false&#8221; custom_margin_phone=&#8221;0px||0px||true|false&#8221; custom_margin_last_edited=&#8221;on|phone&#8221; custom_padding=&#8221;||||false|false&#8221; custom_css_free_form=&#8221;selector li {||  margin-bottom: 10px;||}&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h2>Tests<\/h2>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; ul_line_height=&#8221;1.3em&#8221; header_font=&#8221;|600|||||||&#8221; header_text_align=&#8221;center&#8221; header_font_size=&#8221;50px&#8221; header_line_height=&#8221;2em&#8221; custom_margin=&#8221;20px||||false|false&#8221; custom_margin_tablet=&#8221;20px||||false|false&#8221; custom_margin_phone=&#8221;0px||0px||true|false&#8221; custom_margin_last_edited=&#8221;on|phone&#8221; custom_css_free_form=&#8221;selector li {||  margin-bottom: 10px;||}&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<ul>\n<li><code>LibroControllerTest.java<\/code> performs integration tests for the <code>LibroController<\/code>.<\/li>\n<\/ul>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; ul_line_height=&#8221;1.3em&#8221; header_font=&#8221;|600|||||||&#8221; header_text_align=&#8221;center&#8221; header_font_size=&#8221;50px&#8221; header_line_height=&#8221;2em&#8221; custom_margin=&#8221;20px||||false|false&#8221; custom_margin_tablet=&#8221;20px||||false|false&#8221; custom_margin_phone=&#8221;0px||0px||true|false&#8221; custom_margin_last_edited=&#8221;on|phone&#8221; custom_css_free_form=&#8221;selector li {||  margin-bottom: 10px;||}&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<ul>\n<li><code>LibroControllerUnitTest.java<\/code> uses Mockito to perform unit tests for the <code>LibroController<\/code>.<\/li>\n<\/ul>\n<p>[\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;3_5&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_image src=&#8221;https:\/\/www.karvala.net\/wp-content\/uploads\/2024\/01\/tests.png&#8221; alt=&#8221;captura de pantalla de parte del c\u00f3digo&#8221; title_text=&#8221;tests&#8221; show_in_lightbox=&#8221;on&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; background_color=&#8221;RGBA(255,255,255,0)&#8221; custom_margin=&#8221;0px||0px||true|false&#8221; custom_padding=&#8221;0px||0px||true|false&#8221; border_radii=&#8221;on|25px|25px|25px|25px&#8221; global_colors_info=&#8221;{}&#8221; background__hover_enabled=&#8221;off|desktop&#8221;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;code highlights&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; custom_margin=&#8221;||0px||false|false&#8221; custom_padding=&#8221;||0px||false|false&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; header_2_font_size=&#8221;30px&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h2>Code Highlights<\/h2>\n<p>[\/et_pb_text][et_pb_text admin_label=&#8221;code highlights&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; ul_line_height=&#8221;1.3em&#8221; header_font=&#8221;|600|||||||&#8221; header_text_align=&#8221;center&#8221; header_font_size=&#8221;50px&#8221; header_line_height=&#8221;2em&#8221; header_2_text_align=&#8221;center&#8221; header_2_font_size=&#8221;30px&#8221; custom_margin=&#8221;30px||||false|false&#8221; custom_padding=&#8221;||||false|false&#8221; custom_css_free_form=&#8221;selector li {||  margin-bottom: 10px;||}&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<ul>\n<li><strong>Dependency Injection:<\/strong> Constructor injection is used in <code>LibroController<\/code> to inject the <code>LibroRepository<\/code> instance.<\/li>\n<li><strong>RESTful Endpoints:<\/strong> CRUD operations are implemented using Spring&#8217;s annotations (<code>@GetMapping<\/code>, <code>@PostMapping<\/code>, <code>@PutMapping<\/code>, <code>@DeleteMapping<\/code>).<\/li>\n<li><strong>Response Handling:<\/strong> Utilizes <code>ResponseEntity<\/code> for more control over HTTP responses.<\/li>\n<li><strong>Testing:<\/strong> Integration tests (<code>LibroControllerTest.java<\/code>) use <code>TestRestTemplate<\/code> to test the actual HTTP endpoints. Unit tests (<code>LibroControllerUnitTest.java<\/code>) use Mockito for mocking the repository and testing controller methods independently.<\/li>\n<\/ul>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;how it works&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; custom_margin=&#8221;||0px||false|false&#8221; custom_padding=&#8221;||0px||false|false&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h1>How It Works<\/h1>\n<p>[\/et_pb_text][et_pb_text admin_label=&#8221;code highlights&#8221; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; ul_line_height=&#8221;1.3em&#8221; ol_line_height=&#8221;1.3em&#8221; header_font=&#8221;|600|||||||&#8221; header_text_align=&#8221;center&#8221; header_font_size=&#8221;50px&#8221; header_line_height=&#8221;2em&#8221; header_2_text_align=&#8221;center&#8221; header_2_font_size=&#8221;30px&#8221; custom_margin=&#8221;30px||0px||false|false&#8221; custom_padding=&#8221;||0px||false|false&#8221; custom_css_free_form=&#8221;selector li {||  margin-bottom: 10px;||}&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<ol>\n<li><strong> Entity and Repository<\/strong>:\n<p><code>Libro<\/code> class represents a book, and <code>LibroRepository<\/code> is an interface for CRUD operations on books.<\/p>\n<\/li>\n<p\/>\n<li><strong>Controller (<code>LibroController.java<\/code>)<\/strong>:\n<ul>\n<li>Handles HTTP requests related to books.<\/li>\n<li>Uses <code>LibroRepository<\/code> for database operations.<\/li>\n<li>Defines endpoints for finding all books, finding a book by id, creating, updating, and deleting books.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Application (<code>BibliotecaApplication.java<\/code>)<\/strong>: Initializes the Spring Boot application.\n<ul>\n<li>Injects the <code>LibroRepository<\/code>.<\/li>\n<li>Performs sample CRUD operations on books.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Tests<\/strong>:\n<ul>\n<li><code>LibroControllerTest.java<\/code>: Integration tests using <code>TestRestTemplate<\/code>.<\/li>\n<li><code>LibroControllerUnitTest.java<\/code>: Unit tests using Mockito and MockMvc.<\/li>\n<\/ul>\n<\/ol>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; custom_margin=&#8221;0px||0px||true|false&#8221; custom_padding=&#8221;0px||0px||true|false&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_text _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; text_font_size=&#8221;20px&#8221; ul_line_height=&#8221;1.3em&#8221; header_font=&#8221;|600|||||||&#8221; header_text_align=&#8221;center&#8221; header_font_size=&#8221;50px&#8221; header_line_height=&#8221;2em&#8221; custom_margin=&#8221;20px||||false|false&#8221; custom_css_free_form=&#8221;selector li {||  margin-bottom: 10px;||}&#8221; global_colors_info=&#8221;{}&#8221;]The application follows the standard Spring Boot structure and principles, using JPA for database operations and providing RESTful endpoints for book management. The tests ensure the correctness of the controller&#8217;s behavior in different scenarios.[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section][et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.23.4&#8243; _module_preset=&#8221;default&#8221; background_color=&#8221;#D4ACA0&#8243; custom_padding=&#8221;||||false|false&#8221; global_colors_info=&#8221;{}&#8221;][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>API RESTful library Java and springBoot<\/p>\n","protected":false},"author":1,"featured_media":103,"comment_status":"open","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","iawp_total_views":0,"footnotes":""},"project_category":[],"project_tag":[],"class_list":["post-92","project","type-project","status-publish","has-post-thumbnail","hentry"],"_links":{"self":[{"href":"https:\/\/www.karvala.net\/en\/wp-json\/wp\/v2\/project\/92","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.karvala.net\/en\/wp-json\/wp\/v2\/project"}],"about":[{"href":"https:\/\/www.karvala.net\/en\/wp-json\/wp\/v2\/types\/project"}],"author":[{"embeddable":true,"href":"https:\/\/www.karvala.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.karvala.net\/en\/wp-json\/wp\/v2\/comments?post=92"}],"version-history":[{"count":16,"href":"https:\/\/www.karvala.net\/en\/wp-json\/wp\/v2\/project\/92\/revisions"}],"predecessor-version":[{"id":263,"href":"https:\/\/www.karvala.net\/en\/wp-json\/wp\/v2\/project\/92\/revisions\/263"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.karvala.net\/en\/wp-json\/wp\/v2\/media\/103"}],"wp:attachment":[{"href":"https:\/\/www.karvala.net\/en\/wp-json\/wp\/v2\/media?parent=92"}],"wp:term":[{"taxonomy":"project_category","embeddable":true,"href":"https:\/\/www.karvala.net\/en\/wp-json\/wp\/v2\/project_category?post=92"},{"taxonomy":"project_tag","embeddable":true,"href":"https:\/\/www.karvala.net\/en\/wp-json\/wp\/v2\/project_tag?post=92"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}