blog2019 icon indicating copy to clipboard operation
blog2019 copied to clipboard

Could not autowire. There is more than one bean of 'HazelcastInstance' type.

Open isfong opened this issue 3 years ago • 3 comments
trafficstars

IntelliJ IDEA tips Application#L23-L24 Could not autowire. There is more than one bean of 'HazelcastInstance' type. Beans: hazelcastInstance   (HazelcastServerConfiguration.class) hazelcastInstance   (HazelcastClientConfiguration.class)

isfong avatar Apr 02 '22 03:04 isfong

Can't reproduce.

This is what I did

git clone https://github.com/ralscha/blog2019.git
cd blog2019/ratelimit
./mvnw spring-boot:run

ralscha avatar Apr 03 '22 15:04 ralscha

Yes, it does not affect service startup, it is just a canonical check for Jetbrains on Spring Bean assembly.
I use getOrCreateHazelcastInstance avoid this problem, perhaps it was hazelcast-spring's faults Or maybe it doesn't matter.

    @Bean
    HazelcastInstance clusterHazelcastInstance( ) {
        Config config = new Config( );
        config.setInstanceName( "cluster.local.hz" );
        config.getCPSubsystemConfig( ).setCPMemberCount( 3 );
        return Hazelcast.getOrCreateHazelcastInstance( config );
    }

isfong avatar Apr 06 '22 03:04 isfong

I see. Thanks for the feedback.

ralscha avatar Apr 06 '22 03:04 ralscha