0
我有这样的接口:是否将注释库接口注释为@Component有什么缺点?
public interface liteRepository extends CrudRepository<liteEntity, Long>, JpaSpecificationExecutor<liteEntity> {...}
它的工作原理,一切都很好。
但是,intellij
不会将该类注册为弹簧组件。如果我用@Component
注解这个接口,那么intellij
认识到这是一个spring bean,我可以在我的集成测试中使用@Autowire
这个存储库。
我的代码在注释后仍然有效,但我不相信我不会搞乱我不应该搞乱的事情。
问:
是否有添加@Component
注解这个接口的任何伤害?