SpringBoot整合JavaMelody与MybatisPlus产生的问题解决

SpringBoot整合JavaMelody与MybatisPlus产生的问题解决

Caused by: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error: GlobalConfigUtils setMetaData Fail !  Cause:com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error: Get proxy targetObject exception !  Cause:java.lang.NoSuchFieldException: jdkDynamicField

//sqlSessionFactory 当看到这个报错就知道是数据源没有找到,但是我这个服务本来是能正常启动的所以我就排除我数据源的问题,因为引入了 javaMelody与springboot的整合所以我认为应该是mybatisplus与javaMelody出现冲突,
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error: GlobalConfigUtils setMetaData Fail !  Cause:com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error: Get proxy targetObject exception !  



开始我引入的是spring boot 与javaMelody的starter

 //原引入的版本
 <dependency>
            <groupId>net.bull.javamelody</groupId>
            <artifactId>javamelody-spring-boot-starter</artifactId>
            <version>1.76.0</version>
</dependency>

//不引入了starter了直接引入jar了
 <dependency>
            <groupId>net.bull.javamelody</groupId>
            <artifactId>javamelody-core</artifactId>
            <version>1.79.0</version>
</dependency>

在配置类中把javaMelody注册到spirng中
    @Bean
    //配置注册顺序
    @Order(Integer.MAX_VALUE - 1)
    public FilterRegistrationBean monitoringFilter() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new MonitoringFilter());
        registration.addUrlPatterns("/*");
        registration.setName("monitoring");
        return registration;
    }
//
    /**
     * 配置javamelody监听器sessionListener
     */
    @Bean
    public ServletListenerRegistrationBean<SessionListener> servletListenerRegistrationBean() {
        ServletListenerRegistrationBean<SessionListener> slrBean = new ServletListenerRegistrationBean<SessionListener>();
        slrBean.setListener(new SessionListener());
        return slrBean;
    }



然后项目正常启动问题解决
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值