SpringBoot2.1.1集成FineReport

在参考客服给的文档后,再加上自己的一些摸索,找到了可用的方法,记录一下。

环境说明:

  • SpringBoot 2.1.1.RELEASE
  • FineReport 10.0
  • Tomcat 9.0.13
  • java version "1.8.0_192"

集成步骤:

1. 安装jar包。官方文档 嵌入式部署 中指出所有‘fine’开头的jar包都是必须导入的。

call mvn install:install-file -Dfile=fine-accumulator-10.0.jar -DgroupId=com.fine -DartifactId=fine-accumulator -Dversion=10.0 -Dpackaging=jar
call mvn install:install-file -Dfile=fine-activator-10.0.jar -DgroupId=com.fine -DartifactId=fine-activator -Dversion=10.0 -Dpackaging=jar
call mvn install:install-file -Dfile=fine-core-10.0.jar -DgroupId=com.fine -DartifactId=fine-core -Dversion=10.0 -Dpackaging=jar
call mvn install:install-file -Dfile=fine-datasource-10.0.jar -DgroupId=com.fine -DartifactId=fine-datasource -Dversion=10.0 -Dpackaging=jar
call mvn install:install-file -Dfile=fine-decision-10.0.jar -DgroupId=com.fine -DartifactId=fine-decision -Dversion=10.0 -Dpackaging=jar
call mvn install:install-file -Dfile=fine-decision-report-10.0.jar -DgroupId=com.fine -DartifactId=fine-decision-report -Dversion=10.0 -Dpackaging=jar
call mvn install:install-file -Dfile=fine-report-engine-10.0.jar -DgroupId=com.fine -DartifactId=fine-report-engine -Dversion=10.0 -Dpackaging=jar
call mvn install:install-file -Dfile=fine-schedule-10.0.jar -DgroupId=com.fine -DartifactId=fine-schedule -Dversion=10.0 -Dpackaging=jar
call mvn install:install-file -Dfile=fine-schedule-report-10.0.jar -DgroupId=com.fine -DartifactId=fine-schedule-report -Dversion=10.0 -Dpackaging=jar
call mvn install:install-file -Dfile=fine-swift-log-adaptor-10.0.jar -DgroupId=com.fine -DartifactId=fine-swift-log-adaptor -Dversion=10.0 -Dpackaging=jar
call mvn install:install-file -Dfile=fine-third-10.0.jar -DgroupId=com.fine -DartifactId=fine-third -Dversion=10.0 -Dpackaging=jar
call mvn install:install-file -Dfile=fine-webui-10.0.jar -DgroupId=com.fine -DartifactId=fine-webui -Dversion=10.0 -Dpackaging=jar

2. pom.xml中添加依赖。这里把 fine-swift-log-adaptor 包注释了,因为发现导入这个包后会一直报错,因为暂时用不到就先注释掉,之后再研究。

<!-- FineReport -->
<dependency>
    <groupId>com.fine</groupId>
    <artifactId>fine-accumulator</artifactId>
    <version>10.0</version>
</dependency>
<dependency>
    <groupId>com.fine</groupId>
    <artifactId>fine-activator</artifactId>
    <version>10.0</version>
</dependency>
<dependency>
    <groupId>com.fine</groupId>
    <artifactId>fine-core</artifactId>
    <version>10.0</version>
</dependency>
<dependency>
    <groupId>com.fine</groupId>
    <artifactId>fine-datasource</artifactId>
    <version>10.0</version>
</dependency>
<dependency>
    <groupId>com.fine</groupId>
    <artifactId>fine-decision</artifactId>
    <version>10.0</version>
</dependency>
<dependency>
    <groupId>com.fine</groupId>
    <artifactId>fine-decision-report</artifactId>
    <version>10.0</version>
</dependency>
<dependency>
    <groupId>com.fine</groupId>
    <artifactId>fine-report-engine</artifactId>
    <version>10.0</version>
</dependency>
<dependency>
    <groupId>com.fine</groupId>
    <artifactId>fine-schedule</artifactId>
    <version>10.0</version>
</dependency>
<dependency>
    <groupId>com.fine</groupId>
    <artifactId>fine-schedule-report</artifactId>
    <version>10.0</version>
</dependency>
<!-- <dependency>
    <groupId>com.fine</groupId>
    <artifactId>fine-swift-log-adaptor</artifactId>
    <version>10.0</version>
</dependency> -->
<dependency>
    <groupId>com.fine</groupId>
    <artifactId>fine-third</artifactId>
    <version>10.0</version>
</dependency>
<dependency>
    <groupId>com.fine</groupId>
    <artifactId>fine-webui</artifactId>
    <version>10.0</version>
</dependency>

3.  修改项目的打包方式为 war,禁用集成的 Tomcat

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
</dependency>

4. 修改启动类,使启动类继承 SpringBootServletInitializer,添加 @EnableAutoConfiguration 注解,重写 configure方法

@SpringBootApplication
@EnableAutoConfiguration
public class DemoApplication extends SpringBootServletInitializer {

	public static void main(String[] args) {
		SpringApplication.run(DemoApplication.class, args);
	}
	
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
		return builder.sources(DemoApplication.class);
	}
}

5. 拷贝tools.jar。详情参考:服务器部署需引入tools.jar。

6. 在src/main下新建 webapps/WEB-INF/reportlets/,将报表放置在此文件夹下。如下图:

7. 配置Tomcat的 Timeouts 设置 。本机上的启动时间是60多秒,所以设置为90秒。如上图:

8. (可选)修改访问路径。修改 server.xml 中的 Context标签的 path 属性为“/”,如下图:

9. 访问路径说明。

  • 如果步骤8不中 path 设置为了 “/”
  1. 数据决策系统的访问路径 http://localhost:8080/decision

  2. 报表的访问路径是 http://localhost:8080/decision/view/report?viewlet=GettingStarted.cpt

  3. 自己项目中controller的访问路径是 http://localhost:8080/web

  • 如果步骤8中未修改 path
  1. 数据决策系统的访问路径 http://localhost:8080/demo/decision
  2. 报表的访问路径是 http://localhost:8080/demo/decision/view/report?viewlet=GettingStarted.cpt
  3. 自己项目中controller的访问路径是 http://localhost:8080/demo/web
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值