• Springboot分模块开发详解(1):建立父工程


    基础服务,见下:

    image

    base是父工程,base-entity是实体层,base-dao是DAO层,base-service是业务层,base-controller是WEB控制器层,base-web是页面层。

    base ,base-entity,base-dao,base-servic,base-controllere是MAVEN工程,先建立base,后面几个在base基础上建立maven module工程。

    base:
    image

    image

    image

    image

    image

    这样父工程已经建立好了,再修改。

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>net.common</groupId>
        <artifactId>base</artifactId>
        <version>1.0.0</version>
        <packaging>pom</packaging>
    
        <name>base</name>
        <url>http://maven.apache.org</url>
    
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.5.6.RELEASE</version>
            <relativePath /> <!-- lookup parent from repository -->
        </parent>
    
    
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <shiro.version>1.3.2</shiro.version>
        </properties>
    
        <dependencies>
    
            <!-- thymeleaf -->
            <dependency>
                <groupId>org.thymeleaf</groupId>
                <artifactId>thymeleaf</artifactId>
                <version>3.0.6.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.thymeleaf</groupId>
                <artifactId>thymeleaf-spring4</artifactId>
                <version>3.0.6.RELEASE</version>
            </dependency>
    
            <!-- web -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
    
            <!-- 日志 -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </dependency>
    
            <!-- mybatis -->
            <dependency>
                <groupId>org.mybatis.spring.boot</groupId>
                <artifactId>mybatis-spring-boot-starter</artifactId>
                <version>1.3.0</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.tomcat</groupId>
                        <artifactId>tomcat-jdbc</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.apache.tomcat</groupId>
                        <artifactId>tomcat-juli</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    
            <!-- 数据库 -->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid</artifactId>
                <version>1.1.0</version>
            </dependency>             
            
            <!-- 嵌入式tomcat与测试框架 -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
    
        </dependencies>
        <modules>
            <module>base-entity</module>
            <module>base-mapper</module>
            <module>base-service</module>
            <module>base-web</module>
        </modules>
    </project>

    请照图修改:

    image

    image

    image

    POM.xml中依赖关系配置,请各自取舍!

    这样父工程已经建立好了!

  • 相关阅读:
    关于Token
    利用Chrome模拟访问移动端网页
    文件上传
    final修饰符
    后台返回字符串类型function的处理 (递归算法)
    javascript typeof
    单点登录的原理与简单实现
    response.setHeader()的用法
    UML类图6种关系的总结
    子类父类属性的覆盖(继承)
  • 原文地址:https://www.cnblogs.com/huiy/p/7209965.html
Copyright © 2020-2023  润新知