Package com.onec.cluster.pg
Class OnecClusterAutoConfiguration
java.lang.Object
com.onec.cluster.pg.OnecClusterAutoConfiguration
@AutoConfiguration(after=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration.class,
before=OnecAutoConfiguration.class)
@ConditionalOnClass(name="org.postgresql.PGConnection")
@ConditionalOnBean(javax.sql.DataSource.class)
@ConditionalOnProperty(prefix="onec.cluster",
name="enabled",
havingValue="true",
matchIfMissing=true)
@EnableConfigurationProperties(OnecClusterProperties.class)
public class OnecClusterAutoConfiguration
extends Object
Wires the Postgres
LISTEN/NOTIFY ClusterEventBus default.
Ordered before OnecAutoConfiguration so its @ConditionalOnMissingBean bus
registers ahead of that module's no-op fallback. It contributes a bus only when the PostgreSQL JDBC
driver is present and the live datasource is actually Postgres (detected via
SqlDialect); on H2 (dev/test) it returns a NoOpClusterEventBus, so the framework's
single-node behaviour is preserved. An application's own ClusterEventBus bean (e.g.
Kafka/Redis) wins over both via @ConditionalOnMissingBean.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiononecClusterEventBus(DataSource dataSource, com.fasterxml.jackson.databind.ObjectMapper objectMapper, OnecClusterProperties properties)
-
Constructor Details
-
OnecClusterAutoConfiguration
public OnecClusterAutoConfiguration()
-
-
Method Details
-
onecClusterEventBus
@Bean @ConditionalOnMissingBean(ClusterEventBus.class) public ClusterEventBus onecClusterEventBus(DataSource dataSource, com.fasterxml.jackson.databind.ObjectMapper objectMapper, OnecClusterProperties properties)
-