Anotación @SpringBootApplication

En Spring Boot, es muy común que se apliquen múltiples anotaciones sobre la clase principal (main). Pero comúnmente, la mayoría de desarrolladores, aplican principalmente 3 anotaciones.

  • @Configuration: Disponible a partir de la versión 3 de Spring, nos ofrece la posibilidad de realizar una notación que será la encargada de definir a la clase que lo posea como una clase de configuración. Esta configuración para el framework de Spring, estará basada en anotaciones. Y no como en sus orígenes, que estaba basada en XML, lo que lo hacía más complejo. La finalidad de dicha anotación también será el permitir realizar la inyección de dependencias.
  • @EnableAutoConfiguration: La configuración automática de Spring Boot, intenta configurar automáticamente su aplicación Spring en función de las dependencias jar que haya agregado. Si por ejemplo, si HSQLDB (sistema gestor de bases de datos) está en su ruta de clase y no ha configurado manualmente ningún bean de conexión de base de datos, Spring Boot configura automáticamente una base de datos en memoria.
  • @ComponentScan: Se utiliza junto a @Configuration para indicar a Spring donde debe buscar los componentes y será dentro del package que tenemos anotado. Por solo tener que anotarla una vez, poder hacer que todos los packages sean hijos del package de la clase padre (el que contenga el main).

Es podría ser un ejemplo de la clase principal (main) de nuestro proyecto con las 3 anotaciones:

package com.restfull.core;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableAutoConfiguration
@ComponentScan
public class Javadesde0Application {

	public static void main(String[] args) {
		SpringApplication.run(Javadesde0Application.class, args);
	}

}

La gran mayoría de desarrolladores de Spring Boot, suelen tener en su clase principal (main) anotada con las anotaciones @Configuration, @EnableAutoConfiguration y @ComponentScan. Dado que estas anotaciones se combinan con tanta frecuencia, Spring Boot ofrece el substituir tener que declarar constantemente este tridente de anotaciones, por declarar únicamente una sola @SpringBootApplication que englobará a las 3 anteriores.

Lo más destacado aquí es la anotación @SpringBootApplication . Esto internamente es una combinación de las siguientes 3 anotaciones. Y en forma de resumen más simplificado realiza:

  • @Configuración: Necesaria para configuraciones de resorte manual. La adición de esta anotación garantiza que la configuración se puede realizar en una clase Java en lugar de usar un archivo xml separado.
  • @EnableAutoConfiguration: Spring necesita mucha configuración por hacer. Esta anotación asegura que gran parte de la configuración se realiza automáticamente.
  • @ComponentScan: Esto le dice a Spring, donde todos deben buscar componentes.

Los siguientes son los parámetros aceptados en la anotación @SpringBootApplication:

  • excluir: excluye la lista de clases de la configuración automática.
  • excludeNames: excluye la lista de nombres de clase totalmente calificados de la configuración automática. Este parámetro agregado desde Spring Boot 1.3.0.
  • scanBasePackageClasses: proporcione la lista de clases que se deben aplicar para @ComponentScan.
  • scanBasePackages: Proporciona la lista de paquetes que se deben aplicar para @ComponentScan. Este parámetro agregado desde el arranque de primavera 1.3.0.

Actualmente, al realizar un proyecto este es el que nos viene por defecto, y por tanto, es el que nosotros tenemos en nuestro proyecto. Está podría ser un ejemplo de la clase principal (main) de nuestro proyecto con la anotación que engloba a las 3 anotaciones anteriores:

package com.restfull.core;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Javadesde0Application {

	public static void main(String[] args) {
		SpringApplication.run(Javadesde0Application.class, args);
	}

}

De hecho, si paramos nuestro ratón sobre el @SpringBootApplication de nuestra aplicación, podemos verificar lo que acabamos de comentar. E incluso clickar sobre ellos y ampliar algo más la información.

