栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Springboot创建子父工程过程图解

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Springboot创建子父工程过程图解

这篇文章主要介绍了Springboot创建子父工程过程图解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下

1.创建子父工程

2.添加pom配置文件

2.1 父工程pom.xml


 4.0.0
 com.demo
 springboot
 0.0.1-SNAPSHOT
 pom
 
   springboot-server
   springboot-common
   springboot-domain
   springboot-sdk
 
 
 
 
    UTF-8
    1.8
    1.5.9.RELEASE
    4.3.13.RELEASE
    1.7.25
    1.2.8
    3.1
    2.5
    1.9.3
    1.11
    19.0
  

  
    
      
 org.springframework.boot
 spring-boot-starter-tomcat
 ${spring.boot.version}
      

      
 org.springframework.boot
 spring-boot-starter-actuator
 ${spring.boot.version}
      

      
 org.springframework.boot
 spring-boot-starter-web
 ${spring.boot.version}
      
      
 org.springframework
 spring-context
 ${spring.version}
      

      
 org.springframework
 spring-core
 ${spring.version}
      

      
 com.alibaba
 fastjson
 ${fastjson.version}
      


      
 org.apache.commons
 commons-lang3
 ${commons.lang.version}
      

      
 commons-io
 commons-io
 ${commons.io.version}
      
      
 commons-beanutils
 commons-beanutils
 ${commons.beanutils.version}
      
      
 commons-codec
 commons-codec
 ${commons.codec.version}
      

      
 com.google.guava
 guava
 ${guava.version}
      
    
  

  
    
      org.springframework.boot
      spring-boot-starter-test
      ${spring.boot.version}
      test
    
    
      org.slf4j
      slf4j-api
      ${slf4j.version}
    
  

  
    
      nexus-releases
      Nexus Release Repository
      http://ip:9090/repository/releases/
    
    
      nexus-snapshots
      Nexus Snapshot Repository
      http://ip:9090/repository/snapshots/
    
  

  
    
      
 org.apache.maven.plugins
 maven-compiler-plugin
 3.1
 
   ${build.jdk.version}
   ${build.jdk.version}
 
      

      
      
 org.sonarsource.scanner.maven
 sonar-maven-plugin
 3.2
      
    
  
  

2.2 子工程springboot-server pom.xml:


 4.0.0
 
  com.demo
  springboot
  0.0.1-SNAPSHOT
 
 springboot-server
 
 springboot-server
 
    com.demo.Application
  
  
    
      org.springframework.boot
      spring-boot-starter-tomcat
    

    
      org.springframework.boot
      spring-boot-starter-actuator
    

    
      org.springframework.boot
      spring-boot-starter-web
    
    
      com.alibaba
      fastjson
    

    
      org.apache.commons
      commons-lang3
    

    
      commons-io
      commons-io
    
    
      commons-beanutils
      commons-beanutils
    
    
      commons-codec
      commons-codec
    
    
      com.google.guava
      guava
    

    
      net.sf.ehcache
      ehcache
      2.10.5
    
  

  
    src/main/java
    
      
 src/main/resources
 true
 
   *.properties
   *.yml
   *.xml
 
      
      
 src/main/resources
 false
 
   scripts

package com.demo;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {
  private static final Logger LOG = LoggerFactory.getLogger(Application.class);

  public static void main(String[] args) {
    SpringApplication app = new SpringApplication(Application.class);
    app.setBannerMode(Banner.Mode.OFF);
    app.setWebEnvironment(true);
    app.run(args);
    LOG.info("**************** Startup Success ****************");
  }
}

4.application.yml配置文件

version: ${project.version}

server:
 port: 7070
 session-timeout: 0
 context-path: /

5.测试controller类

package com.demo.server.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TestController {
  
  @RequestMapping("/helloworld")
  public String hello(String name) {
    return "name"+name;
  }

}

springboot子父项目启动成功。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/135121.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号