SpringBoot在无网络的环境下创建项目 然后在java文件夹中新建一个包用于存放启动类,如果直接在src下创建启动类运行中可能会出现错误,在新建的包里面创建启动类 然后在之前创建的包下面创建放控制器的文件夹controller,并新建一个控制器类 在resource下可以新建两个文件夹static和templates用于存房静态资源和页面,另新建一个application.yml或application.properties配置文件 项目结构如下 运行启动类
 首先创建一个maven项目,在pom.xml中引用相关依赖<!--  如有parent需要替换成Springboot的parent  --> <parent>         <groupId>org.springframework.boot</groupId>         <artifactId>spring-boot-starter-parent</artifactId>         <version>2.2.6.RELEASE</version>         <relativePath/> <!-- lookup parent from repository --> </parent> <!--  如需要war包这里jar改成war  --> <packaging>jar</packaging>  <properties>         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>         <java.version>1.8</java.version> </properties>  <dependencies>         <dependency>             <groupId>junit</groupId>             <artifactId>junit</artifactId>             <version>4.11</version>             <scope>test</scope>         </dependency>          <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-web</artifactId>         </dependency>            <!-- 视图模板(不是必须的,根据需求添加) -->         <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-thymeleaf</artifactId>         </dependency>         <!-- 解除模板强制验证(不是必须的,根据需求添加) -->         <dependency>             <groupId>net.sourceforge.nekohtml</groupId>             <artifactId>nekohtml</artifactId>             <version>1.9.21</version>         </dependency>          <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-test</artifactId>             <scope>test</scope>         </dependency>     </dependencies>      <build>         <plugins>             <plugin>                 <groupId>org.springframework.boot</groupId>                 <artifactId>spring-boot-maven-plugin</artifactId>             </plugin>         </plugins>     </build> package my;  import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;  @SpringBootApplication public class RunApplication {     public static void main(String[] args) {         SpringApplication.run(RunApplication.class, args);     } } package my.controller;  import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView;  @RestController public class TestController {     @RequestMapping(value = "/")     public ModelAndView index(){         return new ModelAndView("index");     }      @RequestMapping(value = "/api.html")     public String test(){         return "test";     } } 
 application.properties内容如下spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.mode=LEGACYHTML5 
 
 index.html内容如下<!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <title>Title</title> </head> <body>     1111<br>     <img src="1.jpg"> </body> </html> 
 
 
 完成!!!
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算
 官方软件产品操作指南 (170)
官方软件产品操作指南 (170)