惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
H
Help Net Security
Last Week in AI
Last Week in AI
The Cloudflare Blog
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
IT之家
IT之家
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
Jina AI
Jina AI
Google DeepMind News
Google DeepMind News
B
Blog
C
Check Point Blog
T
Tailwind CSS Blog
云风的 BLOG
云风的 BLOG
D
Docker
Recent Announcements
Recent Announcements
Vercel News
Vercel News
博客园 - 聂微东
阮一峰的网络日志
阮一峰的网络日志
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
Stack Overflow Blog
Stack Overflow Blog
雷峰网
雷峰网
人人都是产品经理
人人都是产品经理
月光博客
月光博客
F
Fortinet All Blogs
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed
The Register - Security
The Register - Security
V
Visual Studio Blog
F
Full Disclosure
Hugging Face - Blog
Hugging Face - Blog
T
Threat Research - Cisco Blogs
Latest news
Latest news
PCI Perspectives
PCI Perspectives
Cisco Talos Blog
Cisco Talos Blog
博客园 - Franky
D
DataBreaches.Net
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
Google Developers Blog
P
Palo Alto Networks Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
T
Tenable Blog
L
LINUX DO - 热门话题
Spread Privacy
Spread Privacy

博客园 - 正怒月神

windows 安装 openclaw docker-compose 启动 elk linux mysql 备份 maven 打包时优先选择本地仓库 nginx 部署2个相同的vue minio 设置IP MapStruct-plus cannot find converter from jenkins pipeline 发布 jar并运行 MapperStruct 嵌套模型中 List<> 转 List<String> Easy es问题总结 Logstash docker发布 Docker 无法拉取 springmvc 多事务提交和回滚 java 通过 microsoft graph 调用outlook(三) JPA Example 默认 join jackson.dataformat.xml 反序列化 对象中包含泛型 OR-TOOL 背包算法 解决JIRA、Confluence自动注销登录的问题 java 通过 microsoft graph 调用outlook(二)
springMvc 配置 UReport2
正怒月神 · 2024-06-05 · via 博客园 - 正怒月神

参考:https://blog.csdn.net/qq_42207808/article/details/112258835

1.配置pom.xml

引入目前最新得2.2.9版本

            <dependency>
                <groupId>com.bstek.ureport</groupId>
                <artifactId>ureport2-console</artifactId>
                <version>2.2.9</version>
            </dependency>

2.web.xml配置

<!-- ureport2接口 -->
<servlet>
    <servlet-name>ureportServlet</servlet-name>
    <servlet-class>com.bstek.ureport.console.UReportServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>ureportServlet</servlet-name>
    <url-pattern>/ureport/*</url-pattern>
</servlet-mapping>
 

3.spring-context.xml配置(这里我配置在了application.xml中)

mvc直接引入ureport xml配置即可,并引入配置文件,如果有properties就用现在得,没有就新建

<!--引入ureport2-->
<import resource="classpath*:ureport-console-context.xml" />
<bean id="propertyConfigurer" parent="ureport.props">
    <property name="location" value="classpath:/properties/dangjian.properties"/>
</bean>

4.properties配置

#ureport固定配置(fileStoreDir默认为tomact启动下得WEB-INF下面得ureportfiles文件夹,可以自定义路径ureport.fileStoreDir=E:/work/ureportfiles)
ureport.fileStoreDir=ureportfiles
ureport.disableHttpSessionReportCache=false
ureport.disableFileProvider=false
ureport.debug=true

5.新建类实现BuildinDatasource接口,用以配置项目内置数据源

package com.jeeplus.modules.ureport;
 
import com.alibaba.druid.pool.DruidDataSource;
import com.bstek.ureport.definition.datasource.BuildinDatasource;
import com.jeeplus.common.utils.SpringContextHolder;
import org.springframework.stereotype.Component;
 
import java.sql.Connection;
import java.sql.SQLException;
 
/**
 * 内置数据源
 * @author jsy
 * @version 2021/1/4
 **/
@Component
public class ReportDateSource implements BuildinDatasource {
 
    private DruidDataSource druid = SpringContextHolder.getBean(DruidDataSource.class);
 
    @Override
    public String name() {
 
        return "mysql_druid";
    }
 
    @Override
    public Connection getConnection() {
 
        try {
            return druid.getConnection();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
 

6.启动项目访问(关于URL下述的URL

http://localhost:9006/ureport/designer 中,需要根据项目情况修改9006端口

注:报表设计器表达式校验依赖于Antlr4,表达式报错得话请pom引入Antlr4

<dependency>
    <groupId>org.antlr</groupId>
    <artifactId>antlr4-runtime</artifactId>
    <version>4.9.1</version>
</dependency>