Skip to content
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

Inheriting from entity types causes failure when using entity-defined Regions #112

Open
yozaner1324 opened this issue Mar 2, 2022 · 1 comment
Labels
documentation Label citing a change in documentation. enhancement won't fix

Comments

@yozaner1324
Copy link
Contributor

Failure:
The bean 'Person' could not be registered. A bean with that name has already been defined and overriding is disabled.

Scenario:
This occurs when a class extends a data class annotated with @Region, even if the subclass is not used.

Example:

@Region("Person")
class Person{
	@Id
	private String name;
	public Person(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}
}

class Customer extends Person {
	public Customer(String name) {
		super(name);
	}
}

If Customer doesn't extend Person, there is no issue, but if it does, the application context will fail to load.

Work arounds:

  • Set spring.main.allow-bean-definition-overriding to true
  • Don't use entity defined regions
  • Don't inherit from data classes used to define regions.

Repo reproducing issue: https://github.com/yozaner1324/SBDG-using-sealed-classes

@jxblum jxblum added the documentation Label citing a change in documentation. label Mar 2, 2022
@jxblum
Copy link
Contributor

jxblum commented Mar 2, 2022

TODO: Move to Spring Data for Apache Geode (SDG) Issues since the @EnableEntityDefinedRegions annotation is specific to Spring Data Geode.

@jxblum jxblum changed the title Inheriting from data objects causes failure when using entity-defined regions. Inheriting from entity types causes failure when using entity-defined Regions Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Label citing a change in documentation. enhancement won't fix
Projects
None yet
Development

No branches or pull requests

2 participants