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

How to start the main function in a springboot project

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

In this article Xiaobian for you to introduce in detail "how to start the main function in the springboot project", the content is detailed, the steps are clear, the details are handled properly, I hope this "how to start the main function in the springboot project" article can help you solve your doubts, the following follows the editor's ideas slowly in depth, together to learn new knowledge.

Springboot project main function starts

Create a new appController class under the controller package

Package controller;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.boot.builder.SpringApplicationBuilder;import org.springframework.boot.web.support.SpringBootServletInitializer;@SpringBootApplicationpublic class appController extends SpringBootServletInitializer {public static void main (String [] args) {SpringApplication.run (appController.class,args);} @ Override protected SpringApplicationBuilder configure (SpringApplicationBuilder builder) {return builder.sources (appController.class);}} Test:

Create a new indexController

Create a new proController class

Start the main function in the appController class

Browser input: localhost:8080/proo

Browser input: localhost:8080/index

SpringBoot main method details @ SpringBootApplicationpublic class UdeamApplication {public static void main (String [] args) {SpringApplication.run (UdeamApplication.class, args);}} @ SpringBootApplication

Open the springboot configuration comments, project startup entry, which is used to start the spring container and start tomcat. Other packages must be in the same directory or subpackage with this class.

After reading this, the article "how to start the main function in the springboot project" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it yourself. If you want to know more about the article, you are welcome to follow the industry information channel.

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: 0

*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

Development

Wechat

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

12
Report