目录:【持续更新。。。。。】
  
  spring boot 学习之路9 (项目启动后就执行特定方法)



 

durid介绍:参考

  Druid是Java语言中最好的数据库连接池。Druid能够提供强大的监控和扩展功能。


 

durid和spring boot集成

  如何在Spring Boot中集成Druid连接池和监控?    

    使用Druid Spring Boot Starter,文档地址:https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter

 

集成步骤:

    springboot 学习之路 6(集成durid连接池)

    单独建个包,把durid的相关类放进去,然后启动项目即可(关于上面包里的东西我放到git上了)

  启动项目:成功页面

    springboot 学习之路 6(集成durid连接池)

然后测试一下durid的监控页面

  springboot 学习之路 6(集成durid连接池)

  至此:durid已经集成到spring boot中了,这只是简单的集成,多数据源的配置也会使用durid   ,那时再详细解析durid的详细参数配置:

 


 

 

  druid连接池的第二种配置:

    在application.properties配置连接池信息(注意:spring.datasource.type旧的spring boot版本【1.4】是不能识别的)

    springboot 学习之路 6(集成durid连接池)

    具体代码有:

    springboot 学习之路 6(集成durid连接池)

    

    springboot 学习之路 6(集成durid连接池)

 

    在启动类中加上注解@ServletComponentScan即可,启动范围页面如下:
    

springboot 学习之路 6(集成durid连接池)

 



 
                    
            
                

相关文章:

  • 2022-12-23
  • 2022-02-17
  • 2022-12-23
  • 2022-12-23
  • 2021-06-16
  • 2021-07-13
  • 2022-02-22
猜你喜欢
  • 2021-06-20
  • 2022-02-25
  • 2022-12-23
  • 2021-05-06
  • 2021-05-03
  • 2022-12-23
  • 2021-05-25
相关资源
相似解决方案