spring boot 多模块简单示例

  • 时间:
  • 浏览:1
  • 来源:uu快3开奖_uu快3娱乐_输钱

在main文件夹下创建resources文件夹,并打上去文件

spring-boot-mult-module项目下配置spring-boot的依赖。

能只能有一种生活最好的土办法来引入spring-boot

you can create application.properties under resources in web module.

项目逻辑

直接打上去parent,继承spring-boot的pom依赖

数据库配置

then configure your filter in your ApplicationConfig.java

if you want to use another port ,

web api,与前端交互

本例中用的是method-1,完正的pom.xml如下:

reference: https://springframework.guru/jackson-dependency-issue-spring-boot-maven/

数据库实体类 User

now, you dao module's structure may look like this:

项目右键-> 新建module.

项目特征look like this

finally, the structure of dao module may look like this:

run your application and you will see the filter is load.

then run all the tests and check the database to see whether or not the insert test is successful.

then, each file's content are follow:

and add the follow property to change server port

包下新建MyBatisConfig.java

if occur ==IllegalStateException: No supported DataSource type found== error

reference: https://stackoverflow.com/questions/31942908/spring-boot-application-with-hive-connection-doesnt-start-embedded-tomcat

reference: http://www.jianshu.com/p/05c8be17c60 a

数据库操作

mybatis配置

mybatis xml文件

the default port of tomcat server is 60 60 ,

if you want to add some filter in you web application

最近花了多日看spring-boot.简单记录下SpringBoot的多模块示例

创建接口

这里不还可不可否 注意的,spring-boot肯能打上去了什么都依赖的包,肯能你想使用不同版本的库,我让你用来移除,或者打上去此人 版本的库

项目有如下一另兩个模块

make sure the dependency of commons-dbcp, or tomcat-jdbc or hikaricp in your pom.xml file

reference: http://www.jianshu.com/p/69b9fbb97574

github: https://github.com/jjzhu-ncu/bg-study/tree/master/spring-boot/spring-boot-mult-module

now, you want to use another version of jackson, you can add the follow dependency in you pom.xml

一另兩个项目中用到了hive和hadoop,在用spring-boot搭个任务导入平台的之后,启动的之后报错了

define your filter

或多或少是肯能hadoop中的servlet-api的版本和spring-boot中的版本冲突了

hadoop中的是 2.5,而spring-boot中的是3.1,什么都在pom.xml加入如下配置

dao模块是用来操作数据库的,创建包

for example:

the version of jackson in spring-boot-1.5.4.RELEASE is

肯能你项目涵盖或多或少的父类,就只能用method-1中的继承了,什么都 我让你什么都 来管理spring-boot的依赖

reference: https://stackoverflow.com/questions/34790924/i-am-getting-datasource-not-supported-when-using-datasoucebuilder