ureport2+springboot(一)

1.引入jar包

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

2.配置

# 数据库链接 数据源配置

spring.datasource.url=jdbc:mysql://192.168.1.93:3306/manxbsf?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&serverTimezone=GMT%2B8

spring.datasource.username=root

spring.datasource.password=panku

spring.datasource.driverClassName=com.mysql.jdbc.Driver
#此时有可能项目启动不了,并报错Configuration problem: Failed to import bean definitions from URL location [classpath:ureport-core-context.xml],添加下面这句话
spring.main.allow-bean-definition-overriding=true

3.context.xml

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

    <import resource="classpath:ureport-console-context.xml"/>



    <!-- 引入配置文件 -->

    <bean id="propertyConfigurer" parent="ureport.props">

        <property name="location">

            <!-- 读取配置文件 -->

            <value>classpath:application.properties</value>

        </property>

    </bean>

</beans>

4.在启动类添加注解

@ImportResource("classpath:context.xml")

5.BeanConfig

package com.example.demo.cofig;

import com.bstek.ureport.console.UReportServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: jack
 * @Description: springboot实体类配置
 * @Date Create in 10:25 2020-03-21
 **/
@Configuration
public class BeanConfig {

    @Bean
    public ServletRegistrationBean ureport2Servlet() {
        ServletRegistrationBean registrationBean = new ServletRegistrationBean(new UReportServlet(), "/ureport/*");
        return registrationBean;
    }

}

6.项目启动后直接访问这个地址

http://localhost:8080/ureport/designer

7.项目结构

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值