Skip to content

Conflicting transactionInterceptor bean when using Spring Boot 3.0.2 and Couchbase Starter #34209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cjp421 opened this issue Feb 15, 2023 · 5 comments
Labels
for: external-project For an external project and not something we can fix status: invalid An issue that we don't feel is valid

Comments

@cjp421
Copy link

cjp421 commented Feb 15, 2023

Receiving the following error when using Spring Boot 3.0.2 and spring-boot-starter-data-couchbase:

The bean 'transactionInterceptor', defined in class path resource [org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [com/example/demo/CouchbaseConfig.class] and overriding is disabled.

To recreate:

  1. go to start.spring.io and create a new Spring Boot 3.0.2 project with the couchbase starter dependency
  2. Create a configuration class extending AbstractCouchbaseConfiguration
@Configuration
public CouchbaseConfig extends AbstractCouchbaseConfiguration {
    // override required methods
}
  1. Try and start the application ./gradlew bootRun

Is there something I'm missing with Spring Boot 3.0.2 and Couchbase starter?

https://github.com/spring-projects/spring-data-couchbase/blob/main/src/main/java/org/springframework/data/couchbase/config/AbstractCouchbaseConfiguration.java#L377-L388

https://github.com/spring-projects/spring-framework/blob/main/spring-tx/src/main/java/org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.java#L65-L74

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 15, 2023
@wilkinsona
Copy link
Member

Thanks for the report. This should be addressed in Spring Data Couchbase so that it does not define a bean whose name clashes with a bean defined by Spring Framework. They should perhaps be using a bean post-processor to customize the interceptor that Framework already defines. Please open a Spring Data Couchbase issue.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Feb 15, 2023
@wilkinsona wilkinsona added status: invalid An issue that we don't feel is valid for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 15, 2023
@mikereiche
Copy link

@wilkinsona - if I used a different name for the bean, how would I get transactionAdvisor() in ProxyTransactionManagementConfiguration to use that bean?

@wilkinsona
Copy link
Member

I don't think you should rename your bean. Instead, I think you should remove your definition of the transactionAdvisor been and replace it with some customization of the bean that Framework defines. That could perhaps be done with a bean post-processor as suggested above. If that's not possible, I would ask the Framework team for some guidance. An alternative could be to use a bean factory post processor to change the definition but that's in danger of becoming a bit of a hack and should be something of a last resort.

@mikereiche
Copy link

I think you should remove your definition of the transactionAdvisor been and replace it with some customization of the bean that Framework defines.

transactionAdvisor is a bean that the Framework defines. I'm customizing it by extending the class.
The required customization is smack-dab in the middle of the processing. It's not in the post processing.

I did ask for guidance on this issue - I received no response. I will try again.

@wilkinsona
Copy link
Member

I've added a comment to the SDC issue that will hopefully make what I am suggesting more clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

4 participants