Parameter 0 of method removeDruidFilterRegistrationBean in com.smartvillage.config.DruidConfig required a bean of type 'com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties' that could not be found.
时间: 2024-02-17 13:00:12 浏览: 342
基于spring boot和vue的前后端分离的外卖系统包括手机端,后台管理,api.zip
这个问题可能是由于没有正确配置Druid数据源所引起的。请检查以下几个方面:
1. 确认在application.properties或application.yml文件中是否正确配置了Druid数据源相关属性。例如,检查是否正确配置了spring.datasource.url、spring.datasource.username和spring.datasource.password等属性。
2. 确认在pom.xml文件中是否正确引入了Druid依赖。例如,检查是否引入了以下依赖:
```
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.10</version>
</dependency>
```
3. 如果以上两个方面都没有问题,尝试在DruidConfig类中添加以下代码:
```
@Bean
@ConfigurationProperties("spring.datasource.druid.stat-view-servlet")
public StatViewServletRegistrationBean statViewServletRegistrationBean(){
return new StatViewServletRegistrationBean(new StatViewServlet(),"/druid/*");
}
@Bean
@ConfigurationProperties("spring.datasource.druid.web-stat-filter")
public FilterRegistrationBean webStatFilterRegistrationBean(){
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
registrationBean.setFilter(new WebStatFilter());
registrationBean.addUrlPatterns("/*");
registrationBean.addInitParameter("exclusions","*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");
return registrationBean;
}
```
希望这些方法能帮助你解决这个问题。
阅读全文