Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the exploration of Hello World Application in springboot

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

What is the exploration of Hello World Application in springboot? I believe many inexperienced people are at a loss about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

1. POM file 1. Parent project org.springframework.boot spring-boot-starter-parent 1.5.9.RELEASE spring-boot-starter-parent parent project: org.springframework.boot spring-boot-dependencies 1.5.9.RELEASE.. /.. / spring-boot-dependencies Spring-boot-dependencies really manages all dependent versions in the Spring Boot project

The version arbitration center of Spring Boot. Later, we do not need to write a version by default when we import dependencies (if there is no dependency in spring-boot-dependencies, we need to declare the version number)

two。 Imported dependent org.springframework.boot spring-boot-starter-web

Spring-boot-starter-web:

Spring-boot-starter: spring boot scene launcher

two。 Main program class, main entry class / * @ SpringBootApplication to mark a main program class, indicating that this is a Spring boot application * / @ SpringBootApplicationpublic class HelloWorldMainApplication {public static void main (String [] args) {/ / launch Spring application SpringApplication.run (HelloWorldMainApplication.class, args);}}

@ SpringBootApplication: SpringBoot application note, marked on a class indicating that this is the main entry class of the SpringBoot application. SpringBoot should run the main method of this class to start the application SpringBoot application.

@ SpringBootAppliation:

@ Target ({ElementType.TYPE}) @ Retention (RetentionPolicy.RUNTIME) @ Documented@Inherited@SpringBootConfiguration@EnableAutoConfiguration@ComponentScan (excludeFilters = {@ Filter (type = FilterType.CUSTOM, classes = {TypeExcludeFilter.class}), @ Filter (type = FilterType.CUSTOM, classes = {AutoConfigurationExcludeFilter.class}) public @ interface SpringBootApplication {@ AliasFor (annotation = EnableAutoConfiguration.class, attribute = "exclude") Class [] exclude () default {} @ AliasFor (annotation = EnableAutoConfiguration.class, attribute = "excludeName") String [] excludeName () default {}; @ AliasFor (annotation = ComponentScan.class, attribute = "basePackages") String [] scanBasePackages () default {}; @ AliasFor (annotation = ComponentScan.class, attribute = "basePackageClasses") Class [] scanBasePackageClasses () default {};}

@ SpringBootConfiguration:

The configuration class of SpringBoot, which is standard on a class, indicating that this is a configuration class of SpringBoot

@ Configuration: configuration class (configuration file)-- also a component Component

@ EnableAutoConfiguration:

Turn on automatic configuration function

After reading the above, have you mastered the method of exploring Hello World Application in springboot? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 251

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report