我刚在我的项目中移动了一些文件,SpringBoot无法运行
.
├── DatabaseLoader.java
├── HomeController.java
├── product
│ ├── Product.java
│ └── ProductRepository.java
├── security
│ ├── JWTAuthenticationFilter.java
│ ├── JWTAuthorizationFilter.java
│ ├── SecurityConstants.java
│ └── WebSecurity.java
├── ShopApplication.java
└── user
├── ApplicationUser.java
├── ApplicationUserRepository.java
├── UserController.java
└── UserDetailsServiceImpl.java
是因为控制器应该和shopplication(@springbootplication)在同一个文件夹中吗?
spring显示了以下描述:
The bean 'productRepository', defined in com.ecommerce.shop.product.ProductRepository defined in
@EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration,
could not be registered. A bean with that name has already been defined in
com.ecommerce.shop.ProductRepository defined in @EnableJpaRepositories declared on
JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration and overriding is disabled.
如果没有足够的信息,您可以在这里 checkout 我的github存储库
如蒙关注,我将不胜感激。谢谢您!
1条答案
按热度按时间w8f9ii691#
看来你可能被利用了
@EnableJpaRepositories
多次。在存储库类中,仅使用@Repository
就够了。