In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "springboot how to start direct access to the project address", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "springboot how to start direct access to the project address" this article.
Springboot initiates direct access to project address mode 1
Edit the startup class (my startup class is ApplicationBootstrap) = > go in and find the Add button at the mark in the figure
Select Launch Web Browser = > Select browser = > enter Open URL = > start the project after saving
Start the project. . .
Mode two
Springboot initiates direct access to the project address
This class can be placed one level lower than the springboot startup class. I usually create a config folder and put them together.
Package com.hbsc.config; import org.springframework.boot.CommandLineRunner;import org.springframework.stereotype.Component; / * * @ ClassName MyCommandRunner * @ Author: hanyong * @ CreateTime: 2019-01-28 * / @ Componentpublic class MyCommandRunner implements CommandLineRunner {@ Override public void run (String...) Args) {if (true) {String cmd = "C:\\ Program Files (x86)\\ Google\\ Chrome\\ Application\\ chrome.exe" + "+" http://localhost:8082"; Runtime run = Runtime.getRuntime (); try {run.exec (cmd);} catch (Exception e) {e.printStackTrace () } springboot operation cannot be accessed
If you encounter a problem in learning springBoot building, record it here so that you can check it for yourself later and give it to learners who encounter the same problem.
Create a springBoot project
Create Controler (control layer), Service (logic layer), Model (entity class), Dao (data layer) in the directory of springBoot
Project profile
Configured a mysql database connection information, access port number, encoding format, and mybatis configuration
The pom.xml file in the corresponding maven is as follows:
4.0.0 org.springframework.boot spring-boot-starter-parent 2.1.8.RELEASE com.example demo 0.0.1-SNAPSHOT springBoot Demo project for Spring Boot 1.8 org.springframework.boot spring-boot-starter-web org.springframework.boot Spring-boot-starter-test test org.mybatis.spring.boot mybatis-spring-boot-starter 1.1.1 mysql mysql-connector-java 5.1.30 org.mybatis.generator mybatis-generator -core 1.3.5 org.springframework.boot spring-boot-maven-plugin org.mybatis.generator mybatis-generator-maven-plugin 1.3.7 Src/main/resources/generatorConfig.xml true true Generate MyBatis Artifacts generate Org.mybatis.generator mybatis-generator-core 1.3.7 springBoot Startup Class configuration
Run, access http://localhost:8080/getUserById, report error
Org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
After checking for a long time, no problem was found. Later, after looking at the compiled file, I found that there was only the compiled file of mapper, and the xml file did not exist. I looked up the reason on the Internet and added it to the pom.xml file.
Src/main/java * * / .xml
Rerun to compile the xml file generation in the target folder. The visit was successful.
The above is all the contents of the article "how to enable springboot to access the project address directly". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, 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.
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.