切换菜单
搜索
个人笔记云
首页
java
spring
springmvc
python
使用教程
笔记管理
搜索
登录/注册
好物分享
退出
搜索
第2章 构建springboot工程 2-2 使用Spring官方STS搭建SpringBoot工程
2021-09-30
747
**参考视频教程:** [**全方位深入解析最新版SpringBoot源码 **](http://www.notescloud.top/goods/detail/1303) ![第2章 构建springboot工程 2-2 使用Spring官方STS搭建SpringBoot工程_maven](images/4394/1633000596813.png) ![第2章 构建springboot工程 2-2 使用Spring官方STS搭建SpringBoot工程_java_02](images/4394/1633000596984.png) ![第2章 构建springboot工程 2-2 使用Spring官方STS搭建SpringBoot工程_tomcat_03](images/4394/1633000597033.png) ![第2章 构建springboot工程 2-2 使用Spring官方STS搭建SpringBoot工程_tomcat_04](images/4394/1633000597165.png)![第2章 构建springboot工程 2-2 使用Spring官方STS搭建SpringBoot工程_apache_05](images/4394/1633000597212.png) ![第2章 构建springboot工程 2-2 使用Spring官方STS搭建SpringBoot工程_maven_06](images/4394/1633000597315.png) ***项目名demo,SpringBoot的版本2.0.6*** ![第2章 构建springboot工程 2-2 使用Spring官方STS搭建SpringBoot工程_java_07](images/4394/1633000597387.png)![第2章 构建springboot工程 2-2 使用Spring官方STS搭建SpringBoot工程_apache_08](images/4394/1633000597415.png) ![第2章 构建springboot工程 2-2 使用Spring官方STS搭建SpringBoot工程_java_09](images/4394/1633000597494.png) ![第2章 构建springboot工程 2-2 使用Spring官方STS搭建SpringBoot工程_java_10](images/4394/1633000597854.png) ![第2章 构建springboot工程 2-2 使用Spring官方STS搭建SpringBoot工程_spring_11](images/4394/1633000598129.png) ![第2章 构建springboot工程 2-2 使用Spring官方STS搭建SpringBoot工程_java_12](images/4394/1633000598458.png) ***删了/demo/mvnw和/demo/mvnw.cmd。static文件夹包含静态文件,比如CSS、JS。templates文件夹是放模板的,SpringBoot官方推荐的模板是使用thymeleaf,SSM使用freemarker比较多。国产的Beetl也可以放到templates文件夹里面。*** ***删掉/demo/src/test的内容,pom.xml删掉这一段*** 登录后复制 ```
org.springframework.boot
spring-boot-starter-test
test
``` ***运行/demo/src/main/java/com/example/demo/DemoApplication.java*** 登录后复制 ``` . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.0.6.RELEASE) 2018-10-27 05:21:21.096 INFO 19680 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication on DESKTOP-S07DGSI with PID 19680 (G:\eclipse-workspace\demo\target\classes started by ZHONGZHENHUA in G:\eclipse-workspace\demo) 2018-10-27 05:21:21.104 INFO 19680 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to default profiles: default 2018-10-27 05:21:21.308 INFO 19680 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@7d68ef40: startup date [Sat Oct 27 05:21:21 CST 2018]; root of context hierarchy 2018-10-27 05:21:25.219 INFO 19680 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2018-10-27 05:21:25.315 INFO 19680 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2018-10-27 05:21:25.316 INFO 19680 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.34 2018-10-27 05:21:25.341 INFO 19680 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jre1.8.0_144\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_144/bin/server;C:/Program Files/Java/jre1.8.0_144/bin;C:/Program Files/Java/jre1.8.0_144/lib/amd64;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\libnvvp;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\libnvvp;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;D:\BaiduNetdiskDownload\adt-bundle-windows-x86_64_20140101\adt-bundle-windows-x86_64_20140101\sdk\platform-tools;D:\BaiduNetdiskDownload\adt-bundle-windows-x86_64_20140101\adt-bundle-windows-x86_64_20140101\sdk\platform-tools;C:\Program Files\Java\jdk1.8.0_144\bin;C:\Program Files\Java\jdk1.8.0_144\jre\bin;I:\数据库\数据库3\mysql-5.7.21-winx64\mysql-5.7.21-winx64\bin;H:\NDK\android-ndk-r9d-windows-x86_64\android-ndk-r9d;D:\Users\ZHONGZHENHUA\Anaconda3\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Users\ZHONGZHENHUA\Server\maven\apache-maven-3.5.2\bin;C:\Program Files\TortoiseGit\bin;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA GPU Computing Toolkit\cudnn\bin;D:\Users\ZHONGZHENHUA\Anaconda3\Scripts;C:\Program Files\NVIDIA GPU Computing Toolkit\cudnn\bin;C:\ProgramData\NVIDIA GPU Computing Toolkit\v9.0;C:\Users\ZHONGZHENHUA\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\ProgramData\NVIDIA GPU Computing Toolkit\v8.0;C:\Users\ZHONGZHENHUA\AppData\Local\Microsoft\WindowsApps;C:\Users\ZHONGZHENHUA\AppData\Roaming\npm;D:\Wind\Wind.NET.Client\WindNET\bin\;G:\eclipse-jee-2018-09-win32-x86_64\eclipse;;.] 2018-10-27 05:21:25.599 INFO 19680 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2018-10-27 05:21:25.599 INFO 19680 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4296 ms 2018-10-27 05:21:25.830 INFO 19680 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/] 2018-10-27 05:21:25.840 INFO 19680 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2018-10-27 05:21:25.841 INFO 19680 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2018-10-27 05:21:25.841 INFO 19680 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2018-10-27 05:21:25.841 INFO 19680 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2018-10-27 05:21:26.137 INFO 19680 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-10-27 05:21:26.457 INFO 19680 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@7d68ef40: startup date [Sat Oct 27 05:21:21 CST 2018]; root of context hierarchy 2018-10-27 05:21:26.786 INFO 19680 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity
> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2018-10-27 05:21:26.790 INFO 19680 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2018-10-27 05:21:26.889 INFO 19680 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-10-27 05:21:26.892 INFO 19680 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-10-27 05:21:27.412 INFO 19680 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2018-10-27 05:21:27.573 INFO 19680 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2018-10-27 05:21:27.582 INFO 19680 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 7.287 seconds (JVM running for 8.204) ``` ***因为没有配置controler,所以它运行了一遍就关掉了。*** ***/demo/pom.xml*** 登录后复制 ```
4.0.0
com.example
demo
0.0.1-SNAPSHOT
war
demo
Demo project for Spring Boot
org.springframework.boot
spring-boot-starter-parent
2.0.6.RELEASE
UTF-8
UTF-8
1.8
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-tomcat
provided
org.springframework.boot
spring-boot-maven-plugin
```
教程分类
热门视频教程
热门文章
热门书籍推荐