spring boot 2.0 集成 fineReport 10

集成 fineReport

基于spring boot 2.0 项目集成fineReport 10.0环境

在项目中对应 module src 目录下创建webapp文件并创建子文件WEB-INF

在这里插入图片描述
modules添加Web 并把webapp文件夹设置为Web Resource Directory
在这里插入图片描述
在这里插入图片描述
%FineReport_HOME%\webapps\webroot\WEB-INF目录下的所有文件复制到项目的WEB-INF
在这里插入图片描述
%JAVA_HOME%/jdk/lib下的tools.jar复制到webapp的WEB-INF的lib文件夹下

在这里插入图片描述
修改 base-admin pom.xml文件

修改打包方式为war

	<packaging>war</packaging>

在这里插入图片描述

l spring-boot-starter-tomcat 添加 <scope>provided</scope> 否则 <packaging>war</packaging>可能为报错

<dependency>
	 <groupId>org.springframework.boot</groupId>
	 <artifactId>spring-boot-starter-tomcat</artifactId>
	  <!-- 编译和测试的时候用 -->
	 <scope>provided</scope> 
</dependency>

添加servlet依赖、去除boot内嵌tomcat

<dependency>
	<groupId>javax.servlet</groupId>
	<artifactId>javax.servlet-api</artifactId>
	<version>3.1.0</version>
	<scope>provided</scope>
</dependency>

<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>${mybatis-spring-boot-starter.version}</version>
    <!-- 去掉内嵌Tomcat依赖 -->
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </exclusion>
    </exclusions>
</dependency>

修改启动类 继承 SpringBootServletInitializer 重写 configure方法

import com.fastfinger.dev.listener.ApplicationStartupListener;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.scheduling.annotation.EnableAsync;

@SpringBootApplication
public class BaseApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
       SpringApplication.run(BaseApplication.class,args);
    }


    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder){
        return  builder.sources(FastAdminApplication.class);
    }



}

添加artifacts 打开 project structure
在这里插入图片描述

选择 web module put into output root 我这里是base-admin

在这里插入图片描述
配置tomcat
在这里插入图片描述

添加参数 -DDIAMOND.CONNECT.TIMEOUT=60000 -XX:MaxPermSize=3512m 这里会出现警告 没有关联 artifacts 点击 fix 选择 之前配置的 artifacts

在这里插入图片描述

继续往下拉 Application context设置为/ (当前先不配置名称,spring boot部署到外部tomcat,如果有添加拦截器没处理好可能会出现404问题)
这里是配置运行后访问的路径 如 Application context:/base 访问项目路径则为 http://localhost:8080/base

在这里插入图片描述
点击运行TOMCAT

打开浏览器 输入 http://localhost:8080/decision/ 完成
/decision 进入finereport后台
在这里插入图片描述

如果要在iframe显示自定义报表

<iframe src="/decision/view/report?viewlet=base/base.cpt"  
 width="100%" height="100%" frameborder="no" border="0"></iframe>`

base/base.cpt的路径为项目的 src/webapp/WEB-INF/reportlets

在这里插入图片描述
完成~

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值