{"id":33139,"date":"2024-11-01T09:14:02","date_gmt":"2024-11-01T09:14:02","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=33139"},"modified":"2024-11-01T11:28:47","modified_gmt":"2024-11-01T11:28:47","slug":"spring-boot-backend-development-course-blog-screen-layout-example-running-test","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/33139\/","title":{"rendered":"Spring Boot Backend Development Course, Blog Screen Layout Example, Running Test"},"content":{"rendered":"<article>\n<header>\n<h2>Blog Screen Composition Example and Running Test<\/h2>\n<\/header>\n<section>\n<h2>1. What is Spring Boot?<\/h2>\n<p>\n            Spring Boot is a framework for developing Java-based web applications built on the Spring Framework.<br \/>\n            Many developers struggle with the complexity of the Spring Framework, and Spring Boot is designed to alleviate this.<br \/>\n            Spring Boot minimizes configuration and helps users easily add the desired features.<br \/>\n            The main purpose of Spring Boot is to enable a fast development and deployment process and provide a consistent experience across various projects.\n        <\/p>\n<\/section>\n<section>\n<h2>2. Main Features of Spring Boot<\/h2>\n<ul>\n<li><strong>Auto-configuration<\/strong>: Automatically handles many configurations, allowing developers to focus only on what is necessary.<\/li>\n<li><strong>Standalone<\/strong>: Runs with an embedded server (e.g., Tomcat, Jetty) without the need to deploy on an external web server.<\/li>\n<li><strong>Dependency Management<\/strong>: Easily manage required libraries through Maven or Gradle.<\/li>\n<li><strong>Integration with the Spring Ecosystem<\/strong>: Easy integration with various modules such as Spring Data, Spring Security, etc.<\/li>\n<\/ul>\n<\/section>\n<section>\n<h2>3. Setting Up the Spring Boot Development Environment<\/h2>\n<p>To develop with Spring Boot, you need to set up the following environment:<\/p>\n<ol>\n<li><strong>Java Development Kit (JDK)<\/strong> installation: Install JDK version 1.8 or higher.<\/li>\n<li><strong>Choose an IDE<\/strong>: Select an IDE such as IntelliJ IDEA, Eclipse, or VSCode.<\/li>\n<li><strong>Choose a Build Tool<\/strong>: Select either Maven or Gradle to manage the project.<\/li>\n<\/ol>\n<p>Here\u2019s how to create a Spring Boot project in IntelliJ:<\/p>\n<ol>\n<li>Run IntelliJ IDEA and select &#8220;New Project&#8221;.<\/li>\n<li>Select Spring Initializr and enter the required settings (project metadata, etc.).<\/li>\n<li>Add necessary dependencies (e.g., Spring Web, Spring Data JPA, etc.).<\/li>\n<li>Once the project is created, it will open in the IDE.<\/li>\n<\/ol>\n<\/section>\n<section>\n<h2>4. Blog Screen Composition Example<\/h2>\n<p>In this tutorial, we will aim to build a basic blog application.<br \/>\n        We will implement features to create and view posts.<\/p>\n<h3>4.1 Database Design<\/h3>\n<p>The blog application requires a database table to store posts.<br \/>\n        Let&#8217;s design it with a simple structure as follows.<\/p>\n<pre><code>\n        CREATE TABLE posts (\n            id BIGINT AUTO_INCREMENT PRIMARY KEY,\n            title VARCHAR(255) NOT NULL,\n            content TEXT NOT NULL,\n            created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n        );\n        <\/code><\/pre>\n<h3>4.2 Creating an Entity Class<\/h3>\n<p>We will create an entity class corresponding to the posts using JPA.<\/p>\n<pre><code>\n        import javax.persistence.*;\n        import java.time.LocalDateTime;\n\n        @Entity\n        @Table(name = \"posts\")\n        public class Post {\n            @Id\n            @GeneratedValue(strategy = GenerationType.IDENTITY)\n            private Long id;\n            private String title;\n            @Column(columnDefinition = \"TEXT\")\n            private String content;\n            private LocalDateTime createdAt = LocalDateTime.now();\n\n            \/\/ Getters and Setters\n        }\n        <\/code><\/pre>\n<h3>4.3 Creating a Repository Interface<\/h3>\n<p>We will manipulate the database using the JPA repository.<\/p>\n<pre><code>\n        import org.springframework.data.jpa.repository.JpaRepository;\n\n        public interface PostRepository extends JpaRepository<Post, Long> {\n        }\n        <\/code><\/pre>\n<h3>4.4 Creating a Service Class<\/h3>\n<p>We will create a service class to handle business logic.<\/p>\n<pre><code>\n        import org.springframework.beans.factory.annotation.Autowired;\n        import org.springframework.stereotype.Service;\n        import java.util.List;\n\n        @Service\n        public class PostService {\n            @Autowired\n            private PostRepository postRepository;\n\n            public List<Post> getAllPosts() {\n                return postRepository.findAll();\n            }\n\n            public Post createPost(Post post) {\n                return postRepository.save(post);\n            }\n        }\n        <\/code><\/pre>\n<h3>4.5 Creating a REST Controller<\/h3>\n<p>We will write a RESTful controller to handle HTTP requests.<\/p>\n<pre><code>\n        import org.springframework.beans.factory.annotation.Autowired;\n        import org.springframework.web.bind.annotation.*;\n\n        import java.util.List;\n\n        @RestController\n        @RequestMapping(\"\/api\/posts\")\n        public class PostController {\n            @Autowired\n            private PostService postService;\n\n            @GetMapping\n            public List<Post> getAllPosts() {\n                return postService.getAllPosts();\n            }\n\n            @PostMapping\n            public Post createPost(@RequestBody Post post) {\n                return postService.createPost(post);\n            }\n        }\n        <\/code><\/pre>\n<h3>4.6 Setting Application Properties<\/h3>\n<p>Modify the <code>application.properties<\/code> file to set up database connection information.<\/p>\n<pre><code>\n        spring.datasource.url=jdbc:mysql:\/\/localhost:3306\/your_db_name\n        spring.datasource.username=your_username\n        spring.datasource.password=your_password\n        spring.jpa.hibernate.ddl-auto=update\n        <\/code><\/pre>\n<\/section>\n<section>\n<h2>5. Running Tests<\/h2>\n<p>Run the application to test the API.<br \/>\n        You can use tools like Postman to call the REST API.<\/p>\n<h3>5.1 Testing GET Request<\/h3>\n<p>Send a GET request to retrieve all posts,<br \/>\n        and if a JSON-formatted response is returned, it is successful.<\/p>\n<h3>5.2 Testing POST Request<\/h3>\n<p>Try saving data to the database through a POST request to create a new post.<br \/>\n        The request body must include the title and content.<\/p>\n<h3>5.3 Exception Handling and Response Format<\/h3>\n<p>Furthermore, you can improve the code to implement appropriate error handling and<br \/>\n        return appropriate HTTP response status codes.<\/p>\n<\/section>\n<footer>\n<p>In this tutorial, we looked at how to build a simple blog application using Spring Boot.<br \/>\n        Based on this basic example, I hope you can add and expand your own blog features.<\/p>\n<\/footer>\n<\/article>\n","protected":false},"excerpt":{"rendered":"<p>Blog Screen Composition Example and Running Test 1. What is Spring Boot? Spring Boot is a framework for developing Java-based web applications built on the Spring Framework. Many developers struggle with the complexity of the Spring Framework, and Spring Boot is designed to alleviate this. Spring Boot minimizes configuration and helps users easily add the &hellip; <a href=\"https:\/\/atmokpo.com\/w\/33139\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Spring Boot Backend Development Course, Blog Screen Layout Example, Running Test&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[131],"tags":[],"class_list":["post-33139","post","type-post","status-publish","format-standard","hentry","category-spring-boot-backend-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Spring Boot Backend Development Course, Blog Screen Layout Example, Running Test - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/33139\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Boot Backend Development Course, Blog Screen Layout Example, Running Test - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"Blog Screen Composition Example and Running Test 1. What is Spring Boot? Spring Boot is a framework for developing Java-based web applications built on the Spring Framework. Many developers struggle with the complexity of the Spring Framework, and Spring Boot is designed to alleviate this. Spring Boot minimizes configuration and helps users easily add the &hellip; \ub354 \ubcf4\uae30 &quot;Spring Boot Backend Development Course, Blog Screen Layout Example, Running Test&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/33139\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:14:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:28:47+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"3\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/33139\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/33139\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Spring Boot Backend Development Course, Blog Screen Layout Example, Running Test\",\"datePublished\":\"2024-11-01T09:14:02+00:00\",\"dateModified\":\"2024-11-01T11:28:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/33139\/\"},\"wordCount\":502,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Spring Boot backend development\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/33139\/\",\"url\":\"https:\/\/atmokpo.com\/w\/33139\/\",\"name\":\"Spring Boot Backend Development Course, Blog Screen Layout Example, Running Test - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:14:02+00:00\",\"dateModified\":\"2024-11-01T11:28:47+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/33139\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/33139\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/33139\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Spring Boot Backend Development Course, Blog Screen Layout Example, Running Test\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring Boot Backend Development Course, Blog Screen Layout Example, Running Test - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","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:\/\/atmokpo.com\/w\/33139\/","og_locale":"ko_KR","og_type":"article","og_title":"Spring Boot Backend Development Course, Blog Screen Layout Example, Running Test - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"Blog Screen Composition Example and Running Test 1. What is Spring Boot? Spring Boot is a framework for developing Java-based web applications built on the Spring Framework. Many developers struggle with the complexity of the Spring Framework, and Spring Boot is designed to alleviate this. Spring Boot minimizes configuration and helps users easily add the &hellip; \ub354 \ubcf4\uae30 \"Spring Boot Backend Development Course, Blog Screen Layout Example, Running Test\"","og_url":"https:\/\/atmokpo.com\/w\/33139\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:14:02+00:00","article_modified_time":"2024-11-01T11:28:47+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"3\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/33139\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/33139\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Spring Boot Backend Development Course, Blog Screen Layout Example, Running Test","datePublished":"2024-11-01T09:14:02+00:00","dateModified":"2024-11-01T11:28:47+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/33139\/"},"wordCount":502,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Spring Boot backend development"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/33139\/","url":"https:\/\/atmokpo.com\/w\/33139\/","name":"Spring Boot Backend Development Course, Blog Screen Layout Example, Running Test - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:14:02+00:00","dateModified":"2024-11-01T11:28:47+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/33139\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/33139\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/33139\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Spring Boot Backend Development Course, Blog Screen Layout Example, Running Test"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/33139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=33139"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/33139\/revisions"}],"predecessor-version":[{"id":33140,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/33139\/revisions\/33140"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=33139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=33139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=33139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}