From 9d46fdf3ebc7cd9e00f2321b7df09347a28ef298 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Fri, 8 Mar 2019 01:43:32 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8D=95=E9=9B=86=E6=88=90=20spring?= =?UTF-8?q?=20boot=20admin=20=EF=BC=8C=E5=8D=B3=20ops=20=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/admin-application/pom.xml | 21 +++++++++++ .../admin/application/AdminApplication.java | 7 ++-- .../application/config/MVCConfiguration.java | 2 ++ .../src/main/resources/application.yaml | 12 ++++++- .../config/GlobalExceptionHandler.class | Bin 4797 -> 4776 bytes .../common/framework/util/ExceptionUtil.class | Bin 1741 -> 1738 bytes .../common/framework/util/HttpUtil.class | Bin 1080 -> 1077 bytes .../framework/util/ServiceExceptionUtil.class | Bin 3917 -> 3911 bytes ops/pom.xml | 34 ++++++++++++++++++ .../cn/iocoder/mall/ops/OpsApplication.java | 15 ++++++++ pom.xml | 1 + 11 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 ops/pom.xml create mode 100644 ops/src/main/java/cn/iocoder/mall/ops/OpsApplication.java diff --git a/admin/admin-application/pom.xml b/admin/admin-application/pom.xml index 10b1a2f9e..0a52ffe9d 100644 --- a/admin/admin-application/pom.xml +++ b/admin/admin-application/pom.xml @@ -92,6 +92,27 @@ 1.0-SNAPSHOT + + + + + + + + + + + + + de.codecentric + spring-boot-admin-starter-client + 2.1.3 + + + org.springframework.boot + spring-boot-starter-actuator + + diff --git a/admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/AdminApplication.java b/admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/AdminApplication.java index 5aeb5de0f..76f90ad1f 100644 --- a/admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/AdminApplication.java +++ b/admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/AdminApplication.java @@ -2,14 +2,15 @@ package cn.iocoder.mall.admin.application; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.ConfigurableApplicationContext; @SpringBootApplication(scanBasePackages = {"cn.iocoder.mall.admin"}) +//@EnableAdminServer public class AdminApplication { public static void main(String[] args) { - ConfigurableApplicationContext ctx = SpringApplication.run(AdminApplication.class, args); - System.out.println(); // TODO 后面去掉,这里是临时的 + SpringApplication.run(AdminApplication.class, args); +// ConfigurableApplicationContext ctx = +// System.out.println(); // TODO 后面去掉,这里是临时的 } } \ No newline at end of file diff --git a/admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/config/MVCConfiguration.java b/admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/config/MVCConfiguration.java index fe9bebbf4..19806637b 100644 --- a/admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/config/MVCConfiguration.java +++ b/admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/config/MVCConfiguration.java @@ -26,6 +26,8 @@ public class MVCConfiguration implements WebMvcConfigurer { .excludePathPatterns("/admins/passport/login"); // 排除登陆接口 } + + @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { // 解决 swagger-ui.html 的访问,参考自 https://stackoverflow.com/questions/43545540/swagger-ui-no-mapping-found-for-http-request 解决 diff --git a/admin/admin-application/src/main/resources/application.yaml b/admin/admin-application/src/main/resources/application.yaml index a37e6a54f..68f4f820b 100644 --- a/admin/admin-application/src/main/resources/application.yaml +++ b/admin/admin-application/src/main/resources/application.yaml @@ -1,9 +1,19 @@ spring: application: name: admin-application + boot: + admin: + client: + url: http://127.0.0.1:8080 # server server: port: 18083 servlet: - context-path: /admin-api/ \ No newline at end of file + context-path: /admin-api/ + +management: + endpoints: + web: + exposure: + include: "*" \ No newline at end of file diff --git a/common/common-framework/target/classes/cn/iocoder/common/framework/config/GlobalExceptionHandler.class b/common/common-framework/target/classes/cn/iocoder/common/framework/config/GlobalExceptionHandler.class index 6ddcea436ee3d76e0f737c19abe1792d6347d6a0..c107f3b30d2a691d3594291f9308e4f29aecbde4 100644 GIT binary patch delta 501 zcmW-eNl%ke6o#K`hudBbr6DoI1S-)qfw-uNBnB1^#04sKo<+0@6cqW&*E$cyS#jp7 zIN&_7Feau86B9LT{RRF7|Ag^g7v~*L&U?<{e9z8itH1t!`vG(?YiMP?VI{pD@`ep; z)ND$y*$`ukVHH~&-RSN*_OLfeAN!1he#3qa_z@TG^SKxW4+jm07%(hk(5oS@iXMhF zBR+mO!I2ijsLzaY)VIbG1a*|iYsNLEa9m@AjUk+I@XSg@aUXJ(p7h3e8g z7M`$3c>2F#G|v>BwvcR|QZ2O=iD?y?;ko^tY>vH9w71zg$=apySZ%TCiNs$DuXtz2 z>$}tk`>Fm<^rIqc=Te#4*Hk&8lwH!;yF5ydd&WH0l5-qKvCi>ZSH|hryyp!I*yg-A Lznus>*vYPc&|+hy delta 448 zcmW-d%TJS06vTg*(%$xRfG2&6w(;POAwjE+c;yz`^V4SGuA!X{!#O%F>$2>gg`}q2 z)_a2Vo;9RwC&hhh^#ys5Lq8Ro0nOl#^|9>iAx%0H@gJxH&5-brN5W&CXr2ngjJSUT z7emjyj4;ZW8`Gz*j5|Ef5AecaLU_q5&1+$jDa{+nMl&nSF)zGhL2&KjqOioW zP(rD&!h3gC*A%WYtx)BfHQ@ur!up9}G#@j^`cOqa@mWz&5>F=5iC9k})fua7O}4iU zUMj7#=Wb+BaKw=aCU Z=&NTL6kF`F%^B)EEuOB&M*}x${15KiTWA0P diff --git a/common/common-framework/target/classes/cn/iocoder/common/framework/util/ExceptionUtil.class b/common/common-framework/target/classes/cn/iocoder/common/framework/util/ExceptionUtil.class index 1e4f270e0bb69919983f60bb128d8f51c4a6fdc6..77088bbdea16b09d5a19d1ec6981cc689092308b 100644 GIT binary patch delta 102 zcmX@hdy3cK)W2Q(7#J8#7>u|WxENH}8C1C#I2qKq7?>E;*%>sr7+4uJ*%`Fh8MN6M zbl4emHyZdbG3rfjV0y}|&tNb)gV})DkilT{Z01xZM%KxUY+}p`42qMb*w(Ns0gYv1 GPzC_L{t+|) delta 110 zcmX@bdzRPW)W2Q(7#J8#7>v0XxENH~8PvEKI2qKr7?>C|*cmjr7+4v!*cr6h8Fbhg zblDm7HX8UavFHP3Cf71OWiwzfWMt5ue4A05m50HI!Eo~o=2Rv|g~|U|#h4WtlqQR_ NtzlON8qdU_0su~H6EXk* diff --git a/common/common-framework/target/classes/cn/iocoder/common/framework/util/HttpUtil.class b/common/common-framework/target/classes/cn/iocoder/common/framework/util/HttpUtil.class index 28657f652fe97198131e0a8d0238de5634c2b4fc..b9d62df2b00f77b35cdbbbf3adfd18cfa6557bfe 100644 GIT binary patch delta 112 zcmdnNv6aK*)W2Q(7#J8#7%aFLxESO)7!`->WbC_VfG#v~Z`Xq`!nJ2D}Usv>37&7DhCqjA_Q1&;?;q zn9^vbg&B>Tkj4=95V6gyJu&BDURbaji(aBE*~zliViqeFaSy9fMnbd3y0D?Cq5tvz zvsiUHX;)Ws($GMop_xrXiY-NXEV3O5#3PAlAec%nC!)f(p^Y73*RaRF^X&>%9I$Vw zBdsVp$QUvlI$?L%pXEq6w)%UuE jFbV~E+7TuEWvY->=BfQ3I$x#Ls>jh~9nxF)YY~0FUPM8c delta 385 zcmY+A$uC1u6vlrKeYb9}5H=D)EF>1B5iAH|Wo53RYIvTht)b=`+M4H~7Vj?+I}2Nh z#NQ#7{sDFG!ouQw=R4o|&dJGntNN%qdjENO1)6!3lrdCD1)%`Lj2IX-FeV5~#)(KK zn3UQuC76~-9Knpl#+4{${mhwS-mF;gvnYs~iCBO*OQy4IY%2y<4J7=miDK3z8*B=; zB$W(3Wj_l + + + mall-parent + cn.iocoder.mall + 1.0-SNAPSHOT + + 4.0.0 + + ops + + + + + de.codecentric + spring-boot-admin-starter-server + 2.1.3 + + + de.codecentric + spring-boot-admin-server-ui + 2.1.3 + + + + org.springframework.boot + spring-boot-starter-web + + + + + \ No newline at end of file diff --git a/ops/src/main/java/cn/iocoder/mall/ops/OpsApplication.java b/ops/src/main/java/cn/iocoder/mall/ops/OpsApplication.java new file mode 100644 index 000000000..81a335d4c --- /dev/null +++ b/ops/src/main/java/cn/iocoder/mall/ops/OpsApplication.java @@ -0,0 +1,15 @@ +package cn.iocoder.mall.ops; + +import de.codecentric.boot.admin.server.config.EnableAdminServer; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +@EnableAdminServer +public class OpsApplication { + + public static void main(String[] args) { + SpringApplication.run(OpsApplication.class, args); + } + +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 2b71f2742..ad7f52cfe 100644 --- a/pom.xml +++ b/pom.xml @@ -19,6 +19,7 @@ user common admin + ops pom