Springboot创建子父工程过程图解
这篇文章主要介绍了Springboot创建子父工程过程图解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
1.创建子父工程
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 NexusReleaseRepository http://ip:9090/repository/releases/ nexus-snapshots NexusSnapshotRepository http://ip:9090/repository/snapshots/ org.apache.maven.plugins maven-compiler-plugin 3.1 ${build.jdk.version} org.sonarsource.scanner.maven sonar-maven-plugin 3.2
2.2子工程springboot-serverpom.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/* *.properties *.yml *.xml src/main/resources/scripts ${project.build.directory}/bin true *.sh *.bat src/main/resources ${project.build.directory}/conf true *.properties *.yml *.xml lib ${project.build.directory}/lib org.apache.maven.plugins maven-jar-plugin 2.6 ${project.build.directory}/lib true lib/ *.xml *.yml *.properties org.apache.maven.plugins maven-dependency-plugin copy-dependencies package copy-dependencies ${project.build.directory}/lib maven-source-plugin 2.4 true ${project.build.directory} compile jar org.apache.maven.plugins maven-assembly-plugin dfrp-portal ${application.main.class} src/main/resources/scripts/assembly.xml ${project.name}-${version} package single
3.App启动类
/** *Copyright(c)2020,AllRightsReserved. * */ packagecom.demo; importorg.slf4j.Logger; importorg.slf4j.LoggerFactory; importorg.springframework.boot.Banner; importorg.springframework.boot.SpringApplication; importorg.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication publicclassApplication{ privatestaticfinalLoggerLOG=LoggerFactory.getLogger(Application.class); publicstaticvoidmain(String[]args){ SpringApplicationapp=newSpringApplication(Application.class); app.setBannerMode(Banner.Mode.OFF); app.setWebEnvironment(true); app.run(args); LOG.info("****************StartupSuccess****************"); } }
4.application.yml配置文件
version:${project.version} server: port:7070 session-timeout:0 context-path:/
5.测试controller类
packagecom.demo.server.controller; importorg.springframework.web.bind.annotation.RequestMapping; importorg.springframework.web.bind.annotation.RestController; @RestController publicclassTestController{ @RequestMapping("/helloworld") publicStringhello(Stringname){ return"name"+name; } }
springboot子父项目启动成功。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持毛票票。
声明:本文内容来源于网络,版权归原作者所有,内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:czq8825#qq.com(发邮件时,请将#更换为@)进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。