146 comentarios

  1. This is my first time visit at here and i am truly happy to
    read all at one place.

  2. You are so interesting! I do not think I’ve truly read anything like
    that before. So wonderful to find somebody with unique thoughts on this topic.
    Seriously.. thank you for starting this up. This
    site is something that is needed on the internet,
    someone with a little originality!

    my site; Hyper XXL

  3. I used to be able to find good information from your articles.

    my page – http://www.sygk100.cn

  4. Just wanna input that you have a very decent web site, I love the style
    it really stands out.

    Here is my website: Synaptic IQ

  5. Awesome issues here. I am very happy to see your post.
    Thank you a lot and I’m having a look ahead to contact
    you. Will you kindly drop me a e-mail?

    Feel free to visit my web page :: Luiresse Review

  6. Pretty component of content. I just stumbled upon your site and in accession capital to assert that I acquire actually loved account your blog posts.
    Any way I will be subscribing for your feeds or
    even I fulfillment you get right of entry to constantly quickly.

  7. Hi, I do think this is a great website. I stumbledupon it 😉
    I may come back once again since I book-marked it.
    Money and freedom is the best way to change, may you be rich
    and continue to help other people.

  8. Aw, this was an incredibly good post. Taking a
    few minutes and actual effort to generate a great article?
    but what can I say? I hesitate a whole lot and don’t seem to
    get anything done.

    Feel free to surf to my web page Vialis Male Enhancement Formula

  9. Please let me know if you’re looking for a
    author for your site. You have some really good posts and I feel I would be a
    good asset. If you ever want to take some of the load off, I’d
    absolutely love to write some material for your blog in exchange for a link
    back to mine. Please send me an email if interested.
    Cheers!

    Also visit my web blog … Tetra Male Infusion

  10. Oh my goodness! Amazing article dude! Thank you so much, However
    I am going through problems with your RSS. I don’t understand the reason why I can’t subscribe to it.

    Is there anybody else getting similar RSS issues? Anyone that knows
    the answer will you kindly respond? Thanx!!

  11. You really make it seem so easy with your presentation but I find this topic to be actually something which
    I think I would never understand. It seems too complex and very broad for me.
    I’m looking forward for your next post, I will try to get the hang of it!

  12. You have brought up a very good points, regards for the
    post.

    my web site Insights CBD Review (ecs300.net)

  13. Nice respond in return of this issue with genuine arguments
    and explaining everything on the topic of that.

  14. We are a bunch of volunteers and starting a new scheme in our community.
    Your site provided us with useful information to work on. You’ve
    performed an impressive task and our whole neighborhood
    will be grateful to you.

    Here is my blog post; Ketorol [Pamela]

  15. I ɑlwsys sѕpent my half an hour to rеad this blօg’s
    posts daily along with a mug of coffee.

    Here is my homepage – pasar taruhan bola hari ini Taruhanbol

  16. Wow, incredible blog layout! How long have you been running a blog for?
    you make blogging look easy. The entire look of your web site is excellent, let alone
    the content material![X-N-E-W-L-I-N-S-P-I-N-X]I
    just couldn’t leave your site prior to suggesting that I
    really enjoyed the usual info an individual supply on your guests?

    Is going to be back often in order to investigate cross-check new posts.

    My webpage :: Natural Burn Keto Ingredients

  17. Loving the information on this internet site, you have done
    great job on the articles.

    Also visit my web page … Far East XL

  18. I do accept as true with all of the ideas you’ve offered for your post.
    They are very convincing and will definitely work.
    Nonetheless, the posts are very brief for starters. Could you please lengthen them a little from subsequent time?
    Thanks for the post.

  19. Hi, i believe that i noticed you visited my weblog
    so i got here to go back the want?.I’m trying to to
    find things to enhance my site!I suppose its good enough to use a few of your concepts!!

  20. I am glad to be a visitant of this stark website, thank you for this rare info!

    Feel free to visit my homepage :: http://www.diclelife.com

  21. I am curious to find out what blog system you are
    using? I’m having some minor security issues with my
    latest website and I would like to find something more safeguarded.
    Do you have any recommendations?

    my web page – Viking XL Keto

  22. Hey there, You have done a fantastic job. I’ll definitely digg it and
    in my view suggest to my friends. I’m confident they’ll be
    benefited from this site.

    my web site – IceHouse Portable AC

  23. I could not resist commenting. Perfectly written!

    my web blog Infinuity CBD Gummies

  24. It’s very trouble-free to find out any matter on net as compared
    to textbooks, as I found this article at this web page.

  25. It is perfect time to make some plans for the longer term and it’s time to be happy.

    I have learn this submit and if I may I want to counsel you few attention-grabbing issues or suggestions.
    Perhaps you could write next articles relating to this article.

    I wish to read even more issues approximately it!

    My blog post; Moscatcher

  26. Some times its a pain in the ass to read what blog owners wrote but this site is very user friendly!

    Also visit my blog Summer Valley CBD Gummies

  27. Neat blog! Is your theme custom made or did you download it from
    somewhere? A theme like yours with a few simple tweeks would really make my blog stand out.
    Please let me know where you got your design. Kudos

    Here is my site; Eagle CBD Gummies (http://www.fles.hlc.edu.tw)

  28. I regard something truly interesting about
    your weblog so I saved to my bookmarks.

    my web-site; http://www.wizardhardware.com

  29. If you would like to obtain much from this post then you have to apply such strategies to your
    won website.

    Feel free to visit my web blog; Luiresse Review

  30. Loving the info on this web site, you have done great job on the articles.

    Here is my webpage Pamala

  31. I love it when individuals get together and share thoughts.

    Great website, stick with it!

    my blog post :: Arctos Portable AC [librarius.main.jp]

  32. I don’t know if it’s just me or if everybody else experiencing issues with your blog.
    It appears as if some of the written text on your
    content are running off the screen. Can someone else please comment and let me
    know if this is happening to them too? This may be a issue with
    my web browser because I’ve had this happen previously.
    Cheers

    my site … Biodermeux Reviews

  33. Appreciate this post. Will try it out.

    Also visit my blog post: http://www.goldenanapa.ru

  34. Excellent blog! Do you have any suggestions for aspiring writers?
    I’m planning to start my own site soon but I’m a little lost
    on everything. Would you propose starting with a free platform like WordPress or go for
    a paid option? There are so many choices out there that I’m totally overwhelmed ..
    Any recommendations? Cheers!

    Take a look at my web-site – Bio Shed Keto Slim – http://www.hotelforrest.ru/

  35. Excellent post. Keep posting such kind of info on your site.

    Im really impressed by your blog.
    Hey there, You have done a great job. I will definitely digg it
    and individually suggest to my friends. I am confident they will be benefited
    from this site.

  36. You need to be a part of a contest for one of the most useful blogs on the internet.
    I am going to recommend this website!

  37. I wanted to thank you for this fantastic read!! I certainly loved every
    bit of it. I have you book marked to look at new
    things you post…

  38. This information is priceless. When can I find out more?

    Check out my web-site :: Hyper XXL Male Enhancement

  39. Thanks for your marvelous posting! I certainly enjoyed reading it,
    you can be a great author.I will make sure to
    bookmark your blog and will come back from now on. I
    want to encourage you to definitely continue your great
    posts, have a nice weekend!

    Also visit my webpage http://agrocase.ru/index.php?action=profile;u=137597

  40. I have been exploring for a little for any high quality articles or weblog posts
    in this kind of space . Exploring in Yahoo I eventually stumbled upon this web site.
    Reading this information So i am glad to show that I have an incredibly good uncanny feeling I found out exactly what I needed.
    I so much certainly will make certain to do not disregard
    this web site and provides it a glance regularly.

  41. Hi there! This post couldn’t be written any better! Reading through this post
    reminds me of my good old room mate! He always kept chatting about this.
    I will forward this post to him. Fairly certain he will have a good read.
    Many thanks for sharing!

    my web page :: Optimum Keto (Lakesha)

  42. WOW just what I was looking for. Came here by searching for weight loss
    tool

    Feel free to visit my website … aniene.net

  43. Hi there, I enjoy reading through your article post. I like to write a little comment
    to support you.

    Here is my web page – Colon Broom

  44. I’m really enjoying the design and layout of your site. It’s a very easy on the eyes
    which makes it much more enjoyable for me to come here
    and visit more often. Did you hire out a designer to create your theme?
    Excellent work!

    Here is my web page :: Wawza Apple Cider Gummies

  45. I used to be suggested this web site by means of
    my cousin. I’m no longer positive whether this publish is written via him as no one else know such distinctive approximately my problem.

    You are amazing! Thanks!

  46. Wow, awesome blog layout! How lengthy have you ever been running a blog for?
    you make blogging glance easy. The entire look of your web site is
    magnificent, let alone the content!

    Visit my blog post; Max BHB

  47. Enjoyed reading this, very good stuff, thanks.

    Here is my web site TetraMale Reviews (Melvin)

  48. I think that is one of the so much vital information for me.
    And i am happy reading your article. But should
    remark on some common things, The site taste is wonderful,
    the articles is truly nice : D. Excellent task, cheers

    Also visit my web blog … Keto Secret

  49. Hello there, just became alert to your blog through Google, and found that it’s truly informative.

    I?m gonna watch out for brussels. I will appreciate if you continue this in future.

    Lots of people will be benefited from your writing. Cheers!

    Here is my web site … Primiene

  50. It’s a shame you don’t have a donate button! I’d certainly donate to this fantastic blog!
    I suppose for now i’ll settle for book-marking and adding your RSS feed to my
    Google account. I look forward to new updates and will talk about
    this blog with my Facebook group. Talk soon!

    Visit my web page Luiresse Skin Cream

  51. I visited many websites but the audio feature for audio songs current at this web site is actually wonderful.

  52. I think other web site proprietors should take this website
    as an model, very clean and wonderful user genial style and design,
    let alone the content. You’re an expert in this topic!

    Have a look at my blog post: http://astravo.net.ru

  53. thank you for this post, I am a big fan of this web site would like to continue updated.

    Also visit my blog post – Testo Bull Review

  54. Real nice layout and great subject matter, very little else we need :
    D.

    Feel free to surf to my blog … Glacier Air Cooler Reviews

  55. Terrific article! This is the type of info that are supposed to
    be shared around the web. Disgrace on Google for now not positioning this publish
    higher! Come on over and discuss with my site . Thank you =)

  56. Hello.This article was extremely remarkable, especially since I was investigating for thoughts on this
    issue last Sunday.

    my website :: Brilliance Keto Reviews

  57. Wow, this piece of writing is pleasant, my sister is analyzing
    these kinds of things, so I am going to inform her.

    Also visit my website Cogni360 Review

  58. Marvelous, what a web site it is! This webpage gives useful facts to us, keep it
    up. quest bars http://j.mp/3jZgEA2 quest bars

  59. Anotación @SpringBootApplication – Java desde 0
    ttogpbowq http://www.gft09g3ntrp76kg933691s9osqb587r6s.org/
    [url=http://www.gft09g3ntrp76kg933691s9osqb587r6s.org/]uttogpbowq[/url]
    attogpbowq

  60. Thank you for each of your labor on this web page. Debby really loves engaging in internet research and it’s easy to understand why.
    A lot of people hear all about the powerful manner you create powerful steps by means of
    the web blog and as well as improve participation from website visitors on this area and our favorite girl is without
    question becoming educated a whole lot. Enjoy the rest
    of the year. Your doing a fabulous job.[X-N-E-W-L-I-N-S-P-I-N-X]I’m really inspired along with your
    writing talents as smartly as with the format to your blog.
    Is that this a paid topic or did you modify it your self?
    Either way stay up the nice high quality writing,
    it’s uncommon to peer a great weblog like this one these days.

    My blog post: healthy meal plans

  61. Do you have a spam problem on this website; I also am a blogger,
    and I was wanting to know your situation; many of
    us have created some nice methods and we are looking to swap solutions with other folks, be sure to
    shoot me an e-mail if interested.

  62. If I roll once and you roll twice. What does that mean?

  63. How can I get NFT and mint for free Where can I sell my NFT art What is the advantage of DApps Can I sell my paintings
    as NFT

  64. how to gift an nft Can I receive NFT on trust wallet
    What can I sell as an NFT How do I access my NFT wallet

  65. Can I buy a Walmart gift card for someone in Canada?
    How can I claim voucher in Foodpanda?

    GreatShopNet http://greatshopnet.com 5% OFF COUPON CODE: AH-2938

    Can UNiDAYS codes only be used once? coupons ralph lauren

  66. Generally I do not learn post on blogs, however I would like to say that this write-up very pressured me to take a look at and do so! Your writing style has been surprised me. Thank you, quite nice article.
    here are some links to web-sites that we link to mainly because we consider they may be really worth visiting

  67. Ich war sehr an der Fettabsaugung interessiert, vielen Dank, dass Sie meine Bedenken ausführlich beantwortet haben. href=»https://www.clinic-bellerive.ch/de/behandlungen/gesicht/augen/oberlidstraffung/»>oberlidstraffung

  68. Noví hráči v kasinu BitStarz získají přístup k uvítacímu bonusovému balíčku na své první 4 vklady až do výše 500 € nebo až 5 BTC plus 180 bonusových roztočení.

  69. F*ckin¦ amazing things here. I¦m very glad to see your article. Thank you a lot and i am taking a look forward to contact you. Will you please drop me a e-mail?

  70. F*ckin¦ awesome things here. I am very happy to peer your post. Thank you a lot and i am taking a look ahead to contact you. Will you kindly drop me a e-mail?

  71. Quality articles is the main to be a focus for the people to pay a visit
    the website, that’s what this website is providing.

    Visit my blog post :: coupon

  72. prednisone 10 mg tablets: http://prednisone1st.store/# prednisone 1 mg tablet

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

La Ley 34/2002 nos obliga a avisarte de que usamos cookies propias y de terceros con objetivos estadísticos y de sesión y para mostrarte la 'publi' que nos da de comer. Tranquilo, este mensaje solo sale una vez. Más información

Java desde 0 comunica a los usuarios, a través de este aviso, que puede utilizar cookies cuando el usuario navega por las diferentes pantallas y páginas del sitio. Durante el uso de nuestra página Web usted acepta y autoriza expresamente el uso de cookies, de acuerdo con nuestra Política de Privacidad. Este sitio web utiliza las siguientes cookies propias: - Cookies de sesión, para garantizar que los usuarios que escriban comentarios en el blog sean humanos y no aplicaciones automatizadas. De esta forma se combate el spam. Este sitio web utiliza las siguientes cookies de terceros: - Google AdManager y AdSense: Utiliza cookies para mejorar la publicidad. Entre otros fines, suelen utilizarse para segmentarla según el contenido que sea relevante para los usuarios o su ubicación, mejorar los informes de rendimiento de las campañas y evitar mostrar anuncios que los usuarios ya hayan visto. Las cookies no contienen información personal identificable. Consulta cómo utiliza Google la información de sitios web o aplicaciones. y cómo bloquear determinados anuncios. - Google Analytics: Almacena cookies para poder elaborar estadísticas sobre el tráfico y volumen de visitas de esta web. Al utilizar este sitio web está consintiendo el tratamiento de información acerca de usted por Google. Por tanto, el ejercicio de cualquier derecho en este sentido deberá hacerlo comunicando directamente con Google. - Redes sociales: Cada red social utiliza sus propias cookies para que usted pueda pinchar en botones del tipo Me gusta o Compartir.

Cerrar