idea 多模块 html,IntelliJ IDEA 搭建 Spring Boot Maven 多模块项目 亲测

IntelliJ IDEA 搭建 Spring Boot Maven 多模块项目

1.1 创建父项目

7a0d52a6dd923af228f357fc7bc899f5.png

d44aef43e71918c9c702903d2b38a8b8.png

aa5e2c935d595d4936fe022f065aa901.png

ff5488973be0b3712657bc0fa01ff7fb.png

3efead11e0d1152b11108335aab541c5.png

1.2 父项目创建完需手动删除 src 目录

beb84240cd7518010d182d1fb9137a3c.png

2.1 父级项目 mutiple-project 配置 pom.xml

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0

com.mutiple

mutiple-project

1.0-SNAPSHOT

pom

http://www.example.com

UTF-8

1.8

1.8

1.5.19.RELEASE

org.springframework.boot

spring-boot-starter-parent

1.5.19.RELEASE

io.spring.platform

platform-bom

Brussels-SR16

pom

import

org.springframework.boot

spring-boot-dependencies

${spring-boot.version}

pom

import

javax.servlet

javax.servlet-api

4.0.1

provided

net.sourceforge.nekohtml

nekohtml

1.9.22

org.thymeleaf.extras

thymeleaf-extras-springsecurity3

3.0.4.RELEASE

org.springframework.boot

spring-boot-maven-plugin

${spring-boot.version}

repackage

3.1 创建子级 Web 模块, 一般用于业务入口

8b62c08062658f9345a31386a4c71821.png

d162af58c0f4e2b0afb652f9b161a92d.png

1ef145531c379fa82aef7ebd46f807dd.png

f86e6e4e364fcfffc828a60fe5f1ab7e.png

3.2 删除模块内 webapp 目录

93a7e6d591abe5cb5263cdfd4a7875b7.png

3.3 java, resources 如没有需要手动生成,之后需手动设置为 IntelliJ IDEA 认的之源目录

aea53341d79b5d2473da5d7754842327.png

1e884e3c551932820cc50ec4a15cb0f5.png

475c246ba40ae4d2386318ef1ccd5d4b.png

4. 子级模块 mutiple-web

4.1 配置 pom.xml

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

mutiple-project

com.mutiple

1.0-SNAPSHOT

4.0.0

com.mutiple

mutiple-web

jar

mutiple-web Maven Webapp

http://www.example.com

org.springframework.boot

spring-boot-starter-web

net.sourceforge.nekohtml

nekohtml

org.thymeleaf.extras

thymeleaf-extras-springsecurity3

org.springframework.boot

spring-boot-starter-thymeleaf

javax.servlet

javax.servlet-api

provided

mutiple-web

org.springframework.boot

spring-boot-maven-plugin

4.2 resources 目录内创建环境文件 application.properties

#HTML Templete

spring.thymeleaf.mode=LEGACYHTML5

spring.thymeleaf.cache=false

spring.thymeleaf.check-template=true

spring.thymeleaf.check-template-location=true

spring.thymeleaf.prefix=classpath:public/

spring.thymeleaf.content-type=text/html

spring.thymeleaf.suffix=.html

spring.thymeleaf.encoding=UTF-8

4.3 resources 目录内创建目录 public 再生成 test.html 文件 (用于测试)

Hello World!!

4.4 创建 Controller

package com.mutiple;

import com.mutiple.service.DateUtil;

import org.springframework.stereotype.Controller;

import org.springframework.ui.Model;

import org.springframework.web.bind.annotation.*;

@Controller

public class TestController {

@RequestMapping("/test")

public String test(Model model) {

return "test";

}

}

4.5 创建启动文件

package com.mutiple;

import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;

import org.springframework.context.annotation.ComponentScan;

@ComponentScan(basePackages = {"com.mutiple"})

@SpringBootApplication

public class App {

public static void main(String[] args) {

SpringApplication.run(App.class, args);

}

}

4.6 启动项目

b9275d25861022fad60df3bdbb9e0e35.png

6c121b281b85f874dc9d661ef1d52373.png

标签:IntelliJ,Spring,boot,springframework,thymeleaf,mutiple,Boot,spring,org

来源: https://blog.csdn.net/qcl108/article/details/100703768

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值