@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }, scanBasePackages = 'com.eetrust' ) 不生效,Field redisUtils in com.eetrust.common.security.AuthFilter required a bean of type 'com.eetrust.utils.RedisUtils' that could not be found.
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }, scanBasePackages = 'com.eetrust' ) 不生效,Field redisUtils in com.eetrust.common.security.AuthFilter required a bean of type 'com.eetrust.utils.RedisUtils' that could not be found.
根据提供的信息,问题可能出在以下几个方面:
-
包名错误:确认'com.eetrust'包路径是正确的。确保在'com.eetrust'包及其子包中存在需要扫描的类。
-
依赖缺失:确认项目的依赖中是否包含了'com.eetrust.utils.RedisUtils'类所在的依赖。如果没有,需要在项目的依赖中添加对应的依赖。
-
注解扫描配置错误:检查
@SpringBootApplication注解的scanBasePackages属性是否正确设置为'com.eetrust'。确保该注解所在的类位于'com.eetrust'包或其子包中。 -
配置文件错误:确认项目的配置文件中是否正确配置了Redis相关的配置项,如Redis服务器地址、端口等。确保配置文件正确加载。
如果以上方法都没有解决问题,可以尝试使用@ComponentScan注解来替代scanBasePackages属性,手动指定需要扫描的包路径。
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@ComponentScan(basePackages = "com.eetrust")
public class YourApplication {
// ...
}
希望以上方法能帮助到你解决问题。如果问题仍然存在,请提供更多的代码和配置信息,以便更好地帮助你解决问题。
原文地址: https://www.cveoy.top/t/topic/bq7P 著作权归作者所有。请勿转载和采集!