Name Last Update
..
config Loading commit data...
templates Loading commit data...
README.md Loading commit data...
logback.xml Loading commit data...

framework-archetype-webapp

运营平台项目骨架

一、项目结构说明:

└─src ├─main
├─java
├─com.glsx.config 配置层
├─com.glsx.controller 控制层 ├─com.glsx.vo 视图对象 ├─com.glsx.service 业务层 ├─com.glsx.Main.java 程序入口 └─com.glsx.WebMvcConfigurer.java MVC拦截器配置类 ├─resources 资源文件目录 ├─config
├─application.properties 应用配置文件
├─templates 模板目录 └─.flt freemarker模板,(可用于邮件模板) └─logback.xml 日志配置文件 └─webapp web前端文件目录 ├─static 静态文件 ├─css 样式文件 ├─images 图片文件 └─js JavaScript文件 └─common 公共js文件 ├─views └─model 模块文件夹 └─.html 视图文件 └─WEB-INF └─bin shell脚本文件(包含启动、停止、重启等) └─test 测试目录 ├─java
└─com.glsx/service 测试代码 └─resources 测试资源目录 └─pom.xml pom文件

二、使用说明: 1、运行项目前需在配置中心创建配置信息,配置内容参考三配置说明: 1.1> dataId : application.properties --> ore.diamond.dataId + ore.diamond.env 1.2> group : application.properties --> ore.diamond.group 1.3> content : 参考三配置说明

三、配置说明: #----------------------------------------------------------------------------------------------------------

适配器配置

ore.adapter.enabled=true

是否开启请求日志拦截器

ore.adapter.request-log-interceptor=enabled

是否开启跨域访问

ore.adapter.cross-domain=enabled

#----------------------------------------------------------------------------------------------------------

dubbo配置

dubbo应用名称

ore.dubbo.application.name=open-platform-admin

dubbo应用所有者

ore.dubbo.application.owner=deployer name

dubbo服务注册地址

ore.dubbo.registry.address=zookeeper://192.168.3.206:2181

dubbo服务注册超时时间

ore.dubbo.registry.timeout=30000

默认协议:dubbo

ore.dubbo.protocol.name=dubbo

dubbo服务扫描包路径

ore.dubbo.scan=com.glsx

dubbo服务监控

ore.dubbo.monitor.protocol=registry

dubbo服务统计

ore.dubbo.consumer.filter=metrics #----------------------------------------------------------------------------------------------------------

Freemarker模板配置

模板存放路径

spring.freemarker.template-loader-path=classpath:/templates/

是否开启模板缓存,默认是开启,开发时请关闭

spring.freemarker.cache=false

模板的编码设置,默认UTF-8

spring.freemarker.charset=UTF-8

是否检测模板已存在本地

spring.freemarker.check-template-location=true

模板的媒体类型设置,默认为text/html

spring.freemarker.content-type=text/html spring.freemarker.expose-request-attributes=true spring.freemarker.expose-session-attributes=true spring.freemarker.request-context-attribute=request

后缀设置,默认为.ftl

spring.freemarker.suffix=.ftl

   ┌------------------------------------------------------------┐
                        注:如需使用freemarker需在pom中添加如下依赖                                                                                                 
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-freemarker</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>*</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
   └------------------------------------------------------------┘

#----------------------------------------------------------------------------------------------------------

Thymeleaf模板配置

是否开启模板缓存,默认是开启,开发时请关闭

spring.thymeleaf.cache=true

是否检测模板已存在本地

spring.thymeleaf.check-template-location=true

模板的媒体类型设置,默认为text/html

spring.thymeleaf.content-type=text/html

模板开关

spring.thymeleaf.enabled=true

模板的编码设置,默认UTF-8

spring.thymeleaf.encoding=UTF-8

排除的视图

spring.thymeleaf.excluded-view-names=

模板模式设置,默认为HTML5严格检查;LEGACYHTML5更友好的格式,适用于Vue.js和AngularJs等js库

spring.thymeleaf.mode=HTML5

前缀设置,SpringBoot默认模板放置在classpath:/templates/目录下

spring.thymeleaf.prefix=/views/

后缀设置,默认为.html

spring.thymeleaf.suffix=.html

   ┌----------------------------------------------------------------------------------------┐
                        注:如需使用thymeleaf需在pom中添加如下依赖,且需排除thymelear对springboot的依赖,否则引起包冲突,导致diamond配置不加载                                                                                          
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>*</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>nz.net.ultraq.thymeleaf</groupId>
        <artifactId>thymeleaf-layout-dialect</artifactId>
    </dependency>
   └----------------------------------------------------------------------------------------┘

#----------------------------------------------------------------------------------------------------------

上传文件大小配置

spring.http.multipart.max-file-size=5MB spring.http.multipart.max-request-size=5MB

#----------------------------------------------------------------------------------------------------------

开启swagger api 文档生成功能

ore.swagger.base-package=com.glsx

   ┌----------------------------------------------------------------------------------------┐
                        注:如需使用swagger需在pom中添加如下依赖                                                                                          
    <dependency>
        <groupId>org.oreframework.boot</groupId>
        <artifactId>ore-boot-starter-swagger</artifactId>
    </dependency>
   └----------------------------------------------------------------------------------------┘

swagger注解说明: @Api:修饰整个类,描述Controller的作用 @ApiOperation:描述一个类的一个方法,或者说一个接口 @ApiParam:单个参数描述 @ApiModel:用对象来接收参数 @ApiProperty:用对象接收参数时,描述对象的一个字段 @ApiResponse:HTTP响应其中1个描述 @ApiResponses:HTTP响应整体描述 @ApiIgnore:使用该注解忽略这个API @ApiError :发生错误返回的信息 @ApiImplicitParam:一个请求参数 @ApiImplicitParams:多个请求参数

#----------------------------------------------------------------------------------------------------------

分布式文件系统FastDFS配置

tracker服务地址列表(格式ip1:host1,ip2:host2......)

ore.fastdfs.tracker-servers=common.fdfs.glsx.com:22122

文件访问域名

ore.fastdfs.server-url=http://qcimg01.glsx.net:7060/

   ┌------------------------------------------------------------┐
            使用说明:
    1、在pom中添加如下依赖                                                                                                 
    <dependency>
        <groupId>org.oreframework.boot</groupId>
        <artifactId>ore-boot-starter-fastdfs</artifactId>
    </dependency>

    2、注入调用客户端
    @Autowired
    private DefaultFastDFSClient fastDFSClient;

    3、调用上传
    String fastDFSClient.uploadFile(byte[] fileContent, String extName)
   └------------------------------------------------------------┘