{"id":100488,"date":"2021-03-11T11:00:00","date_gmt":"2021-03-11T09:00:00","guid":{"rendered":"https:\/\/examples.javacodegeeks.com\/?p=100488"},"modified":"2021-03-02T15:15:14","modified_gmt":"2021-03-02T13:15:14","slug":"spring-framework-components-tutorial","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/","title":{"rendered":"Spring Framework Components Tutorial"},"content":{"rendered":"<p>This is an in-depth article related to the Spring framework components.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-1-introduction\">1. Introduction<\/h2>\n<p>Spring Framework helps in creating stand-alone and production-ready applications. Spring Framework features are Spring MVC, JPA, Spring Boot, Micro Containers, and Messaging.  It is an open-source software framework used by developers for creating web applications and services. Developers use Java technology stack for creating web apps. <\/p>\n<div class=\"wp-block-image is-style-default\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/spring_framework.jpg\"><img decoding=\"async\" width=\"820\" height=\"551\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/spring_framework.jpg\" alt=\"spring framework components\" class=\"wp-image-100551\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/spring_framework.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/spring_framework-300x202.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/spring_framework-768x516.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption>Spring Framework<\/figcaption><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-2-spring-framework-components\">2. Spring Framework Components<\/h2>\n<h3 class=\"wp-block-heading\" id=\"h-2-1-prerequisites\">2.1 Prerequisites<\/h3>\n<p>Java 7 or 8 is required on the linux, windows or mac operating system. Maven 3.6.1 is required for building the spring and hibernate application.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-2-2-download\">2.2 Download<\/h3>\n<p>You can download Java 8 can be downloaded from the Oracle web&nbsp;<a href=\"https:\/\/www.oracle.com\/technetwork\/java\/javase\/downloads\/jdk8-downloads-2133151.html\">site<\/a>&nbsp;.&nbsp;Apache Maven 3.6.1 can be downloaded from<a href=\"https:\/\/maven.apache.org\/download.cgi\">&nbsp;Apache site<\/a>. Spring framework latest releases are available from the spring&nbsp;<a href=\"https:\/\/repo.spring.io\/release\/org\/springframework\/spring\/\">website<\/a>.  <\/p>\n<h3 class=\"wp-block-heading\" id=\"h-2-3-setup\">2.3 Setup<\/h3>\n<p>You can set the environment variables for JAVA_HOME and PATH. They can be set as shown below:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Setup<\/em><\/span><\/p>\n<pre class=\"brush:plain\">JAVA_HOME=\"\/desktop\/jdk1.8.0_73\"\nexport JAVA_HOME\nPATH=$JAVA_HOME\/bin:$PATH\nexport PATH\n<\/pre>\n<p>The environment variables for maven are set as below:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Maven Environment<\/em><\/span><\/p>\n<pre class=\"brush:plain\">JAVA_HOME=\u201d\/jboss\/jdk1.8.0_73\u2033\nexport M2_HOME=\/users\/bhagvan.kommadi\/Desktop\/apache-maven-3.6.1\nexport M2=$M2_HOME\/bin\nexport PATH=$M2:$PATH\n<\/pre>\n<h3 class=\"wp-block-heading\" id=\"h-2-4-features-of-the-spring-framework\">2.4 Features of the Spring Framework&nbsp;<\/h3>\n<p>Spring framework has features related to predefined templates, unit testing, abstraction, declarative support, modularization, exception handling, and transaction management. Programmers can use Plain Java Objects for developing web and enterprise applications. Spring applications are based on a modular architecture.  Spring applications can integrate with different logging, Object, relationship mapping frameworks, scheduling frameworks, and view frameworks. It is a lightweight framework as it uses Plain Java Objects. Spring framework is referred to as framework of frameworks. It has declarative support and support for functional programming.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-2-5-evolution-of-spring-framework\">2.5 Evolution of Spring Framework<\/h3>\n<p>Spring framework was created by Rod Johnson in June 2002. The first release was done in March 2004. Spring 2.0 came out in October 2006. Spring 3.0 was released in December 2009. 4.0 version had Java 8 support and was released in December 2013. In June 2017, Spring 5.0 version was released. The current version is 5.3.<\/p>\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/evolution_spring-1.jpg\"><img decoding=\"async\" width=\"820\" height=\"417\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/evolution_spring-1.jpg\" alt=\"spring framework components evolution\" class=\"wp-image-100556\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/evolution_spring-1.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/evolution_spring-1-300x153.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/evolution_spring-1-768x391.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption>Spring Evolution<\/figcaption><\/figure>\n<h3 class=\"wp-block-heading\" id=\"h-2-6-spring-framework-modules\">2.6  Spring Framework Modules<\/h3>\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/spring_modules.jpg\"><img decoding=\"async\" width=\"820\" height=\"467\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/spring_modules.jpg\" alt=\"spring framework components modules\" class=\"wp-image-100558\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/spring_modules.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/spring_modules-300x171.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/spring_modules-768x437.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption>Spring Framework Modules<\/figcaption><\/figure>\n<p>Spring Framework has Core, Bean, Inversion of Control (IOC), and Dependency Injection Modules. Core Module has the following components:<\/p>\n<ul class=\"wp-block-list\">\n<li>Beans (Bean Factory)<\/li>\n<li>Context<\/li>\n<li>Expression Language (SpEL)<\/li>\n<li>IOC and DI<\/li>\n<\/ul>\n<p>Spring has modules for data access and integration features. They are :<\/p>\n<ul class=\"wp-block-list\">\n<li>Java Database Connectivity (JDBC)<\/li>\n<li>Object Relationship Mapping (ORM)<\/li>\n<li>Object XML Mappers (OXM)<\/li>\n<li>Java Messaging Service (JMS)<\/li>\n<li>Transaction (JTA)<\/li>\n<\/ul>\n<p>Spring has Web modules which are :<\/p>\n<ul class=\"wp-block-list\">\n<li>Web<\/li>\n<li>Web-Servlet<\/li>\n<li>Web-Socket<\/li>\n<li>Web-Portlet<\/li>\n<\/ul>\n<p>The other modules of Spring Framework are :<\/p>\n<ul class=\"wp-block-list\">\n<li>Aspect-Oriented Programming (AOP)<\/li>\n<li>Instrumentation<\/li>\n<li>Testing (TestNG\/JUnit)<\/li>\n<li>Spring MVC  (Model-View-Controller)<\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\" id=\"h-2-7-how-to-download-and-install-spring-framework\">2.7 How to download and install Spring framework<\/h3>\n<p>Spring framework&#8217;s latest releases are available from the spring&nbsp;<a href=\"https:\/\/repo.spring.io\/release\/org\/springframework\/spring\/\">website<\/a>. You can select the framework based on your operating system.  After downloading the zip file can be extracted to a folder.  The libraries in the libs folder are set in the CLASSPATH variable.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h3 class=\"wp-block-heading\" id=\"h-2-8-building-the-application\">2.8 Building the Application<\/h3>\n<h4 class=\"wp-block-heading\" id=\"h-2-8-1-spring\">2.8.1 Spring<\/h4>\n<p>You can start building Spring applications using Spring Boot. Spring Boot has minimal configuration of Spring. Spring Boot has simplified security, tracing, application health management and runtime support for webservers. Spring configuration is done through maven pom.xml. The xml configuration is shown as below:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Spring Configuration<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n    xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 https:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\n    &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\n \n    &lt;groupId&gt;org.springframework&lt;\/groupId&gt;\n    &lt;artifactId&gt;spring-helloworld&lt;\/artifactId&gt;\n    &lt;version&gt;0.1.0&lt;\/version&gt;\n \n    &lt;parent&gt;\n        &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-boot-starter-parent&lt;\/artifactId&gt;\n        &lt;version&gt;2.1.4.RELEASE&lt;\/version&gt;\n    &lt;\/parent&gt;\n \n    &lt;dependencies&gt;\n        &lt;dependency&gt;\n            &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n            &lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;\n        &lt;\/dependency&gt;\n        &lt;dependency&gt;\n            &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n            &lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;\n            &lt;scope&gt;test&lt;\/scope&gt;\n        &lt;\/dependency&gt;\n    &lt;\/dependencies&gt;\n \n    &lt;properties&gt;\n        &lt;java.version&gt;1.8&lt;\/java.version&gt;\n    &lt;\/properties&gt;\n \n \n    &lt;build&gt;\n        &lt;plugins&gt;\n            &lt;plugin&gt;\n                &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n                &lt;artifactId&gt;spring-boot-maven-plugin&lt;\/artifactId&gt;\n            &lt;\/plugin&gt;\n        &lt;\/plugins&gt;\n    &lt;\/build&gt;\n \n&lt;\/project&gt;\n<\/pre>\n<p>You can create a&nbsp;<code>HelloWorldController<\/code>&nbsp;class as the web controller. The class is annotated using&nbsp;<code>@RestController<\/code>. Rest Controller is used to handle requests in Spring Model View Controller framework. Annotation&nbsp;<code>@RequestMapping<\/code>&nbsp;is used to annotate the&nbsp;<code>index()<\/code>&nbsp;method. The code for the&nbsp;<code>HelloWorldController<\/code>&nbsp;class is shown below:<\/p>\n<p><span style=\"text-decoration: underline\"><em>HelloWorldController<\/em><\/span><\/p>\n<pre class=\"brush:java\">package helloworld;\nimport org.springframework.web.bind.annotation.RestController;\nimport org.springframework.web.bind.annotation.RequestMapping;\n \n@RestController\npublic class HelloWorldController {\n     \n    @RequestMapping(\"\/\")\n    public String index() {\n        return \"Hello World\\n\";\n    }\n     \n}\n<\/pre>\n<p><code>HelloWorldApp<\/code>&nbsp;is created as the Spring Boot web application. When the application starts, beans, \u200band settings are wired up dynamically. They are applied to the application context. The code for&nbsp;<code>HelloWorldApp<\/code>&nbsp;class is shown below:<em>HelloWorldApp<\/em><\/p>\n<p><span style=\"text-decoration: underline\"><em>Run Command<\/em><\/span><\/p>\n<pre class=\"brush:java\">package helloworld;\nimport java.util.Arrays;\n \nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.context.ApplicationContext;\n \n@SpringBootApplication\npublic class HelloWorldApp {\n     \n    public static void main(String[] args) {\n        ApplicationContext ctx = SpringApplication.run(HelloWorldApp.class, args);\n         \n        System.out.println(\"Inspecting the beans\");\n         \n        String[] beans = ctx.getBeanDefinitionNames();\n        Arrays.sort(beans);\n        for (String name : beans) {\n            System.out.println(\"Bean Name\" +name);\n        }\n    }\n \n}\n<\/pre>\n<p>Maven is used for building the application. The command below builds the application.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Maven Build Command<\/em><\/span><\/p>\n<pre class=\"brush:plain\">mvn package\n<\/pre>\n<p>The output of the executed command is shown below.<\/p>\n<div class=\"wp-block-image is-style-default\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"820\" height=\"800\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/mvn_spring.jpg\" alt=\"spring framework components - Maven Command\" class=\"wp-image-71037\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/mvn_spring.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/mvn_spring-300x293.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/mvn_spring-768x749.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Maven Command \u2013 Spring<\/figcaption><\/figure>\n<\/div>\n<p>The jar file spring-helloworld-0.1.0.jar is created. The following command is used for executing the jar file.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Java Command<\/em><\/span>[ulp id=&#8217;7POIYxRf1FUtPpmL&#8217; name=&#8217;Spring Framework Cookbook Inline&#8217;]<\/p>\n<pre class=\"brush:plain\">java -jar target\/spring-helloworld-0.1.0.jar\n<\/pre>\n<p>The output of the Java command is shown as below:<\/p>\n<div class=\"wp-block-image is-style-default\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"820\" height=\"800\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring_helloworld_beans.jpg\" alt=\"spring framework components - Hello World Beans\" class=\"wp-image-71038\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring_helloworld_beans.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring_helloworld_beans-300x293.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring_helloworld_beans-768x749.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Spring Hello World Beans<\/figcaption><\/figure>\n<\/div>\n<p>Curl command is invoked on the command line for the execution of&nbsp;<code>index<\/code>&nbsp;method. The method returns a String \u201cHello World\u201d text.&nbsp;<code>@RestController<\/code>&nbsp;aggregates the two annotations&nbsp;<code>@Controller<\/code>&nbsp;and&nbsp;<code>@ResponseBody<\/code>. This results in returning data. The ouput is shown as below.<\/p>\n<div class=\"wp-block-image is-style-default\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"820\" height=\"717\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/curl_spring.jpg\" alt=\"spring framework components - Curl Command\" class=\"wp-image-71039\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/curl_spring.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/curl_spring-300x262.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/curl_spring-768x672.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Curl Command \u2013 Spring<\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading\" id=\"h-2-9-unit-tests\">2.9 Unit Tests<\/h3>\n<h4 class=\"wp-block-heading\" id=\"h-2-9-1-spring\">2.9.1 Spring<\/h4>\n<p>In Spring,&nbsp;<code>MockMvc<\/code>&nbsp;is used to send HTTP requests to the&nbsp;<code>DispatcherServlet<\/code>. The assertions are made based on the result obtained from the servlet.&nbsp;<code>@AutoConfigureMockMvc<\/code>&nbsp;annotation is used with&nbsp;<code>@SpringBootTest<\/code>&nbsp;to inject a&nbsp;<code>MockMvc<\/code>&nbsp;instance. The implementation of the Spring Unit Test is shown as below:<\/p>\n<p><span style=\"text-decoration: underline\"><em>HelloWorldControllerTest<\/em><\/span><\/p>\n<pre class=\"brush:java\">package helloworld;\n \nimport static org.hamcrest.Matchers.equalTo;\nimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;\nimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;\n \nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;\nimport org.springframework.boot.test.context.SpringBootTest;\nimport org.springframework.http.MediaType;\nimport org.springframework.test.context.junit4.SpringRunner;\nimport org.springframework.test.web.servlet.MockMvc;\nimport org.springframework.test.web.servlet.request.MockMvcRequestBuilders;\n \n@RunWith(SpringRunner.class)\n@SpringBootTest\n@AutoConfigureMockMvc\npublic class HelloWorldControllerTest {\n \n    @Autowired\n    private MockMvc mvc;\n \n    @Test\n    public void getMessage() throws Exception {\n        mvc.perform(MockMvcRequestBuilders.get(\"\/\").accept(MediaType.APPLICATION_JSON))\n                .andExpect(status().isOk())\n                .andExpect(content().string(equalTo(\"Hello World\\n\")));\n    }\n}\n<\/pre>\n<p>Maven command is used to run the unit test. The command is as below :<em>Maven Build Command<\/em><\/p>\n<p><span style=\"text-decoration: underline\"><em>Maven Build Command<\/em><\/span><\/p>\n<pre class=\"brush:plain\">mvn package\n<\/pre>\n<p>The output of the executed command is shown below.<\/p>\n<div class=\"wp-block-image is-style-default\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"820\" height=\"800\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring_unit_test.jpg\" alt=\"spring framework components - unit test\" class=\"wp-image-70949\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring_unit_test.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring_unit_test-300x293.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring_unit_test-768x749.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Spring Unit Test<\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading\" id=\"h-2-10-best-practices\">2.10 Best Practices<\/h3>\n<p>In spring framework, the developer can implement custom annotation by implementing&nbsp;<code>ConstraintValidator<\/code>. Custom Annotations help in enhancing the separation of concerns. The developer can use a declarative way of implementing custom validators. You can use annotations like&nbsp;<code>AutoWired<\/code>&nbsp;and&nbsp;<code>Resource<\/code>&nbsp;in spring framework classes. Hibernate provides different query classes. The developer\u200b can pick the right query class based on the context. Bind Parameters are used to map the parameters to the right types. \u200bThe developer\u200b can analyze the queries and optimize them for performance.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-2-11-error-handling\">2.11 Error Handling<\/h3>\n<p>Spring framework has features to handle exceptions and errors. Errors in REST APIs help in presenting the issues&nbsp;to the clients. <\/p>\n<h3 class=\"wp-block-heading\" id=\"h-2-12-performance\">2.12 Performance<\/h3>\n<p>Spring framework has features like extending the AbstractMonitoringInterceptor class to log the start, end, and duration of a method. Spring AOP helps in defining and writing code which can intercept the execution of the methods for monitoring the performance.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-2-13-scalability\">2.13 Scalability<\/h3>\n<p>Spring framework has MVC, ORM, Messaging and Caching support which is very important for scalability. For scalable deployments, developers and architects need to ensure the servers are stateless or implement sticky sessions with load balancers. Caching helps in reducing the load on the database. <\/p>\n<h3 class=\"wp-block-heading\" id=\"h-2-14-reliability\">2.14 Reliability<\/h3>\n<p>Spring Boot has a reliable application development framework. SpringBoot applications are deployed as self-contained units using the profiles feature. <\/p>\n<h3 class=\"wp-block-heading\" id=\"h-2-15-security\">2.15 Security<\/h3>\n<p>Spring Security for User interfaces and HTTP back ends is based on Servlet Filters. The spring framework provides support for implementing access rules to methods. Spring Security framework has an architecture which is designed to support both authentication and authorization. <\/p>\n<h3 class=\"wp-block-heading\" id=\"h-2-16-logging\">2.16 Logging<\/h3>\n<p>Spring Framework uses Commons Logging for application logging. Different configurations for logging are provided in the framework. They are Java Util Logging, Log4J2, and Logback. Loggers are pre-configured for printing the output on the console or in the configured file. <\/p>\n<h3 class=\"wp-block-heading\" id=\"h-2-17-management\">2.17 Management<\/h3>\n<p>Spring management features help in configuring a custom port, management server, and SSL configuration management. Spring Boot Actuator configures the enabled HTTP endpoints. Spring framework provides management endpoints which are JMX MBeans. <\/p>\n<h3 class=\"wp-block-heading\" id=\"h-2-18-deployment\">2.18 Deployment<\/h3>\n<p>The Spring Server supports the deployment of applications packaged in the formats such as Raw OSGi Bundles, Java EE WAR, Web Bundles, PAR, and Plans. <\/p>\n<h2 class=\"wp-block-heading\" id=\"h-3-download-the-source-code\">3. Download the Source Code<\/h2>\n<p>That was a tutorial about the Spring framework components.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here:<a href=\"https:\/\/examples.javacodegeeks.com\/spring-2\/\"> <strong>Spring Framework Components Tutorial<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This is an in-depth article related to the Spring framework components. 1. Introduction Spring Framework helps in creating stand-alone and production-ready applications. Spring Framework features are Spring MVC, JPA, Spring Boot, Micro Containers, and Messaging. It is an open-source software framework used by developers for creating web applications and services. Developers use Java technology stack &hellip;<\/p>\n","protected":false},"author":31,"featured_media":1248,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[52],"tags":[1054],"class_list":["post-100488","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring","tag-spring"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Spring Framework Components Tutorial - Examples Java Code Geeks<\/title>\n<meta name=\"description\" content=\"This is an in-depth article related to the Spring framework components. 1. Introduction Spring Framework helps in creating stand-alone and\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Framework Components Tutorial - Examples Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"This is an in-depth article related to the Spring framework components. 1. Introduction Spring Framework helps in creating stand-alone and\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/bhagvank\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-11T09:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Bhagvan Kommadi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bhaggu\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bhagvan Kommadi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/\"},\"author\":{\"name\":\"Bhagvan Kommadi\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/4575ae335b8ff016be62c3b927d5d5e6\"},\"headline\":\"Spring Framework Components Tutorial\",\"datePublished\":\"2021-03-11T09:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/\"},\"wordCount\":1174,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg\",\"keywords\":[\"spring\"],\"articleSection\":[\"spring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/\",\"name\":\"Spring Framework Components Tutorial - Examples Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg\",\"datePublished\":\"2021-03-11T09:00:00+00:00\",\"description\":\"This is an in-depth article related to the Spring framework components. 1. Introduction Spring Framework helps in creating stand-alone and\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"spring\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/spring\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Spring Framework Components Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/4575ae335b8ff016be62c3b927d5d5e6\",\"name\":\"Bhagvan Kommadi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/02\/bhagvan.-kommadi-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/02\/bhagvan.-kommadi-96x96.jpg\",\"caption\":\"Bhagvan Kommadi\"},\"description\":\"Bhagvan Kommadi is the Founder of Architect Corner &amp; has around 20 years\u2019 experience in the industry, ranging from large scale enterprise development to helping incubate software product start-ups. He has done Masters in Industrial Systems Engineering at Georgia Institute of Technology (1997) and Bachelors in Aerospace Engineering from Indian Institute of Technology, Madras (1993). He is member of IFX forum,Oracle JCP and participant in Java Community Process. He founded Quantica Computacao, the first quantum computing startup in India. Markets and Markets have positioned Quantica Computacao in \u2018Emerging Companies\u2019 section of Quantum Computing quadrants. Bhagvan has engineered and developed simulators and tools in the area of quantum technology using IBM Q, Microsoft Q# and Google QScript. He has reviewed the Manning book titled : \\\"Machine Learning with TensorFlow\u201d. He is also the author of Packt Publishing book - \\\"Hands-On Data Structures and Algorithms with Go\\\".He is member of IFX forum,Oracle JCP and participant in Java Community Process. He is member of the MIT Technology Review Global Panel.\",\"sameAs\":[\"http:\/\/www.architectcorner.com\",\"https:\/\/www.facebook.com\/bhagvank\",\"https:\/\/in.linkedin.com\/pub\/bhagvan-kommadi\/0\/3a6\/b46\",\"https:\/\/x.com\/bhaggu\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/bhagvan-kommadi\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring Framework Components Tutorial - Examples Java Code Geeks","description":"This is an in-depth article related to the Spring framework components. 1. Introduction Spring Framework helps in creating stand-alone and","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:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"Spring Framework Components Tutorial - Examples Java Code Geeks","og_description":"This is an in-depth article related to the Spring framework components. 1. Introduction Spring Framework helps in creating stand-alone and","og_url":"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_author":"https:\/\/www.facebook.com\/bhagvank","article_published_time":"2021-03-11T09:00:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg","type":"image\/jpeg"}],"author":"Bhagvan Kommadi","twitter_card":"summary_large_image","twitter_creator":"@bhaggu","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Bhagvan Kommadi","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/"},"author":{"name":"Bhagvan Kommadi","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/4575ae335b8ff016be62c3b927d5d5e6"},"headline":"Spring Framework Components Tutorial","datePublished":"2021-03-11T09:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/"},"wordCount":1174,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg","keywords":["spring"],"articleSection":["spring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/","url":"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/","name":"Spring Framework Components Tutorial - Examples Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg","datePublished":"2021-03-11T09:00:00+00:00","description":"This is an in-depth article related to the Spring framework components. 1. Introduction Spring Framework helps in creating stand-alone and","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/spring-framework-components-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/"},{"@type":"ListItem","position":4,"name":"spring","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/spring\/"},{"@type":"ListItem","position":5,"name":"Spring Framework Components Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/4575ae335b8ff016be62c3b927d5d5e6","name":"Bhagvan Kommadi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/02\/bhagvan.-kommadi-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/02\/bhagvan.-kommadi-96x96.jpg","caption":"Bhagvan Kommadi"},"description":"Bhagvan Kommadi is the Founder of Architect Corner &amp; has around 20 years\u2019 experience in the industry, ranging from large scale enterprise development to helping incubate software product start-ups. He has done Masters in Industrial Systems Engineering at Georgia Institute of Technology (1997) and Bachelors in Aerospace Engineering from Indian Institute of Technology, Madras (1993). He is member of IFX forum,Oracle JCP and participant in Java Community Process. He founded Quantica Computacao, the first quantum computing startup in India. Markets and Markets have positioned Quantica Computacao in \u2018Emerging Companies\u2019 section of Quantum Computing quadrants. Bhagvan has engineered and developed simulators and tools in the area of quantum technology using IBM Q, Microsoft Q# and Google QScript. He has reviewed the Manning book titled : \"Machine Learning with TensorFlow\u201d. He is also the author of Packt Publishing book - \"Hands-On Data Structures and Algorithms with Go\".He is member of IFX forum,Oracle JCP and participant in Java Community Process. He is member of the MIT Technology Review Global Panel.","sameAs":["http:\/\/www.architectcorner.com","https:\/\/www.facebook.com\/bhagvank","https:\/\/in.linkedin.com\/pub\/bhagvan-kommadi\/0\/3a6\/b46","https:\/\/x.com\/bhaggu"],"url":"https:\/\/examples.javacodegeeks.com\/author\/bhagvan-kommadi\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/100488","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=100488"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/100488\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1248"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=100488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=100488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=100488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}