{"id":92145,"date":"2019-05-26T15:15:13","date_gmt":"2019-05-26T12:15:13","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=92145"},"modified":"2019-05-23T11:10:00","modified_gmt":"2019-05-23T08:10:00","slug":"spring-mvc-annotations","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html","title":{"rendered":"Spring MVC Annotations"},"content":{"rendered":"<h3 class=\"wp-block-heading\">Introduction:<\/h3>\n<p>Spring 2.5 onwards, we can use annotations to mark our Spring components.<\/p>\n<p>One way of doing so is to use a <em>&lt;component-scan&gt;<\/em> tag in our <em>appConfig.xml<\/em>:<\/p>\n<pre class=\"brush:xml\">\n&lt;context:component-scan base-package=\"com.programmergirl\" \/&gt;\n<\/pre>\n<p>The Spring container will then recursively scan all components in the given package &amp; its sub-packages.<\/p>\n<p>In this quick tutorial, <strong>we\u2019ll discuss the most commonly used Spring MVC annotations.<\/strong><\/p>\n<h3 class=\"wp-block-heading\">Defining a <em>Controller<\/em>:<\/h3>\n<p>There\u2019re two different annotations we can use for our controller based on its type:<\/p>\n<h3 class=\"wp-block-heading\"><em>1. @Controller:<\/em><\/h3>\n<p>We can simply use this annotation to mark any of our Spring MVC controller classes:<\/p>\n<pre class=\"brush:java\">\n@Controller\npublic class MyController {\n \n   ...\n}\n<\/pre>\n<h3 class=\"wp-block-heading\"><em>2. @RestController:<\/em><\/h3>\n<p><strong>This annotation is useful for annotating our <em>RESTful controllers<\/em>:<\/strong><\/p>\n<pre class=\"brush:java\">\n@RestController\npublic class MyRestController {\n    ...\n}\n<\/pre>\n<p><strong>This annotation is itself annotated with both <em>@Controller<\/em> and <em>@ResponseBody<\/em> annotations.<\/strong><\/p>\n<p>We have covered the <a href=\"http:\/\/www.programmergirl.com\/spring-controller-vs-restcontroller-annotations\/\">difference between<em> @Controller <\/em>and<em> @RestController<\/em><\/a> in much detail in one of our other articles.<\/p>\n<h3 class=\"wp-block-heading\">Request-Handling Annotations:<\/h3>\n<p>Let\u2019s now look at the annotation we can use for handling our <em>HTTP<\/em> requests:<\/p>\n<h3 class=\"wp-block-heading\"><em>1. @RequestMapping:<\/em><\/h3>\n<p><strong>We use this annotation to map the web request methods in the Spring MVC Controller<\/strong>. We can also customize it using its available attributes:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong><em>method:<\/em><\/strong> denotes one the <em>HTTP<\/em> request methods \u2013<em> PUT, GET, POST, DELETE, PATCH<br \/><\/em><\/li>\n<li><strong><em>value:<\/em><\/strong> the mapped <em>URL<\/em><\/li>\n<li><strong><em>params<\/em>:<\/strong> filters the request based on the <em>HTTP<\/em> parameters<\/li>\n<li><strong><em>headers<\/em>:<\/strong> filters the request based on the <em>HTTP<\/em> headers.<\/li>\n<li><strong><em>produces:<\/em> <\/strong>defines the media type of the <em>HTTP<\/em> responses<\/li>\n<li><strong><em>consumes:<\/em><\/strong> specifies the media type of the <em>HTTP<\/em> request<\/li>\n<\/ul>\n<pre class=\"brush:java\">\n@Controller\n@RequestMapping(\"\/hello-world\")\nclass MyController {\n \n    @RequestMapping(value = \"\/message\", method = RequestMethod.GET)\n    String message() {\n        return \"Hello World!\";\n    }\n}\n<\/pre>\n<p><strong>We can also use this annotation at class-level for setting up some common properties<\/strong>.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>Moreover, Spring 4.3 onwards, <em>@RequestMapping<\/em> offers several variants for different <em>HTTP<\/em> methods. These include <em>@GetMapping, @PutMapping, @PostMapping, @DeleteMapping, <\/em>and<em> @PatchMatching.<\/em><\/p>\n<h3 class=\"wp-block-heading\"><em>2. @RequestParam:<\/em><\/h3>\n<p><strong>With this annotation, we can bind an <em>HTTP<\/em> request parameter to the method parameter<\/strong>:<\/p>\n<pre class=\"brush:java\">\n@GetMapping(\"\/message\")\nString message(@RequestParam(\"userName\") String userName) {\n    return \"Hello \" + userName;\n}\n<\/pre>\n<p>Optionally, we can also provide a default value. For the missing value of the request parameter, the default value is used:<\/p>\n<pre class=\"brush:java\">\n@GetMapping(\"\/message\")\nString message(@RequestParam(defaultValue = \"Sam\") String userName) {\n    return \"Hello \" + userName;\n}\n<\/pre>\n<h3 class=\"wp-block-heading\"><em>3. @PathVariable:<\/em><\/h3>\n<p><strong>We can bind the method parameter to one of the variables in the path or <em>URI<\/em>.<\/strong> We\u2019ll use <em>@PathVariable<\/em> for it:<\/p>\n<pre class=\"brush:java\">\n@GetMapping(\"\/message\/{userName}\")\nString message(@PathVariable String userName) {\n    ...\n}\n<\/pre>\n<p>Also, we can choose to mark a path variable as optional by setting <em>required<\/em> to <em>false:<\/em><\/p>\n<pre class=\"brush:java\">\n@GetMapping(\"\/message\/{userName}\")\nString message(@PathVariable(required = false) String userName) {\n    ...\n}\n<\/pre>\n<h3 class=\"wp-block-heading\"><em>4. @RequestBody:<\/em><\/h3>\n<p>An <em>HTTP<\/em> request body can be passed as an argument to a handler method in our controller.&nbsp; We often use it for reading the request body of requests with <em>HTTP<\/em> methods as <em>PUT<\/em> and <em>POST<\/em>.<\/p>\n<pre class=\"brush:java\">\n@PostMapping(\"\/message\")\nString message(@RequestBody String userName) {\n    ...\n}\n<\/pre>\n<p>The content is automatically deserialized using <em>HttpMessageConverter<\/em> based on its type.<\/p>\n<h3 class=\"wp-block-heading\">Response-Handling Annotations:<\/h3>\n<p>Now, let\u2019s explore some annotations we can use for dealing with <em>HTTP<\/em> responses:<\/p>\n<h3 class=\"wp-block-heading\"><em>1. @ResponseBody:<\/em><\/h3>\n<p>Similar to the <em>@RequestBody<\/em>, we have a <em>@ResponseBody<\/em> annotation. <strong>When we annotate a method with this annotation, Spring treats the result of this method as the response itself:<\/strong><\/p>\n<pre class=\"brush:java\">\n@GetMapping(\"\/message\")\n@ResponseBody\nString message() {\n    return \"Hello World!!\";\n}\n<\/pre>\n<p>We can also annotate our <em>@Controller<\/em> class with this annotation. If so, all methods in our controller will use it.<\/p>\n<h3 class=\"wp-block-heading\"><em>2. @ResponseStatus:<\/em><\/h3>\n<p>With this, we can map the desired <em>HTTP<\/em> response status to the methods in our controller:<\/p>\n<pre class=\"brush:java\">\n@ExceptionHandler(UserAccessDeniedException.class)\n@ResponseStatus(HttpStatus.FORBIDDEN)\nvoid onUserAccessDeniedException(UserAccessDeniedException exception) {\n    ...\n}\n<\/pre>\n<p>We can learn more about <a href=\"http:\/\/www.programmergirl.com\/spring-responsestatus\/\">how to set a status code and reason using<em> @ResponseStatus.<\/em><\/a><\/p>\n<h3 class=\"wp-block-heading\"><em>3. @ExceptionHandler:<\/em><\/h3>\n<p>We can write custom exception handler methods. <strong>These methods will be invoked when an exception of its type is raised during the method execution:<\/strong><\/p>\n<pre class=\"brush:java\">\n@ExceptionHandler(UserAccessDeniedException.class)\nvoid onUserAccessDeniedException(UserAccessDeniedException exception) {\n    \/\/ ...\n}\n<\/pre>\n<h3 class=\"wp-block-heading\">Conclusion:<\/h3>\n<p>In this tutorial, we skimmed through most of the commonly used Spring MVC annotations.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>\n<p>Published on Java Code Geeks with permission by Shubhra Srivastava, partner at our <a href=\"\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener noreferrer\">JCG program<\/a>. See the original article here: <a href=\"http:\/\/www.programmergirl.com\/spring-mvc-annotations\/\" target=\"_blank\" rel=\"noopener noreferrer\">Spring MVC Annotations<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: Spring 2.5 onwards, we can use annotations to mark our Spring components. One way of doing so is to use a &lt;component-scan&gt; tag in our appConfig.xml: &lt;context:component-scan base-package=&#8221;com.programmergirl&#8221; \/&gt; The Spring container will then recursively scan all components in the given package &amp; its sub-packages. In this quick tutorial, we\u2019ll discuss the most commonly &hellip;<\/p>\n","protected":false},"author":82253,"featured_media":240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[30],"class_list":["post-92145","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-spring"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Spring MVC Annotations - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn about Spring MVC Annotations? Check our article explaining the most commonly used Spring MVC annotations.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring MVC Annotations - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn about Spring MVC Annotations? Check our article explaining the most commonly used Spring MVC annotations.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2019-05-26T12:15:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/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=\"Shubhra Srivastava\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shubhra Srivastava\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/05\\\/spring-mvc-annotations.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/05\\\/spring-mvc-annotations.html\"},\"author\":{\"name\":\"Shubhra Srivastava\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/b73b076dc62e72de203df7018d398e56\"},\"headline\":\"Spring MVC Annotations\",\"datePublished\":\"2019-05-26T12:15:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/05\\\/spring-mvc-annotations.html\"},\"wordCount\":555,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/05\\\/spring-mvc-annotations.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"keywords\":[\"Spring\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/05\\\/spring-mvc-annotations.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/05\\\/spring-mvc-annotations.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/05\\\/spring-mvc-annotations.html\",\"name\":\"Spring MVC Annotations - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/05\\\/spring-mvc-annotations.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/05\\\/spring-mvc-annotations.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"datePublished\":\"2019-05-26T12:15:13+00:00\",\"description\":\"Interested to learn about Spring MVC Annotations? Check our article explaining the most commonly used Spring MVC annotations.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/05\\\/spring-mvc-annotations.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/05\\\/spring-mvc-annotations.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/05\\\/spring-mvc-annotations.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"spring-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/05\\\/spring-mvc-annotations.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Spring MVC Annotations\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/b73b076dc62e72de203df7018d398e56\",\"name\":\"Shubhra Srivastava\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9e5d3b016140986463a886392b8400e55ed0aa7742ef29b86a54bd8d5743b68a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9e5d3b016140986463a886392b8400e55ed0aa7742ef29b86a54bd8d5743b68a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9e5d3b016140986463a886392b8400e55ed0aa7742ef29b86a54bd8d5743b68a?s=96&d=mm&r=g\",\"caption\":\"Shubhra Srivastava\"},\"description\":\"Shubhra is a software professional and founder of ProgrammerGirl. She has a great experience with Java\\\/J2EE technologies and frameworks. She loves the amalgam of programming and coffee :)\",\"sameAs\":[\"http:\\\/\\\/www.programmergirl.com\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/shubhra-srivastava224\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/shubhra-srivastava\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring MVC Annotations - Java Code Geeks","description":"Interested to learn about Spring MVC Annotations? Check our article explaining the most commonly used Spring MVC annotations.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html","og_locale":"en_US","og_type":"article","og_title":"Spring MVC Annotations - Java Code Geeks","og_description":"Interested to learn about Spring MVC Annotations? Check our article explaining the most commonly used Spring MVC annotations.","og_url":"https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2019-05-26T12:15:13+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","type":"image\/jpeg"}],"author":"Shubhra Srivastava","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Shubhra Srivastava","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html"},"author":{"name":"Shubhra Srivastava","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/b73b076dc62e72de203df7018d398e56"},"headline":"Spring MVC Annotations","datePublished":"2019-05-26T12:15:13+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html"},"wordCount":555,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","keywords":["Spring"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html","url":"https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html","name":"Spring MVC Annotations - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","datePublished":"2019-05-26T12:15:13+00:00","description":"Interested to learn about Spring MVC Annotations? Check our article explaining the most commonly used Spring MVC annotations.","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","width":150,"height":150,"caption":"spring-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2019\/05\/spring-mvc-annotations.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Spring MVC Annotations"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/b73b076dc62e72de203df7018d398e56","name":"Shubhra Srivastava","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9e5d3b016140986463a886392b8400e55ed0aa7742ef29b86a54bd8d5743b68a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9e5d3b016140986463a886392b8400e55ed0aa7742ef29b86a54bd8d5743b68a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9e5d3b016140986463a886392b8400e55ed0aa7742ef29b86a54bd8d5743b68a?s=96&d=mm&r=g","caption":"Shubhra Srivastava"},"description":"Shubhra is a software professional and founder of ProgrammerGirl. She has a great experience with Java\/J2EE technologies and frameworks. She loves the amalgam of programming and coffee :)","sameAs":["http:\/\/www.programmergirl.com","https:\/\/www.linkedin.com\/in\/shubhra-srivastava224\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/shubhra-srivastava"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/92145","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/82253"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=92145"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/92145\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/240"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=92145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=92145"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=92145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}