-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspring-annotations.html
18 lines (17 loc) · 11.1 KB
/
spring-annotations.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html><html lang="de-ch"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Spring Annotations - Finecloud</title><meta name="description" content="If you want to develop a Spring Application you need to know when to use which Annotation. Spring’s dependency injection capability includes the following annotations:"><meta name="generator" content="Publii Open-Source CMS for Static Site"><link rel="stylesheet" href="https://www.finecloud.ch/media/plugins/syntaxHighlighter/prism-black.css"><link rel="canonical" href="https://www.finecloud.ch/spring-annotations.html"><link rel="alternate" type="application/atom+xml" href="https://www.finecloud.ch/feed.xml"><link rel="alternate" type="application/json" href="https://www.finecloud.ch/feed.json"><meta property="og:title" content="Spring Annotations"><meta property="og:site_name" content="Finecloud"><meta property="og:description" content="If you want to develop a Spring Application you need to know when to use which Annotation. Spring’s dependency injection capability includes the following annotations:"><meta property="og:url" content="https://www.finecloud.ch/spring-annotations.html"><meta property="og:type" content="article"><link rel="shortcut icon" href="https://www.finecloud.ch/media/website/finecloud.png" type="image/png"><link rel="stylesheet" href="https://www.finecloud.ch/assets/css/style.css?v=39da73365516a098a9b73b721fc970e2"><script type="application/ld+json">{"@context":"http://schema.org","@type":"Article","mainEntityOfPage":{"@type":"WebPage","@id":"https://www.finecloud.ch/spring-annotations.html"},"headline":"Spring Annotations","datePublished":"2023-04-04T14:57","dateModified":"2023-04-04T16:15","description":"If you want to develop a Spring Application you need to know when to use which Annotation. Spring’s dependency injection capability includes the following annotations:","author":{"@type":"Person","name":"Finecloud","url":"https://www.finecloud.ch/authors/finecloud/"},"publisher":{"@type":"Organization","name":"Finecloud"}}</script><meta name="google-site-verification" content="seFY9U12uiEq5U3_MyZiX6XWzk0AVFl9zITr2ZKsytY"></head><body><div class="site-container"><header class="top" id="js-header"><a class="logo" href="https://www.finecloud.ch/">Finecloud</a><nav class="navbar js-navbar"><button class="navbar__toggle js-toggle" aria-label="Menu" aria-haspopup="true" aria-expanded="false"><span class="navbar__toggle-box"><span class="navbar__toggle-inner">Menu</span></span></button><ul class="navbar__menu"><li><a href="https://www.finecloud.ch/" target="_self">Blog</a></li><li><a href="https://www.finecloud.ch/tags/" target="_self">Tags</a></li></ul></nav><div class="search"><div class="search__overlay js-search-overlay"><div class="search__overlay-inner"><form action="https://www.finecloud.ch/search.html" class="search__form"><input class="search__input js-search-input" type="search" name="q" placeholder="search..." aria-label="search..." autofocus="autofocus"></form><button class="search__close js-search-close" aria-label="Close">Close</button></div></div><button class="search__btn js-search-btn" aria-label="Search"><svg role="presentation" focusable="false"><use xlink:href="https://www.finecloud.ch/assets/svg/svg-map.svg#search"/></svg></button></div></header><main><article class="post"><div class="hero"><figure class="hero__image hero__image--overlay"><img src="https://www.finecloud.ch/media/website/download.jpg" srcset="https://www.finecloud.ch/media/website/responsive/download-xs.jpg 300w, https://www.finecloud.ch/media/website/responsive/download-sm.jpg 480w, https://www.finecloud.ch/media/website/responsive/download-md.jpg 768w, https://www.finecloud.ch/media/website/responsive/download-lg.jpg 1024w, https://www.finecloud.ch/media/website/responsive/download-xl.jpg 1360w, https://www.finecloud.ch/media/website/responsive/download-2xl.jpg 1600w" sizes="100vw" loading="eager" alt=""></figure><header class="hero__content"><div class="wrapper"><div class="post__meta"><time datetime="2023-04-04T14:57">April 4, 2023</time></div><h1>Spring Annotations</h1></div></header></div><div class="wrapper post__entry"><p>If you want to develop a Spring Application you need to know when to use which Annotation.</p><h2>Dependency Injection</h2><p>Spring’s dependency injection capability includes the following annotations:</p><table style="border-collapse: collapse; width: 100%; height: 417.344px;" border="1"><tbody><tr style="height: 50.3594px;"><td style="width: 49.9288%; height: 50.3594px;"><strong>Annotation</strong></td><td style="width: 49.9288%; height: 50.3594px;"><strong>Explanation</strong></td></tr><tr style="height: 136.75px;"><td style="width: 49.9288%; height: 136.75px;"><a href="https://docs.spring.io/spring/docs/current/spring-framework-reference/html/beans.html#beans-stereotype-annotations" target="_blank" rel="nofollow noopener noreferrer">@Component</a></td><td style="width: 49.9288%; height: 136.75px;">Generic stereotype for any Spring-managed component.</td></tr><tr style="height: 79.1562px;"><td style="width: 49.9288%; height: 79.1562px;"><a href="https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/stereotype/Service.html" target="_blank" rel="nofollow noopener noreferrer">@Service </a></td><td style="width: 49.9288%; height: 79.1562px;">Indicates that an annotated class is a service.</td></tr><tr style="height: 50.3594px;"><td style="width: 49.9288%; height: 50.3594px;"><a href="https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/beans/factory/annotation/Value.html" rel="nofollow">@Value</a></td><td style="width: 49.9288%; height: 50.3594px;">Injection mechanism for fields and methods that indicates a default value. Often used to get values from property files.</td></tr><tr style="height: 50.3594px;"><td style="width: 49.9288%; height: 50.3594px;"> </td><td style="width: 49.9288%; height: 50.3594px;"> </td></tr><tr style="height: 50.3594px;"><td style="width: 49.9288%; height: 50.3594px;"> </td><td style="width: 49.9288%; height: 50.3594px;"> </td></tr></tbody></table><h2><br>Configuration</h2><table style="border-collapse: collapse; width: 100%; height: 417.344px;" border="1"><tbody><tr style="height: 50.3594px;"><td style="width: 49.9288%; height: 50.3594px;"><strong>Annotation</strong></td><td style="width: 49.9288%; height: 50.3594px;"><strong>Explanation</strong></td></tr><tr style="height: 136.75px;"><td style="width: 49.9288%; height: 136.75px;"><a href="https://docs.spring.io/spring/docs/current/spring-framework-reference/html/beans.html#beans-autowired-annotation-qualifiers" target="_blank" rel="nofollow noopener noreferrer">@Qualifier</a></td><td style="width: 49.9288%; height: 136.75px;">Associates a value with a particular argument. More finely tuned way than @Order and @Priority to control selection.</td></tr><tr style="height: 79.1562px;"><td style="width: 49.9288%; height: 79.1562px;"><a href="https://docs.spring.io/spring/docs/current/spring-framework-reference/html/beans.html#beans-definition-profiles" target="_blank" rel="nofollow noopener noreferrer">@Profile</a></td><td style="width: 49.9288%; height: 79.1562px;">Indicates that a component is eligible for registration when one or more specified profiles are active. You can also use @Profile({"default"}) to define a default profile, if no Profile is actively selected.</td></tr><tr style="height: 50.3594px;"><td style="width: 49.9288%; height: 50.3594px;"> </td><td style="width: 49.9288%; height: 50.3594px;"> </td></tr><tr style="height: 50.3594px;"><td style="width: 49.9288%; height: 50.3594px;"> </td><td style="width: 49.9288%; height: 50.3594px;"> </td></tr><tr style="height: 50.3594px;"><td style="width: 49.9288%; height: 50.3594px;"> </td><td style="width: 49.9288%; height: 50.3594px;"> </td></tr></tbody></table><p><br><br></p></div><footer class="wrapper post__footer"><p class="post__last-updated">This article was updated on April 4, 2023</p><ul class="post__tag"><li><a href="https://www.finecloud.ch/tags/java/">java</a></li><li><a href="https://www.finecloud.ch/tags/softwareentwicklung/">software development</a></li><li><a href="https://www.finecloud.ch/tags/spring/">spring</a></li><li><a href="https://www.finecloud.ch/tags/spring-framework/">spring-framework</a></li></ul><div class="post__share"></div></footer></article><nav class="post__nav"><div class="post__nav-inner"><div class="post__nav-prev"><svg width="1.041em" height="0.416em" aria-hidden="true"><use xlink:href="https://www.finecloud.ch/assets/svg/svg-map.svg#arrow-prev"/></svg> <a href="https://www.finecloud.ch/conventional-commits.html" class="post__nav-link" rel="prev"><span>Previous</span> Conventional commits</a></div><div class="post__nav-next"><a href="https://www.finecloud.ch/spring-bean-lifecycle.html" class="post__nav-link" rel="next"><span>Next</span> Spring Bean Lifecycle </a><svg width="1.041em" height="0.416em" aria-hidden="true"><use xlink:href="https://www.finecloud.ch/assets/svg/svg-map.svg#arrow-next"/></svg></div></div></nav><div class="post__related related"><div class="wrapper"><h2 class="h5 related__title">You should also read:</h2><article class="related__item"><div class="feed__meta"><time datetime="2023-05-03T20:46" class="feed__date">Mai 3, 2023</time></div><h3 class="h1"><a href="https://www.finecloud.ch/spring-boot-on-kubernetes.html">Spring Boot on Kubernetes</a></h3></article><article class="related__item"><div class="feed__meta"><time datetime="2023-05-02T21:45" class="feed__date">Mai 2, 2023</time></div><h3 class="h1"><a href="https://www.finecloud.ch/building-spring-boot-docker-images.html">Building Spring Boot Docker Images</a></h3></article><article class="related__item"><div class="feed__meta"><time datetime="2023-04-10T08:36" class="feed__date">April 10, 2023</time></div><h3 class="h1"><a href="https://www.finecloud.ch/spring-exception-handling.html">Spring Exception Handling</a></h3></article></div></div></main><footer class="footer"><div class="footer__copyright"><p>Powered by Publii</p></div><button onclick="backToTopFunction()" id="backToTop" class="footer__bttop" aria-label="Back to top" title="Back to top"><svg><use xlink:href="https://www.finecloud.ch/assets/svg/svg-map.svg#toparrow"/></svg></button></footer></div><script>window.publiiThemeMenuConfig = {
mobileMenuMode: 'sidebar',
animationSpeed: 300,
submenuWidth: 'auto',
doubleClickTime: 500,
mobileMenuExpandableSubmenus: true,
relatedContainerForOverlayMenuSelector: '.top',
};</script><script defer="defer" src="https://www.finecloud.ch/assets/js/scripts.min.js?v=6ca8b60e6534a3888de1205e82df8528"></script><script>var images = document.querySelectorAll('img[loading]');
for (var i = 0; i < images.length; i++) {
if (images[i].complete) {
images[i].classList.add('is-loaded');
} else {
images[i].addEventListener('load', function () {
this.classList.add('is-loaded');
}, false);
}
}</script><script defer="defer" src="https://www.finecloud.ch/media/plugins/syntaxHighlighter/prism.js"></script></body></html>