You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
adding @EnableSpringDataWebSupport in a project that uses spring-boot-starter-data-rest results in a BeanDefinitionOverrideException preventing application startup.
context: i want to use PageSerializationMode.VIA_DTO. while that "just worked" by default with spring-data-commons 3.3.0, from 3.3.1 on we have to add @EnableSpringDataWebSupport(pageSerializationMode = EnableSpringDataWebSupport.PageSerializationMode.VIA_DTO) explicitly (due to #3101).
sample app (boot-3.3.1-SNAPSHOT, spring-data-bom-2024.0.1-SNAPSHOT, spring-data-commons-3.3.1-SNAPSHOT at the time of writing) will be referenced asap.
2024-06-15T10:28:59.121+02:00 INFO 26728 --- [demo] [ main] com.example.demo.DemoApplication : Starting DemoApplication using Java 21.0.1 with PID 26728 [...]
2024-06-15T10:28:59.123+02:00 INFO 26728 --- [demo] [ main] com.example.demo.DemoApplication : No active profile set, falling back to 1 default profile: "default"
2024-06-15T10:28:59.450+02:00 WARN 26728 --- [demo] [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'pageableResolver' defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration; factoryMethodName=pageableResolver; initMethodNames=null; destroyMethodNames=[(inferred)]; defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]] for bean 'pageableResolver' since there is already [Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.data.web.config.HateoasAwareSpringDataWebConfiguration; factoryMethodName=pageableResolver; initMethodNames=null; destroyMethodNames=[(inferred)]; defined in class path resource [org/springframework/data/web/config/HateoasAwareSpringDataWebConfiguration.class]] bound.
2024-06-15T10:28:59.455+02:00 INFO 26728 --- [demo] [ main] .s.b.a.l.ConditionEvaluationReportLogger :
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-06-15T10:28:59.468+02:00 ERROR 26728 --- [demo] [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'pageableResolver', defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/data/web/config/HateoasAwareSpringDataWebConfiguration.class] and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
The text was updated successfully, but these errors were encountered:
zyro23
added a commit
to zyro23/spring-data-commons-3108
that referenced
this issue
Jun 15, 2024
adding
@EnableSpringDataWebSupport
in a project that usesspring-boot-starter-data-rest
results in aBeanDefinitionOverrideException
preventing application startup.context: i want to use
PageSerializationMode.VIA_DTO
. while that "just worked" by default with spring-data-commons 3.3.0, from 3.3.1 on we have to add@EnableSpringDataWebSupport(pageSerializationMode = EnableSpringDataWebSupport.PageSerializationMode.VIA_DTO)
explicitly (due to #3101).sample app (boot-3.3.1-SNAPSHOT, spring-data-bom-2024.0.1-SNAPSHOT, spring-data-commons-3.3.1-SNAPSHOT at the time of writing) will be referenced asap.
The text was updated successfully, but these errors were encountered: