Class BlockchainAutoConfiguration

java.lang.Object
com.privatechain.spring.BlockchainAutoConfiguration

@AutoConfiguration @EnableConfigurationProperties(BlockchainProperties.class) @ConditionalOnProperty(prefix="blockchain", name="enabled", havingValue="true", matchIfMissing=true) public class BlockchainAutoConfiguration extends Object
Spring Boot autoconfiguration for the private-blockchain library.

This class is the single assembly point for all blockchain Spring beans, mirroring the non-Spring assembly model in BlockchainConfig but adapting it to dependency injection (FR-CFG-01, FR-CFG-03).

Activation

Active by default. Disable completely with:


 blockchain:
   enabled: false
 

Zero-configuration start (AC-10)

No blockchain.* properties required. Defaults: ProofOfWorkEngine (difficulty 4) + InMemoryStorage.

Override points (T-072)

Every bean is guarded by @ConditionalOnMissingBean. Provide any of the following in your @Configuration to replace the default:

Multiple validators and listeners

All TransactionValidator and BlockchainEventListener beans are discovered and registered automatically in declaration order.

Node lifecycle

The BlockchainNode bean uses initMethod = "start" and destroyMethod = "stop". Spring calls start() after all beans are wired and stop() on context close.

Actuator integration

BlockchainHealthIndicator is a plain status-provider bean with no compile-time dependency on spring-boot-actuator. To wire it into the Actuator health endpoint, add this to your @Configuration:


 @Bean
 HealthIndicator blockchainHealth(BlockchainHealthIndicator indicator) {
     return () -> indicator.isUp()
         ? Health.up().withDetails(indicator.getDetails()).build()
         : Health.down().withDetails(indicator.getDetails()).build();
 }
 
Since:
1.0.0
See Also:
  • Constructor Details

    • BlockchainAutoConfiguration

      public BlockchainAutoConfiguration()
  • Method Details