In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Net programmer how to enter SpringBoot, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
Preface
How to get started with Spring Boot as a. Net programmer. You don't need to use Eclipse, nor do you need to use IDEA. I'm used to VS, other IDE. But I have to say that VS Code is very good. I like it as soon as I use it. Microsoft provides VS Code with plug-ins to write Java, and you can happily write Java on VS Code.
I. Environmental construction
(1) install Java and configure environment variables. (there are many tutorials, which will not be discussed here.)
(2) install Maven and configuration. Reference https://www.cnblogs.com/eagle6688/p/7838224.html
(3) install VS Code
(4) install the Java development plug-in and configure VS Code's Java development environment. (Microsoft simplifies this step for us. Download the Vs Code Java installer, install it directly and write Java code. Download and connect to http://aka.ms/vscode-java-installer-win. This installer can be run repeatedly.)
Second, build the Maven project
(1) visit http://start.spring.io/
(2) Select Maven Project, Java and Spring Boot version 2.1.6, as shown in the figure.
Click Generate the Project to download the project package
(3) Open this folder with VS Code after decompression
The officially recommended project structure in version 2.16 is as follows:
Structures like this are more often used at present:
3. Write the interface and enter Hello World
(1) add modules that support web to pom.xml, and then save
Org.springframework.bootspring-boot-starter-web
VS Code automatically downloads the module after saving, or you can right-click pom.xml and click Update project configuration to update the configuration manually.
There are two modules by default in the pom.xml file:
Spring-boot-starter: core modules, including autoconfiguration support, logging, and YAML, which can be removed if the spring-boot-starter-web web module is introduced, because spring-boot-starter-web automatically relies on spring-boot-starter.
Spring-boot-starter-test: test module, including JUnit, Hamcrest, Mockito.
(2) write Controller content
@ RestControllerpublic class HelloWorldController {@ RequestMapping ("/ hello") public String index () {return "HelloWorld";}}
@ begins with a comment from Spring
@ RestController means that all the methods in Controller are output in json format, so you don't have to write anything about jackjson configuration.
RequestMapping is used to map Web requests, including access paths and parameters, on classes or methods.
(3) debug, then add configuration, and automatically generate startup Java configuration file
Running and debugging
Browser access: http://localhost:8080/hello successfully output Hello World
Everything looks simple, and now you can happily write Spring Boot code in VS Code
After reading the above, have you mastered how .NET programmers can get started with 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: 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.