{"id":85427,"date":"2020-02-28T11:00:00","date_gmt":"2020-02-28T09:00:00","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=85427"},"modified":"2021-03-23T15:46:26","modified_gmt":"2021-03-23T13:46:26","slug":"spring-boot-annotations-tutorial","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/","title":{"rendered":"Spring Boot Framework Annotations Tutorial"},"content":{"rendered":"<p>In this post, we feature a tutorial on the annotations of Spring Boot Framework. When Spring was initially introduced, developers were mostly using XML-based configuration. With the introduction of the revolutionary Spring Boot framework now developers have completely moved away from XML-based configuration and it is hard to imagine development without using annotations.<\/p>\n<p>We are going to discuss the basic Spring\/ Spring Boot annotations like <code>@SpringBootAepplication, @EnableAutoConfiguration, @Conditional, @ComponentScan, @Configuration, @Bean, @BeanFactory, @Service, @Component, @Controller, @Repository, @Autowired, @Import, @Profile, @ImportResource, @EnableConfigServer,  @EnableEurekaServer, @EnableDiscoveryClient, @EnableCircuitBreaker,<\/code> and so on.<\/p>\n<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-1-springbootapplication\">1. @SpringBootApplication<\/h2>\n<p>The main class in the Spring Boot application is annotated with <code>@SpringBootApplication<\/code>. Spring boot application is about the autoconfiguring of various resources. It does it by component scanning. By scanning classes with <code>@Component <\/code>and <code>@Configuration<\/code> annotations. <code>@SpringBootApplication<\/code> enables all of these in a single step. Under the hood it enables,<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-large\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg\"><img decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg\" alt=\"Spring Framework Annotations\" class=\"wp-image-1248\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg 150w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo-70x70.jpg 70w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/a><\/figure>\n<\/div>\n<ul class=\"wp-block-list\">\n<li><code>@ComponentScan<\/code> &#8211; This annotation tells the Spring Boot framework to identify all the components under the same package or all of its sub-packages. Optionally we can even specify the packages to be scanned.<\/li>\n<li><code>@EnableAutoConfiguration<\/code> &#8211; This annotation auto-configures all the beans in the classpath. It readies the beans by initializing all the required dependencies.<\/li>\n<li><code>@SpringBootConfiguration<\/code> &#8211; This is a class-level annotation and indicates that the class is an application configuration class. Generally, this class has the bean definitions.<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"h-2-conditional-annotations\">2. Conditional Annotations<\/h2>\n<p>Conditional annotations can be used on the components. This allows us to specify whether the annotated configuration\/bean\/method is eligible to be registered in the container or not based on some conditions. Spring Boot takes<code> @Conditional <\/code>annotation to the next level by providing several pre-defined <code>@Conditional* <\/code>annotations under the package <code>org.springframework.boot.autoconfigure.conditional<\/code>.<\/p>\n<ul class=\"wp-block-list\">\n<li><code>@ConditionalOnClass<\/code> and <code>@ConditionalOnMissingClass<\/code> &#8211; If some class to be loaded only if some other class is available then use <code>@ConditionalOnClass<\/code>. If a class to be loaded only if another class isn&#8217;t available in <code>ApplicationContext<\/code> then use <code>@ConditionalOnMissingClass<\/code>.<\/li>\n<li><code>@ConditionalOnBean<\/code> and <code>@ConditionalOnMissingBean<\/code> &#8211;  Load the bean only if the certain bean is there in the application context or if the certain bean is missing in the application context. <\/li>\n<li><code>@ConditionalOnProperty<\/code> &#8211; This probably the most used conditional annotation. It enables us to load certain beans only when a specific property is set in the configuration.<\/li>\n<li><code>@ConditionalOnResource<\/code> &#8211; Load some bean only if a certain resource is present in the classpath. A useful use case is to load\/enable Logging only when logback.xml is present in the classpath.<\/li>\n<li>@ConditionalOnWebApplication and @ConditionalOnNotWebApplication &#8211; Load the bean if we are running a web application or load when not a web application.<\/li>\n<li>@ConditionalExpression &#8211; This can be used to build complex rules involving multiple configurations.<\/li>\n<li>@Conditional &#8211; More generic annotation enables us to specify the conditions on Classes, Beans, Methods, and configuration.<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"h-3-context-configuration-annotations\">3. Context Configuration Annotations<\/h2>\n<p>Context Configuration Annotations are used by the beans to set the application context during run time. <code> @Configuration <\/code> annotation is used with <code>@ComponentScan <\/code> annotation for component scanning configuration. The default configuration looks at the current folder or package and sub-packages of components. The other annotations used for scanning the components are <code>@Component, @Controller, @Service, @BeanFactory,<\/code> and <code>@Repository <\/code>. <code>Hibernate Configuration <\/code> is shown below as an example below:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><span style=\"text-decoration: underline\"><em>@ComponentScan Annotation<\/em><\/span><\/p>\n<pre class=\"brush:java\">@Configuration\n@ComponentScan(basePackages = {org.javacdoegeeks.orm.hibernate})\npublic class HibernateConfig {\n     \n}\n<\/pre>\n<p>Configuration&nbsp;classes have bean definition methods that have Bean annotations.&nbsp; <code>@Configuration<\/code> annotation is used by the beans for declaring the Class with bean definitions using <code>@Bean<\/code> annotation. <code>@ComponentScan<\/code> annotation is used by the bean for generating bean definitions. <code>DataConfig<\/code> class is shown as an example for <code>@Configuration<\/code> annotation usage.<\/p>\n<p><span style=\"text-decoration: underline\"><em>@Configuration annotation<\/em><\/span><\/p>\n<pre class=\"brush:java\">@Configuration\npublic class DataConfig {\n     \n    @Bean\n    public DataUtils dataUtils()\n    {\n        return new DataUnits();\n    }\n}\n<\/pre>\n<p><code>@Profile <\/code> annotation is used by the bean for registration. Registration can happen when there are multiple profiles. These profiles can be for dev, prod, test, and other groups. <code>dataUtils<\/code> implementation is shown as an example for handling multiple profiles &#8211; dev and prod groups.<\/p>\n<p><span style=\"text-decoration: underline\"><em>@Profile Annotation<\/em><\/span><\/p>\n<pre class=\"brush:java\">@Bean\n@Profile(\"dev\")\npublic DataUtils dataUtils()\n{\n    return new DevDataUnits();\n}\n \n@Bean\n@Profile(\"prod\")\npublic DataUtils dataUtils()\n{\n    return new ProdDataUnits();\n}\n<\/pre>\n<p><code>@Import<\/code> annotation is used for importing component classes such as <code>@Configuration<\/code> and <code>@Bean<\/code> definitions.  The example shown below demonstrates the usage of Import annotation.<\/p>\n<p><span style=\"text-decoration: underline\"><em>@Import Annotation<\/em><\/span><\/p>\n<pre class=\"brush:java\">@Configuration\n@Import({ HibernateConfig.class, DataConfig.class })\npublic class SystemConfig {\n \n}\n<\/pre>\n<p><code>@ImportResource<\/code> annotation is used by the bean for importing resources with bean definitions. Bean definitions can be in XML.  <code>ConfigClass<\/code> example shows below the usage of <code>@ImportResource<\/code> annotation.<\/p>\n<p><span style=\"text-decoration: underline\"><em>@ImportResource Annotation<\/em><\/span><\/p>\n<pre class=\"brush:java\">@Configuration \n@ImportResource( { \"spring-context.xml\" } )  \npublic class ConfigClass { \n \n}\n<\/pre>\n<h2 class=\"wp-block-heading\" id=\"h-4-basic-spring-boot-framework-annotations\">4. Basic Spring Boot Framework Annotations<\/h2>\n<p>Spring Boot has support for all the basic Spring annotations. Below are some of the core annotations supported in Spring\/Spring Boot.<\/p>\n<ul class=\"wp-block-list\">\n<li><code>@Component<\/code> &#8211; It is a generic annotation to indicate the class is managed by Spring container<\/li>\n<li><code>@Bean<\/code> &#8211; This is a method level annotation and indicates that the method produces a container-managed bean, this is a replacement for <code>&lt;bean\/&gt;<\/code> tag in XML based configuration<\/li>\n<li><code>@Service<\/code> &#8211; This annotation is a class-level annotation and indicates that the class holds the business logic<\/li>\n<li>@Configuration &#8211; The classes marked with this annotation are processed by Spring container to generate bean definitions<\/li>\n<li>@Controller &#8211; This is a specialization of @Component annotation and typically used in combination with @RequestMapping annotation. @RestController annotation simplifies the creation of the REST service.<\/li>\n<li>@RequestMapping &#8211; This annotation maps the Web\/Rest API HTTP requests to the handler methods. @GetMapping, @PostMapping, @PutMapping are the special implementations of @RequestMapping.<\/li>\n<li>@Repository &#8211; Spring repository is very close to the DAO pattern and it simplifies the CRUD operation implementation<\/li>\n<li><code>@Autowired<\/code> &#8211; This annotation allows Spring Framework to resolve and inject the dependencies. It can be used on properties, setter methods or with constructor<\/li>\n<li>@Qualifier -Used o resolve the name conflicts among the beans of the same type<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"h-5-test-annotations\">5. Test Annotations<\/h2>\n<p>In this section, I am going to briefly discuss some of the Spring Boot test annotations. Spring boot test requires dependency <code>spring-boot-starter-test<\/code> in the maven file. This enables us to run Unit and Integration tests. <\/p>\n<p><code>@RunWith(SpringRunner.class)<\/code> provides the bridge between Spring Boot and JUnit. This is required for all Spring Boot tests. Below are some of the Spring Boot Test annotations,<\/p>\n<ul class=\"wp-block-list\">\n<li><code>@DataJpaTest<\/code> &#8211; This provides a standard environment to run persistence layer tests. It also needs a test database setup. This sets up ORM, SpringData and Datasource. It is responsible for running the Entity Scan. <code>TestEntityManager <\/code>provided by Spring Boot can be used to set up the database and the data required for the tests to run.<\/li>\n<li><code>@MockBean<\/code> &#8211; It provides the required mocking feature to handle the dependencies. <\/li>\n<li><code>@TestConfiguration<\/code> &#8211; Indicates that the beans created using @Bean annotation in test classes shouldn&#8217;t be picked up while scanning<\/li>\n<li><code>@WebMvcTest<\/code> &#8211; To test Controller classes we use this annotation. It auto-configures the Spring MVC infrastructure for our tests.<\/li>\n<li><code>@SpringBootTest<\/code> &#8211; This enables us to write integration tests. This bootstraps the entire Spring container and creates the <code>ApplicationContext <\/code>to be used in the tests.<\/li>\n<\/ul>\n<p>The example provided in this article doesn&#8217;t cover the test annotations. You can write your own tests to learn more about Spring Boot Test annotations.[ulp id=&#8217;7POIYxRf1FUtPpmL&#8217; name=&#8217;Spring Framework Cookbook Inline&#8217;]<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-6-spring-cloud-annotations\">6. Spring Cloud Annotations<\/h2>\n<p><code>@EnableConfigServer<\/code> annotation is a spring cloud annotation used by the application for accessing the configuration. You can have a java service for server configuration. <code>HelloWorldApplication<\/code> example is shown below to demonstrate <code>@EnableConfigServer<\/code> annotation.<\/p>\n<p><span style=\"text-decoration: underline\"><em>@EnableConfigServer Annotation<\/em><\/span><\/p>\n<pre class=\"brush:java\">import org.springframework.context.annotation.*;\n\n@SpringBootApplication\n@EnableConfigServer\npublic class HelloWorldApplication {\n   public static void main(String[] args) {\n           SpringApplication.run(HelloWorldApplication.class, args);\n   }\n}\n\n<\/pre>\n<p><code>@EnableEurekaServer<\/code> annotation is used by the application for Eureka discovery. Eureka&#8217;s discovery service can be used for service location on the Spring Cloud. HelloWorldApplication the example below shows the usage of EnableEurekaServer annotation.<\/p>\n<p><span style=\"text-decoration: underline\"><em>@EnableEurekaServer Annotation<\/em><\/span><\/p>\n<pre class=\"brush:java\">import org.spingframework.boot.SpringApplication;\nimport org.spingframework.boot.autoconfigure.SpringBootApplication;\nimport org.spingframework.cloud.netflix.eureka.server.EnableEurekaServer;\n\n@SpringBootApplication\n@EnableEurekaServer\npublic class HelloWorldApplication {\n   public static void main(String[] args) {\n           SpringApplication.run(HelloWorldApplication.class, args);\n   }\n}\n\n<\/pre>\n<p><code>@EnableDiscoveryClient<\/code> annotation was used by the application for service discovery and other microservices. <code>@EnableCircuitBreaker<\/code> annotation is another Spring Cloud annotation used for Hystrix circuit breaker protocols. This is based on the Circuit Breaker pattern. This pattern helps in functional degradation during a call failure. When one service failure, cascading failure can be detected and a recovery process can be executed.  <code>@HystrixCommand<\/code> annotation is used with method name which is a fallback for handling failure. <\/p>\n<h2 class=\"wp-block-heading\" id=\"h-7-spring-boot-framework-annotations-example\">7. Spring Boot Framework Annotations Example<\/h2>\n<p>This example demonstrates some of the Spring Boot annotations. Additional annotations can be tried as an example.<\/p>\n<p><span style=\"text-decoration: underline\"><em>SpringBootDemoApplication<\/em><\/span><\/p>\n<pre class=\"brush:java\">@SpringBootApplication\n@ComponentScan(basePackages = {\"com.jcg.example.controllers\", \"com.jcg.example.services\"})\npublic class SpringBootDemoApplication {\n\tpublic static void main(String[] args) {\n\t\tSpringApplication.run(SpringBootDemoApplication.class, args);\n\t}\n}\n<\/pre>\n<p><code>@SpringBootApplication<\/code> is added on the main class and it does the initial setup for Sring Boot application. <code>@ComponentScan<\/code> enables the auto-scanning of annotated classes.<\/p>\n<p><span style=\"text-decoration: underline\"><em>HelloWorldController<\/em><\/span><\/p>\n<pre class=\"brush:java\">@RestController\npublic class HelloWorldController {\n    private final HelloWorldService service;\n\n    public HelloWorldController(HelloWorldService service) {\n        this.service = service;\n    }\n\n    @GetMapping(value=\"\/hello\", produces = MediaType.TEXT_PLAIN_VALUE)\n    public String sayHelloWorld() {\n        return service.sayMessage();\n    }\n}\n<\/pre>\n<p>The above class is marked with the annotation <code>@RestController <\/code>. As we have enabled component scan to the package <code>com.jcg.example.controllers<\/code>, classes marked with Spring Boot annotations in this package are automatically detected and prepared by the container.<\/p>\n<p>Here I am using constructor injection. If you want to use setter based DI then you can make use of annotation <code>@Autowired<\/code> on the bean <code>HelloWorldService<\/code>.<\/p>\n<p>Below is the snippet to use one of the conditional annotations <code>@ConditionalOnResource<\/code>. <code>MySQLDatabaseService<\/code> class is dependent on <code>mysql.properties<\/code> resource. If it doesn&#8217;t find it in the classpath then the container will throw an error. To test this behavior delete <code>mysql.properties<\/code> from the resources folder in the example project and rerun.<\/p>\n<p><span style=\"text-decoration: underline\"><em>MySQLDatabaseService<\/em><\/span><\/p>\n<pre class=\"brush:java\">@ConditionalOnResource(\n        resources = \"classpath:mysql.properties\")\n@Service\npublic class MySQLDatabaseService {\n    \/\/This class is available only if mysql.properties is present in the classpath\n}\n<\/pre>\n<p>All different flavors of conditional annotations can be tried as an exercise.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-8-download-the-source-code\">8. Download the source code<\/h2>\n<p>That was a Spring Boot Framework Annotations Tutorial.<\/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\/wp-content\/uploads\/2021\/03\/spring-boot-annotation.zip\"><strong>Spring Boot Framework Annotations Tutorial<\/strong><\/a><\/div>\n<p><strong>Last updated on Mar. 22nd, 2021<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post, we feature a tutorial on the annotations of Spring Boot Framework. When Spring was initially introduced, developers were mostly using XML-based configuration. With the introduction of the revolutionary Spring Boot framework now developers have completely moved away from XML-based configuration and it is hard to imagine development without using annotations. We are &hellip;<\/p>\n","protected":false},"author":188,"featured_media":1248,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1390],"tags":[],"class_list":["post-85427","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-boot"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Spring Boot Framework Annotations - Examples Java Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"In this post, we feature a tutorial on the annotations of Spring Boot Framework. When Spring was initially introduced, developers were mostly using\" \/>\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-boot-annotations-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Boot Framework Annotations - Examples Java Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"In this post, we feature a tutorial on the annotations of Spring Boot Framework. When Spring was initially introduced, developers were mostly using\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-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:published_time\" content=\"2020-02-28T09:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-23T13:46:26+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=\"Santosh Balgar\" \/>\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=\"Santosh Balgar\" \/>\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-boot-annotations-tutorial\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/\"},\"author\":{\"name\":\"Santosh Balgar\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/1b0c0dc413b3197579406a6c4ce5614a\"},\"headline\":\"Spring Boot Framework Annotations Tutorial\",\"datePublished\":\"2020-02-28T09:00:00+00:00\",\"dateModified\":\"2021-03-23T13:46:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/\"},\"wordCount\":1382,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg\",\"articleSection\":[\"Boot\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/\",\"name\":\"Spring Boot Framework Annotations - Examples Java Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg\",\"datePublished\":\"2020-02-28T09:00:00+00:00\",\"dateModified\":\"2021-03-23T13:46:26+00:00\",\"description\":\"In this post, we feature a tutorial on the annotations of Spring Boot Framework. When Spring was initially introduced, developers were mostly using\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-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-boot-annotations-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\":\"Boot\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/spring\/boot\/\"},{\"@type\":\"ListItem\",\"position\":6,\"name\":\"Spring Boot Framework Annotations 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\/1b0c0dc413b3197579406a6c4ce5614a\",\"name\":\"Santosh Balgar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/08\/santosh.sachchidananda-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/08\/santosh.sachchidananda-96x96.jpg\",\"caption\":\"Santosh Balgar\"},\"description\":\"He is a Software Engineer working in an industry-leading organization. He has completed his bachelors from Visweswaraya Technological University. In his career, he has worked in designing and implementing various software systems involving Java\/J2EE, Spring\/ Spring Boot, React JS, JQuery, Hibernate and related database technologies. He loves to share his knowledge and always look forward to learning and explore new technologies. He loves to spend his free time with his family. He enjoys traveling and loves to play cricket.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/santosh_balgar-sachchidananda\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring Boot Framework Annotations - Examples Java Code Geeks - 2026","description":"In this post, we feature a tutorial on the annotations of Spring Boot Framework. When Spring was initially introduced, developers were mostly using","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-boot-annotations-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"Spring Boot Framework Annotations - Examples Java Code Geeks - 2026","og_description":"In this post, we feature a tutorial on the annotations of Spring Boot Framework. When Spring was initially introduced, developers were mostly using","og_url":"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2020-02-28T09:00:00+00:00","article_modified_time":"2021-03-23T13:46:26+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":"Santosh Balgar","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Santosh Balgar","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/"},"author":{"name":"Santosh Balgar","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/1b0c0dc413b3197579406a6c4ce5614a"},"headline":"Spring Boot Framework Annotations Tutorial","datePublished":"2020-02-28T09:00:00+00:00","dateModified":"2021-03-23T13:46:26+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/"},"wordCount":1382,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg","articleSection":["Boot"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/","url":"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/","name":"Spring Boot Framework Annotations - Examples Java Code Geeks - 2026","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg","datePublished":"2020-02-28T09:00:00+00:00","dateModified":"2021-03-23T13:46:26+00:00","description":"In this post, we feature a tutorial on the annotations of Spring Boot Framework. When Spring was initially introduced, developers were mostly using","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/spring-boot-annotations-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-boot-annotations-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":"Boot","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/spring\/boot\/"},{"@type":"ListItem","position":6,"name":"Spring Boot Framework Annotations 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\/1b0c0dc413b3197579406a6c4ce5614a","name":"Santosh Balgar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/08\/santosh.sachchidananda-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/08\/santosh.sachchidananda-96x96.jpg","caption":"Santosh Balgar"},"description":"He is a Software Engineer working in an industry-leading organization. He has completed his bachelors from Visweswaraya Technological University. In his career, he has worked in designing and implementing various software systems involving Java\/J2EE, Spring\/ Spring Boot, React JS, JQuery, Hibernate and related database technologies. He loves to share his knowledge and always look forward to learning and explore new technologies. He loves to spend his free time with his family. He enjoys traveling and loves to play cricket.","url":"https:\/\/examples.javacodegeeks.com\/author\/santosh_balgar-sachchidananda\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/85427","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\/188"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=85427"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/85427\/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=85427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=85427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=85427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}