The bean 'pasteRepository', defined in com.miu.pasteit.repository.PasteRepository defined in @EnableMongoRepositories declared on MongoRepositoriesRegistrar.EnableMongoRepositoriesConfiguration, could not be registered. A bean with that name has already been defined in com.miu.pasteit.repository.PasteRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
Task :PasteItApplication.main() FAILED
Execution failed for task ':PasteItApplication.main()'.
Process 'command '/Applications/IntelliJ IDEA CE.app/Contents/jbr/Contents/Home/bin/java'' finished with non-zero exit value 1
I have fixed the above issues.
FYI: I have added the h2 to test with in memory database.
you need to fix one issue though the error is related to activityId as shown below:
org.springframework.data.mapping.MappingException: Ambiguous field mapping detected! Both @javax.persistence.Id()protected java.lang.String com.miu.pasteit.model.entity.common.ActivityCommon.activityId and @javax.persistence.Id()private java.lang.String com.miu.pasteit.model.entity.activity.ActivityPaste.activityId map to the same field name activityId! Disambiguate using @Field annotation!
I have got minor error:
The bean 'pasteRepository', defined in com.miu.pasteit.repository.PasteRepository defined in @EnableMongoRepositories declared on MongoRepositoriesRegistrar.EnableMongoRepositoriesConfiguration, could not be registered. A bean with that name has already been defined in com.miu.pasteit.repository.PasteRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
Execution failed for task ':PasteItApplication.main()'.
I have fixed the above issues.
FYI: I have added the h2 to test with in memory database.
you need to fix one issue though the error is related to activityId as shown below:
org.springframework.data.mapping.MappingException: Ambiguous field mapping detected! Both @javax.persistence.Id()protected java.lang.String com.miu.pasteit.model.entity.common.ActivityCommon.activityId and @javax.persistence.Id()private java.lang.String com.miu.pasteit.model.entity.activity.ActivityPaste.activityId map to the same field name activityId! Disambiguate using @Field annotation!
@rimonmostafiz