Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz4j Spring R7
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7后台标准模板
iBiz4j Spring R7
提交
d9e17b05
提交
d9e17b05
编写于
10月 24, 2021
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
项目支持打war包
上级
8b1491fc
变更
5
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
272 行增加
和
3 行删除
+272
-3
pom.xml.ftl
SLN/%PUBPRJ%-app/%PUBPRJ%-app-%APP_PKGPATH%/pom.xml.ftl
+80
-2
%APP%Initializer.java.ftl
...ava/%SYS_PKGPATH%/%APP_PKGPATH%/%APP%Initializer.java.ftl
+30
-0
NacosRegisterConfig.java.ftl
...YS_PKGPATH%/core/util/config/NacosRegisterConfig.java.ftl
+91
-0
pom.xml.ftl
...%-provider/%PUBPRJ%-provider-%SYSAPI_PKGPATH%/pom.xml.ftl
+42
-1
%SYS%%API%Initializer.java.ftl
..._PKGPATH%/%SYSAPI_PKGPATH%/%SYS%%API%Initializer.java.ftl
+29
-0
未找到文件。
SLN/%PUBPRJ%-app/%PUBPRJ%-app-%APP_PKGPATH%/pom.xml.ftl
浏览文件 @
d9e17b05
...
...
@@ -15,6 +15,7 @@ TARGET=PSSYSAPP
<artifactId>${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}</artifactId>
<name>${pub.getCodeName()?lower_case?cap_first} Gateway ${app.getPKGCodeName()}</name>
<description>${pub.getCodeName()?lower_case?cap_first} ${app.getPKGCodeName()}</description>
<packaging>${r'${project.packaging}'}</packaging>
<dependencies>
<dependency>
...
...
@@ -31,11 +32,12 @@ TARGET=PSSYSAPP
</#if>
</dependencies>
<#if pub.getPSDeployCenter()?? && pub.getPSDeployCenter().getPSRegistryRepo()??>
<properties>
<project.packaging>jar</project.packaging>
<#if pub.getPSDeployCenter()?? && pub.getPSDeployCenter().getPSRegistryRepo()??>
<docker.image.prefix>${pub.getPSDeployCenter().getPSRegistryRepo().getConnStr()}</docker.image.prefix>
</properties>
</#if>
</properties>
<profiles>
...
...
@@ -160,6 +162,82 @@ TARGET=PSSYSAPP
</plugins>
</build>
</profile>
<profile>
<id>${app.getPKGCodeName()?lower_case}-war</id>
<properties>
<project.packaging>war</project.packaging>
</properties>
<build>
<resources>
<resource>
<directory>${r'${basedir}'}/src/main/webapp</directory>
<!--注意此次必须要放在此目录下才能被访问到 -->
<targetPath>META-INF/resources</targetPath>
<includes>
<include>**/**</include>
</includes>
</resource>
<resource>
<directory>${r'${basedir}'}/src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>exec-yarn-run-install</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>yarn</executable>
<workingDirectory>../../app_${app.getPKGCodeName()}</workingDirectory>
</configuration>
</execution>
<execution>
<id>exec-yarn-run-build</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>yarn</executable>
<arguments>
<argument>build</argument>
</arguments>
<workingDirectory>../../app_${app.getPKGCodeName()}</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}</finalName>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
<mainClass>${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case}.${app.getPKGCodeName()}Application</mainClass>
<outputDirectory>../../</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
...
...
SLN/%PUBPRJ%-app/%PUBPRJ%-app-%APP_PKGPATH%/src/main/java/%SYS_PKGPATH%/%APP_PKGPATH%/%APP%Initializer.java.ftl
0 → 100644
浏览文件 @
d9e17b05
<#
ibiztemplate
>
TARGET
=
PSSYSAPP
</#
ibiztemplate
>
<#
assign
packageType
=
""
>
<#
if
app
.
getPSDCMSPlatform
()??>
<#
assign
appPlatform
=
app
.
getPSDCMSPlatform
()>
<#
if
appPlatform
.
getUserParam
(
"ibiz.deploy.packagetype"
,
""
)??>
<#
assign
packageType
=
appPlatform
.
getUserParam
(
"ibiz.deploy.packagetype"
,
""
)>
</#
if
>
</#
if
>
<#
if
packageType
!=''>
package
${
pub
.
getPKGCodeName
()}.${
app
.
getPKGCodeName
()?
lower_case
};
import
lombok
.
extern
.
slf4j
.
Slf4j
;
import
org
.
springframework
.
boot
.
builder
.
SpringApplicationBuilder
;
import
org
.
springframework
.
boot
.
web
.
servlet
.
support
.
SpringBootServletInitializer
;
/**
*
提供外部容器启动服务能力
*/
@
Slf4j
public
class
${
app
.
getPKGCodeName
()}
Application
extends
SpringBootServletInitializer
{
@
Override
protected
SpringApplicationBuilder
configure
(
SpringApplicationBuilder
builder
)
{
log
.
info
(
"--正在使用外部容器启动服务--"
);
return
builder
.
sources
(${
app
.
getPKGCodeName
()}
Application
.
class
);
}
}
</#
if
>
\ No newline at end of file
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/util/config/NacosRegisterConfig.java.ftl
0 → 100644
浏览文件 @
d9e17b05
<#
ibiztemplate
>
TARGET
=
PSSYSTEM
</#
ibiztemplate
>
<#
assign
packageType
=
""
>
<#
comment
>
前端应用微服务平台配置
</#
comment
>
<#
if
sys
.
getAllPSDevSlnMSDepApps
()??>
<#
list
sys
.
getAllPSDevSlnMSDepApps
()
as
depApp
>
<#
if
depApp
.
getPSDCMSPlatform
()??>
<#
assign
appPlatform
=
depApp
.
getPSDCMSPlatform
()>
<#
if
appPlatform
.
getUserParam
(
"ibiz.deploy.packagetype"
,
""
)??>
<#
assign
packageType
=
appPlatform
.
getUserParam
(
"ibiz.deploy.packagetype"
,
""
)>
</#
if
>
<#
break
>
</#
if
>
</#
list
>
</#
if
>
<#
comment
>
服务接口微服务平台配置
</#
comment
>
<#
if
sys
.
getAllPSDevSlnMSDepAPIs
()??>
<#
list
sys
.
getAllPSDevSlnMSDepAPIs
()
as
depSysApi
>
<#
if
depSysApi
.
getPSDCMSPlatform
()??
>
<#
assign
sysApiPlatform
=
depSysApi
.
getPSDCMSPlatform
()>
<#
if
sysApiPlatform
.
getUserParam
(
"ibiz.deploy.packagetype"
,
""
)??>
<#
assign
packageType
=
sysApiPlatform
.
getUserParam
(
"ibiz.deploy.packagetype"
,
""
)>
</#
if
>
<#
break
>
</#
if
>
</#
list
>
</#
if
>
<#
if
packageType
!=''>
package
${
pub
.
getPKGCodeName
()}.
core
.
util
.
config
;
import
com
.
alibaba
.
cloud
.
nacos
.
registry
.
NacosAutoServiceRegistration
;
import
com
.
sa
.
ajgl
.
util
.
errors
.
BadRequestAlertException
;
import
lombok
.
extern
.
slf4j
.
Slf4j
;
import
org
.
springframework
.
beans
.
factory
.
annotation
.
Autowired
;
import
org
.
springframework
.
beans
.
factory
.
annotation
.
Value
;
import
org
.
springframework
.
boot
.
ApplicationArguments
;
import
org
.
springframework
.
boot
.
ApplicationRunner
;
import
org
.
springframework
.
stereotype
.
Component
;
import
org
.
springframework
.
util
.
ObjectUtils
;
import
org
.
springframework
.
util
.
StringUtils
;
import
javax
.
management
.
MBeanServer
;
import
javax
.
management
.
ObjectName
;
import
javax
.
management
.
Query
;
import
java
.
lang
.
management
.
ManagementFactory
;
import
java
.
util
.
Set
;
/**
*
外部容器启动服务时,自动注册服务到
nacos
*/
@
Component
@
Slf4j
public
class
NacosRegisterConfig
implements
ApplicationRunner
{
@
Autowired
(
required
=
false
)
private
NacosAutoServiceRegistration
registration
;
@
Value
(
"${r'${server.port:8080}'}"
)
Integer
port
;
@
Override
public
void
run
(
ApplicationArguments
args
)
{
if
(
registration
!= null && port != null) {
try
{
String
containerPort
=
getContainerPort
();
if
(
!StringUtils.isEmpty(containerPort)){
log
.
info
(
"正在尝试将应用程序注册到nacos,端口号为:{}"
,
containerPort
);
registration
.
setPort
(
new
Integer
(
containerPort
));
registration
.
start
();
}
}
catch
(
Exception
e
)
{
throw
new
BadRequestAlertException
(
"应用程序注册到nacos失败,"
+
e
,
""
,
""
);
}
}
}
/**
*
获取外部容器端口
*/
public
String
getContainerPort
()
throws
Exception
{
String
port
=
null
;
MBeanServer
beanServer
=
ManagementFactory
.
getPlatformMBeanServer
();
Set
<
ObjectName
>
objectNames
=
beanServer
.
queryNames
(
new
ObjectName
(
"*:type=Connector,*"
),
Query
.
match
(
Query
.
attr
(
"protocol"
),
Query
.
value
(
"HTTP/1.1"
)));
if
(
!ObjectUtils.isEmpty(objectNames)){
port
=
objectNames
.
iterator
().
next
().
getKeyProperty
(
"port"
);
}
return
port
;
}
}
</#
if
>
\ No newline at end of file
SLN/%PUBPRJ%-provider/%PUBPRJ%-provider-%SYSAPI_PKGPATH%/pom.xml.ftl
浏览文件 @
d9e17b05
...
...
@@ -15,6 +15,7 @@ TARGET=PSSYSSERVICEAPI
<artifactId>${pub.getCodeName()?lower_case}-provider-${api.getCodeName()?lower_case}</artifactId>
<name>${pub.getCodeName()?lower_case?cap_first} Microservice ${api.getCodeName()}</name>
<description>${pub.getMemo()?default(pub.getName())} ${api.getName()}</description>
<packaging>${r'${project.packaging}'}</packaging>
<dependencies>
<dependency>
...
...
@@ -26,9 +27,12 @@ TARGET=PSSYSSERVICEAPI
<#if pub.getPSDeployCenter()?? && pub.getPSDeployCenter().getPSRegistryRepo()??>
<properties>
<project.packaging>jar</project.packaging>
<#if pub.getPSDeployCenter()?? && pub.getPSDeployCenter().getPSRegistryRepo()??>
<docker.image.prefix>${pub.getPSDeployCenter().getPSRegistryRepo().getConnStr()}</docker.image.prefix>
</#if>
</properties>
</#if>
<profiles>
<profile>
...
...
@@ -118,6 +122,43 @@ TARGET=PSSYSSERVICEAPI
</plugins>
</build>
</profile>
<profile>
<id>${item.codeName?lower_case}-war</id>
<properties>
<project.packaging>war</project.packaging>
</properties>
<build>
<resources>
<resource>
<directory>${r'${basedir}'}/src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>${pub.getCodeName()?lower_case}-provider-${item.codeName?lower_case}</finalName>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
<mainClass>${pub.getPKGCodeName()}.${item.codeName?lower_case}.${sys.codeName}${item.codeName}Application</mainClass>
<outputDirectory>../../</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
SLN/%PUBPRJ%-provider/%PUBPRJ%-provider-%SYSAPI_PKGPATH%/src/main/java/%SYS_PKGPATH%/%SYSAPI_PKGPATH%/%SYS%%API%Initializer.java.ftl
0 → 100644
浏览文件 @
d9e17b05
<#
ibiztemplate
>
TARGET
=
PSSYSSERVICEAPI
</#
ibiztemplate
>
<#
assign
packageType
=
""
>
<#
if
item
.
getPSDCMSPlatform
()??
>
<#
assign
sysApiPlatform
=
item
.
getPSDCMSPlatform
()>
<#
if
sysApiPlatform
.
getUserParam
(
"ibiz.deploy.packagetype"
,
""
)??>
<#
assign
packageType
=
sysApiPlatform
.
getUserParam
(
"ibiz.deploy.packagetype"
,
""
)>
</#
if
>
</#
if
>
<#
if
packageType
!=''>
package
${
pub
.
getPKGCodeName
()}.${
item
.
codeName
?
lower_case
};
import
lombok
.
extern
.
slf4j
.
Slf4j
;
import
org
.
springframework
.
boot
.
builder
.
SpringApplicationBuilder
;
import
org
.
springframework
.
boot
.
web
.
servlet
.
support
.
SpringBootServletInitializer
;
/**
*
提供外部容器启动服务能力
*/
@
Slf4j
public
class
${
sys
.
codeName
}${
item
.
codeName
}
Initializer
extends
SpringBootServletInitializer
{
@
Override
protected
SpringApplicationBuilder
configure
(
SpringApplicationBuilder
builder
)
{
log
.
info
(
"--正在使用外部容器启动服务--"
);
return
builder
.
sources
(${
sys
.
codeName
}${
item
.
codeName
}
Application
);
}
}
</#
if
>
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录