{"id":3401,"date":"2024-09-19T10:52:12","date_gmt":"2024-09-19T08:52:12","guid":{"rendered":"https:\/\/nguenkam.com\/blog\/?p=3401"},"modified":"2024-09-20T15:15:02","modified_gmt":"2024-09-20T13:15:02","slug":"introduction-to-java-spring-boot-part-i","status":"publish","type":"post","link":"https:\/\/nguenkam.com\/blog\/index.php\/2024\/09\/19\/introduction-to-java-spring-boot-part-i\/","title":{"rendered":"Introduction to Java Spring Boot (Part I)"},"content":{"rendered":"\n<p>Spring Boot is a framework that simplifies the development of Java applications by providing a convention-over-configuration approach and reducing boilerplate code. It is particularly useful for creating microservices and RESTful web services. In this introduction, we will cover some important annotations and concepts in Spring Boot, while also drawing comparisons to Angular.<\/p>\n\n\n\n<h4>Example Application<\/h4>\n\n\n\n<p>Here is a simple example of a Spring Boot application that implements a REST controller.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.RestController;\n\n@SpringBootApplication\npublic class DemoApplication {\n    public static void main(String&#91;] args) {\n        SpringApplication.run(DemoApplication.class, args);\n    }\n}\n\n@RestController\nclass HelloController {\n    @GetMapping(\"\/hello\")\n    public String hello() {\n        return \"Hello, World!\";\n    }\n}<\/code><\/pre>\n\n\n\n<h4>1. How Does the Spring Container Work?<\/h4>\n\n\n\n<p>The Spring Container manages the lifecycle of beans, which are created through Dependency Injection (DI). It is responsible for instantiating, configuring, and managing objects called beans. The container uses configuration metadata to determine how beans are created and wired together.<\/p>\n\n\n\n<h4>2. What is ApplicationContext in Relation to the Spring Container?<\/h4>\n\n\n\n<p>ApplicationContext is an extension of the Spring Container that provides additional features such as event propagation, message source management, and support for internationalization. It serves as the central interface for the Spring IoC Container, allowing for the management of beans and their dependencies.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.boot.CommandLineRunner;\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.context.ApplicationContext;\nimport org.springframework.stereotype.Component;\n\n@SpringBootApplication\npublic class MyApplication {\n    public static void main(String&#91;] args) {\n        SpringApplication.run(MyApplication.class, args);\n    }\n}\n\n@Component\nclass MyCommandLineRunner implements CommandLineRunner {\n\n    @Autowired\n    private ApplicationContext applicationContext;\n\n    @Override\n    public void run(String... args) throws Exception {\n        \/\/ Fetching a bean from the application context\n        MyService myService = applicationContext.getBean(MyService.class);\n        myService.performAction();\n    }\n}\n\n@Component\nclass MyService {\n    public void performAction() {\n        System.out.println(\"Service action performed!\");\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>Here\u2019s a code example demonstrating how to use the <code>ApplicationContext<\/code> in a Spring Boot application:<\/p>\n\n\n\n<h5>Example Code<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>import org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.boot.CommandLineRunner;\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.context.ApplicationContext;\nimport org.springframework.stereotype.Component;\n\n@SpringBootApplication\npublic class MyApplication {\n    public static void main(String&#91;] args) {\n        SpringApplication.run(MyApplication.class, args);\n    }\n}\n\n@Component\nclass MyCommandLineRunner implements CommandLineRunner {\n\n    @Autowired\n    private ApplicationContext applicationContext;\n\n    @Override\n    public void run(String... args) throws Exception {\n        \/\/ Fetching a bean from the application context\n        MyService myService = applicationContext.getBean(MyService.class);\n        myService.performAction();\n    }\n}\n\n@Component\nclass MyService {\n    public void performAction() {\n        System.out.println(\"Service action performed!\");\n    }\n}<\/code><\/pre>\n\n\n\n<h5>Explanation of the Code<\/h5>\n\n\n\n<ol><li><strong><code>@SpringBootApplication<\/code><\/strong>: This annotation marks the main class of the Spring Boot application, enabling auto-configuration and component scanning.<\/li><li><strong><code>MyApplication<\/code><\/strong>: This is the main class that starts the Spring Boot application using <code>SpringApplication.run()<\/code>.<\/li><li><strong><code>@Component<\/code><\/strong>: The <code>MyCommandLineRunner<\/code> class is annotated with <code>@Component<\/code>, making it a Spring-managed bean. It will be automatically detected and registered in the application context.<\/li><li><strong><code>CommandLineRunner<\/code><\/strong>: This interface allows you to run specific code after the Spring application context is loaded. The <code>run<\/code> method is overridden to define what should happen at startup.<\/li><li><strong><code>@Autowired<\/code><\/strong>: This annotation is used to inject the <code>ApplicationContext<\/code> into the <code>MyCommandLineRunner<\/code> bean. Spring will automatically provide the application context when this bean is created.<\/li><li><strong><code>ApplicationContext<\/code><\/strong>: This is the central interface to the Spring IoC (Inversion of Control) container. It holds references to all the beans in the application. In this example, it is used to retrieve a specific bean (<code>MyService<\/code>).<\/li><li><strong><code>getBean(MyService.class)<\/code><\/strong>: This method is called on the <code>ApplicationContext<\/code> to fetch an instance of <code>MyService<\/code>. The class type is provided as an argument.<\/li><li><strong><code>MyService<\/code><\/strong>: This is another Spring-managed bean that contains a method <code>performAction()<\/code>. When called, it prints a message to the console.<\/li><\/ol>\n\n\n\n<p>When we run this application, the <code>MyCommandLineRunner<\/code> will execute at startup, fetching the <code>MyService<\/code> bean from the application context and calling its <code>performAction()<\/code> method. This demonstrates how to use the <code>ApplicationContext<\/code> to manage and access beans in a Spring Boot application.<\/p>\n\n\n\n<h4>3. What is BeanPostProcessor in Spring Boot? Is There a Similar Mechanism in Angular?<\/h4>\n\n\n\n<p><code>BeanPostProcessor<\/code> is an interface that allows for custom logic to be applied before and after the initialization of a bean. In Angular, there isn&#8217;t a direct equivalent, but similar concepts can be achieved through lifecycle hooks like <code>ngOnInit<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import org.springframework.beans.BeansException;\nimport org.springframework.beans.factory.config.BeanPostProcessor;\nimport org.springframework.boot.CommandLineRunner;\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.stereotype.Component;\n\n@SpringBootApplication\npublic class MyApplication {\n    public static void main(String&#91;] args) {\n        SpringApplication.run(MyApplication.class, args);\n    }\n\n    @Bean\n    public MyService myService() {\n        return new MyService();\n    }\n\n    @Bean\n    public BeanPostProcessor myBeanPostProcessor() {\n        return new MyBeanPostProcessor();\n    }\n}\n\nclass MyService {\n    private String name;\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n}\n\n@Component\nclass MyBeanPostProcessor implements BeanPostProcessor {\n\n    @Override\n    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {\n        if (bean instanceof MyService) {\n            ((MyService) bean).setName(\"Initialized Service\");\n            System.out.println(\"Before Initialization: Setting name for MyService\");\n        }\n        return bean;\n    }\n\n    @Override\n    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {\n        if (bean instanceof MyService) {\n            System.out.println(\"After Initialization: MyService is ready to use\");\n        }\n        return bean;\n    }\n}\n\n@Component\nclass MyCommandLineRunner implements CommandLineRunner {\n\n    private final MyService myService;\n\n    public MyCommandLineRunner(MyService myService) {\n        this.myService = myService;\n    }\n\n    @Override\n    public void run(String... args) throws Exception {\n        System.out.println(\"Running MyService with name: \" + myService.getName());\n    }\n}\n<\/code><\/pre>\n\n\n\n<h5>Explanation of the Code<\/h5>\n\n\n\n<ol><li><strong><code>@SpringBootApplication<\/code><\/strong>: This annotation marks the main class of the Spring Boot application, enabling auto-configuration and component scanning.<\/li><li><strong><code>MyApplication<\/code><\/strong>: The main class that starts the Spring Boot application using <code>SpringApplication.run()<\/code>.<\/li><li><strong><code>@Bean<\/code><\/strong>: The <code>myService<\/code> method defines a bean of type <code>MyService<\/code>. This bean will be managed by the Spring container.<\/li><li><strong><code>MyService<\/code><\/strong>: A simple service class with a property <code>name<\/code> and corresponding getter and setter methods.<\/li><li><strong><code>MyBeanPostProcessor<\/code><\/strong>: This class implements the <code>BeanPostProcessor<\/code> interface, which allows you to modify beans before and after their initialization.<ul><li><strong><code>postProcessBeforeInitialization<\/code><\/strong>: This method is called before a bean&#8217;s initialization callback (like <code>@PostConstruct<\/code>). In this example, it checks if the bean is an instance of <code>MyService<\/code> and sets its name to &#8220;Initialized Service&#8221;. It also prints a message indicating that the name is being set.<\/li><li><strong><code>postProcessAfterInitialization<\/code><\/strong>: This method is called after the bean&#8217;s initialization. It checks if the bean is an instance of <code>MyService<\/code> and prints a message indicating that the service is ready to use.<\/li><\/ul><\/li><li><strong><code>MyCommandLineRunner<\/code><\/strong>: This component implements <code>CommandLineRunner<\/code>, allowing it to run specific code after the Spring application context is loaded.<ul><li>It receives the&nbsp;<code>MyService<\/code>&nbsp;bean through constructor injection and prints its name when the application starts.<\/li><\/ul><\/li><\/ol>\n\n\n\n<p>When you run this application, the <code>MyBeanPostProcessor<\/code> will modify the <code>MyService<\/code> bean during its lifecycle. The output will show the messages from both the <code>postProcessBeforeInitialization<\/code> and <code>postProcessAfterInitialization<\/code> methods, confirming that the name was set before initialization and that the service is ready to use afterward. This demonstrates how <code>BeanPostProcessor<\/code> can be used to customize bean initialization in a Spring Boot application.<\/p>\n\n\n\n<h4>4. Field Injection<\/h4>\n\n\n\n<p>Field Injection is a method of Dependency Injection where dependencies are directly injected into the fields of a class, typically using the <code>@Autowired<\/code> annotation.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@Component\npublic class MyService {\n    @Autowired\n    private MyRepository myRepository;\n}\n<\/code><\/pre>\n\n\n\n<h4>5. Scope (singleton, prototype, session, request)<\/h4>\n\n\n\n<ul><li><strong>Singleton<\/strong>: A single instance per Spring Container (default).<\/li><li><strong>Prototype<\/strong>: A new instance for each request.<\/li><li><strong>Session<\/strong>: An instance per HTTP session.<\/li><li><strong>Request<\/strong>: An instance per HTTP request.<\/li><\/ul>\n\n\n\n<h4>6. CommandLineRunner<\/h4>\n\n\n\n<p><code>CommandLineRunner<\/code> is an interface that provides a method to be executed on application startup.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import org.springframework.boot.CommandLineRunner;\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.stereotype.Component;\n\n@SpringBootApplication\npublic class MyApplication {\n    public static void main(String&#91;] args) {\n        SpringApplication.run(MyApplication.class, args);\n    }\n}\n\n@Component\nclass MyCommandLineRunner implements CommandLineRunner {\n\n    @Override\n    public void run(String... args) throws Exception {\n        System.out.println(\"CommandLineRunner is executed on application startup\");\n        \/\/ Hier k\u00f6nnen Sie Initialisierungslogik hinzuf\u00fcgen\n    }\n}\n<\/code><\/pre>\n\n\n\n<h5>Explanation of the CommandLineRunner Code<\/h5>\n\n\n\n<ul><li><strong><code>CommandLineRunner<\/code><\/strong>: This interface provides a single method, <code>run<\/code>, which is called after the application context is loaded and right before the application starts. You can use this method to execute logic that needs to run at startup, such as initializing data or performing setup tasks.<\/li><li><strong><code>@SpringBootApplication<\/code><\/strong>: This annotation marks the main class of a Spring Boot application. It combines several annotations, including <code>@Configuration<\/code>, <code>@EnableAutoConfiguration<\/code>, and <code>@ComponentScan<\/code>, which collectively set up the Spring application context.<\/li><li><strong><code>@Component<\/code><\/strong>: This annotation indicates that the <code>MyCommandLineRunner<\/code> class is a Spring-managed bean. By marking it as a component, Spring will automatically detect and register it during the component scanning process.<\/li><li><strong><code>run(String... args)<\/code><\/strong>: This method takes a variable number of string arguments (typically command-line arguments) and contains the logic that will be executed when the application starts. In this example, it simply prints a message to the console.<\/li><\/ul>\n\n\n\n<p>When you run the application, the <code>run<\/code> method of <code>MyCommandLineRunner<\/code> is invoked, and you&#8217;ll see the message &#8220;CommandLineRunner is executed on application startup&#8221; printed in the console. This allows you to perform any necessary initialization or setup tasks right when your application starts.<\/p>\n\n\n\n<h4>7. HTTP Session in Java<\/h4>\n\n\n\n<p>An HTTP session stores data across multiple HTTP requests for a specific user. In Java, this is commonly handled using <code>HttpSessio<\/code>n<\/p>\n\n\n\n<h4>8. @ComponentScan<\/h4>\n\n\n\n<p><code>@ComponentScan<\/code> instructs the Spring Container to look for beans in specified packages. It is often included in <code>@SpringBootApplication<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import org.springframework.context.annotation.ComponentScan;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\n@ComponentScan(basePackages = \"com.example.package\")\npublic class AppConfig {\n}\n<\/code><\/pre>\n\n\n\n<h4>9. @SpringBootApplication<\/h4>\n\n\n\n<p>This annotation combines several others, including <code>@Configuration<\/code>, <code>@EnableAutoConfiguration<\/code>, and <code>@ComponentScan<\/code>. It serves as the entry point for a Spring Boot application.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\n\n@SpringBootApplication\npublic class MyApplication {\n    public static void main(String&#91;] args) {\n        SpringApplication.run(MyApplication.class, args);\n    }\n}\n<\/code><\/pre>\n\n\n\n<h4>10. @PostConstruct<\/h4>\n\n\n\n<p>The <code>@PostConstruct<\/code> annotation is used to mark a method that should be called after the bean&#8217;s construction. This is similar to <code>ngOnInit<\/code> in Angular, where initializations are performed after the component is created.<\/p>\n\n\n\n<h5>Example:<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>import javax.annotation.PostConstruct;\nimport org.springframework.stereotype.Component;\n\n@Component\npublic class MyBean {\n    \n    @PostConstruct\n    public void init() {\n        System.out.println(\"Bean is initialized\");\n    }\n}\n<\/code><\/pre>\n\n\n\n<h4>11. @Qualifier<\/h4>\n\n\n\n<p>The <code>@Qualifier<\/code> annotation is used to specify which bean to inject when multiple beans of the same type exist. This is useful for avoiding conflicts.<\/p>\n\n\n\n<h5>Example:<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>import org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.beans.factory.annotation.Qualifier;\nimport org.springframework.stereotype.Component;\n\n@Component\npublic class MyService {\n    \n    @Autowired\n    @Qualifier(\"myRepository\")\n    private MyRepository myRepository;\n}\n<\/code><\/pre>\n\n\n\n<h4>12. @Configuration<\/h4>\n\n\n\n<p>The <code>@Configuration<\/code> annotation marks a class that contains bean definitions. These classes are processed by Spring when the application starts.<\/p>\n\n\n\n<h5>Example:<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>@Configuration\npublic class AppConfig {\n    @Bean\n    public MyService myService() {\n        return new MyService();\n    }\n}<\/code><\/pre>\n\n\n\n<p>The <code>@Configuration<\/code> annotation is commonly used to indicate that a class declares one or more <code>@Bean<\/code> methods. However, there are other annotations that can also be used for similar purposes:<\/p>\n\n\n\n<ul><li>You can use&nbsp;<code>@Component<\/code>&nbsp;to mark a class as a Spring-managed bean. While it doesn&#8217;t explicitly declare beans like&nbsp;<code>@Configuration<\/code>, if the class contains&nbsp;<code>@Bean<\/code>&nbsp;methods, Spring will treat it as a configuration class.<\/li><li><strong><code>@ComponentScan<\/code><\/strong>: This annotation is used in conjunction with&nbsp;<code>@Configuration<\/code>&nbsp;or&nbsp;<code>@SpringBootApplication<\/code>&nbsp;to specify the packages to scan for Spring components, including configuration classes.<\/li><li><strong><code>@EnableAutoConfiguration<\/code><\/strong> : Used in Spring Boot applications, this annotation automatically configures your application based on the dependencies present on the classpath. It can eliminate the need for many explicit&nbsp;<code>@Configuration<\/code>&nbsp;classes.<\/li><li><strong><code>@Import<\/code><\/strong>:You can use this annotation to import other configuration classes into a configuration class. This allows you to modularize your configuration.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>@Configuration\n@Import(OtherConfig.class)\npublic class MyConfig {\n    \/\/ Bean definitions\n}\n<\/code><\/pre>\n\n\n\n<h4>13. @TestConfiguration<\/h4>\n\n\n\n<p>The <code>@TestConfiguration<\/code> annotation is used to define test-specific beans. These beans are only available in the test context.<\/p>\n\n\n\n<h5>Example:<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>@TestConfiguration\npublic class TestConfig {\n    @Bean\n    public MyService myService() {\n        return Mockito.mock(MyService.class);\n    }\n}<\/code><\/pre>\n\n\n\n<h4>14. @Bean<\/h4>\n\n\n\n<p>The <code>@Bean<\/code> annotation is used to mark a method as a bean that should be managed by Spring.<\/p>\n\n\n\n<h5>Example:<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>@Bean\npublic MyRepository myRepository() {\n    return new MyRepository();\n}<\/code><\/pre>\n\n\n\n<h4>15. @Profile<\/h4>\n\n\n\n<p>The <code>@Profile<\/code> annotation is used to activate beans only in specific profiles. This is useful for defining different configurations for development, testing, and production environments.<\/p>\n\n\n\n<h5>Example:<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>@Profile(\"dev\")\n@Bean\npublic MyService devService() {\n    return new DevService();\n}\n\n@Profile(\"production\")\n@Bean\npublic MyService prodService() {\n    return new ProdService();\n}<\/code><\/pre>\n\n\n\n<h4>16. @ActiveProfiles<\/h4>\n\n\n\n<p>The <code>@ActiveProfiles<\/code> annotation is used to specify active profiles for tests. This helps control the configuration during testing.<\/p>\n\n\n\n<h5>Example:<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>@ActiveProfiles(\"test\")\n@SpringBootTest\npublic class MyServiceTest {\n    \/\/ Test methods\n}<\/code><\/pre>\n\n\n\n<h4>17. @Primary<\/h4>\n\n\n\n<p>The <code>@Primary<\/code> annotation is used to designate a bean as the primary bean when multiple beans of the same type exist. This indicates which bean should be used by default.<\/p>\n\n\n\n<h5>Example:<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>@Bean\n@Primary\npublic MyService primaryService() {\n    return new PrimaryService();\n}<\/code><\/pre>\n\n\n\n<h4>18. @SpringBootTest<\/h4>\n\n\n\n<p>The <code>@SpringBootTest<\/code> annotation is used for integration testing in a Spring Boot application. It loads the entire application context.<\/p>\n\n\n\n<h5>Example:<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>@SpringBootTest\npublic class ApplicationTests {\n    @Test\n    public void contextLoads() {\n    }\n}<\/code><\/pre>\n\n\n\n<h4>19. Mockito<\/h4>\n\n\n\n<p>Mockito is a popular framework for creating mock objects in tests. It allows you to test components in isolation.<\/p>\n\n\n\n<h5>Example:<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>import static org.mockito.Mockito.*;\n\npublic class MyServiceTest {\n    @Test\n    public void testMyService() {\n        LogService mockLogService = Mockito.mock(LogService.class);\n        MyService myService = new MyService(mockLogService);\n\n        \/\/ Test logic\n    }\n}<\/code><\/pre>\n\n\n\n<h4>20. @ExtendWith<\/h4>\n\n\n\n<p><code>@ExtendWith<\/code> is used in tests to register extensions that provide additional functionalities, such as Mockito or JUnit5-specific extensions.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\nimport org.mockito.junit.jupiter.MockitoExtension;\n\n@ExtendWith(MockitoExtension.class)\npublic class MyServiceTest {\n    \n    @Test\n    public void testWithMockito() {\n        \/\/ Test code using Mockito\n    }\n}\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h5>Conclusion<\/h5>\n\n\n\n<p>In this introduction, we covered the basics of Java Spring Boot and explained some important annotations and concepts. These concepts are essential for developing robust and maintainable applications in Spring Boot and offer many advantages that make development more efficient.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spring Boot is a framework that simplifies the development of Java applications by providing a convention-over-configuration approach and reducing boilerplate code. It is particularly useful for creating microservices and RESTful web services. In this introduction, we will cover some important annotations and concepts in Spring Boot, while also drawing comparisons to Angular. Example Application Here [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3403,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[554,868],"tags":[876,872,874,879,878,870,881,883],"_links":{"self":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/3401"}],"collection":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=3401"}],"version-history":[{"count":5,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/3401\/revisions"}],"predecessor-version":[{"id":3428,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/3401\/revisions\/3428"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/media\/3403"}],"wp:attachment":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=3401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=3401"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=3401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}