My spring boot data geode @Controller
endpoint sets up an rsocket response which @Autowired
a service class from another package:
@Controller
public class RSocketController {
private static final Logger log = LogManager.getLogger(RSocketController.class);
@Autowired
MyService myService;
The myService
class contains @Resource
regions which were setup by @EnableClusterDefinedRegions
from a Geode cluster.
@Resource
private Region<String, Request> request;
When an rsocket request is sent to the endpoint the @Autowired
service gives an error:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'request' available
I have some domain objects decorated with @Region
that I also decorated with @Controller
and @Configuration
and these gave errors like:
Bean named 'request' is expected to be of type 'org.apache.geode.cache.Region' but was actually of type 'region.request'
and
Bean named 'request' is expected to be of type org.apache.geode.cache.Region but was actually of type region.request$$EnhancerBySpringCGLIB$$5e6b7dd1
When I turned on debug logs I see that the @EnableClusterDefinedRegions
has somehow not triggered and therefore not setup the request
region from the Geode cluster. Aaargh.
The problem resolved by adding
@Component
annotation to the@EnableClusterDefinedRegions
class which was then seen by Spring Boot bean collector.