类 UReportConfiguration

java.lang.Object
net.sohelp.boot.engine.web.config.UReportConfiguration
所有已实现的接口:
com.bstek.ureport.definition.datasource.BuildinDatasource

@Configuration @ConditionalOnExpression("${sohelp-boot.engine.enabled:true} && ${sohelp-boot.engine.report.enabled:true}") @ImportResource("classpath:ureport2.xml") public class UReportConfiguration extends Object implements com.bstek.ureport.definition.datasource.BuildinDatasource
UReport 报表引擎相关配置类。

该配置类用于初始化 UReport 相关组件,包括自定义 Servlet、数据源、报表提供者等。
配置是否加载受属性 sohelp-boot.engine.enabledsohelp-boot.engine.report.enabled 控制, 当这两个属性都为 true 时才加载此配置。

  • 构造器详细资料

    • UReportConfiguration

      public UReportConfiguration()
  • 方法详细资料

    • ureportServlet

      @Bean public org.springframework.boot.web.servlet.ServletRegistrationBean ureportServlet()
      注册 UReport 的 Servlet,映射路径为 /ureport/*
      返回:
      ServletRegistrationBean 实例,用于注册自定义的 UReport Servlet
    • magicApiDatasource

      @Bean(name="MagicApiDatasource") public MagicApiDatasource magicApiDatasource()
      创建并注册 MagicAPI 数据源 Bean。

      使用 SpringUtil 获取 MagicAPIService 实例,并将其封装成 MagicApiDatasource 提供给报表系统使用。

      返回:
      MagicApiDatasource 实例
    • getModuleDatasoure

      @Bean(name="ModuleDatasource") public ModuleDatasource getModuleDatasoure()
      创建并注册模块化数据源 Bean。
      返回:
      ModuleDatasource 实例
    • sohelpReport

      @Bean @ConditionalOnMissingBean(SohelpReport.class) public SohelpReport sohelpReport()
      创建并返回一个SoHelpReport实例。

      该方法使用@ConditionalOnMissingBean注解,表示仅在容器中不存在SohelpReport类型的Bean时才会创建。

      返回:
      返回一个新的SohelpReport实例
    • fileReportProvider

      @Bean public com.bstek.ureport.provider.report.ReportProvider fileReportProvider()
      根据资源配置类型决定使用的报表提供者(数据库或文件)。

      若资源类型为 database,则使用 DBReportProvider;否则使用 FileReportProvider。

      返回:
      ReportProvider 实例
    • name

      public String name()
      获取内置数据源名称。
      指定者:
      name 在接口中 com.bstek.ureport.definition.datasource.BuildinDatasource
      返回:
      数据源名称字符串:"默认数据源"
    • getConnection

      public Connection getConnection()
      获取当前数据源连接对象。

      尝试从注入的数据源中获取数据库连接,若发生异常则记录日志并返回 null。

      指定者:
      getConnection 在接口中 com.bstek.ureport.definition.datasource.BuildinDatasource
      返回:
      数据库连接对象,出错时返回 null