Могу ли я иметь два экземпляра @ClientCacheApplication
в одном приложении Spring Boot ?
У меня есть два класса: PeopleDataAccess
и JobDataAccess
.Они оба @ClientCacheApplication
.
@Service
@ClientCacheApplication(name = "AccessingDataGemFireApplication", logLevel = "error")
@EnableEntityDefinedRegions(basePackageClasses = People.class, clientRegionShortcut = ClientRegionShortcut.LOCAL)
@EnableGemfireRepositories(basePackageClasses = PeopleRepository.class)
public class PeopleDataAccess {
@Autowired
PeopleRepository peopleRepository;
public void saveRecord() {
People alice = new People("Adult Alice", 40);
People bob = new People("Baby Bob", 1);
People carol = new People("Teen Carol", 13);
peopleRepository.save(alice);
peopleRepository.save(bob);
peopleRepository.save(carol);
}
}
@Service
@ClientCacheApplication(name = "AccessingDataGemFireApplication", logLevel = "error")
@EnableEntityDefinedRegions(basePackageClasses = Job.class, clientRegionShortcut = ClientRegionShortcut.LOCAL)
@EnableGemfireRepositories(basePackageClasses = JobRepository.class)
public class JobDataAccess {
@Autowired
JobRepository jobRepository;
public void saveRecord() {
Job firemen = new Job("Firemen");
Job accounting = new Job("Accounting");
jobRepository.save(firemen);
jobRepository.save(accounting);
}
}