Autoconfiguration
Dependency
<dependency>
<groupId>io.pipelite</groupId>
<artifactId>pipelite-spring-starter</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
@EnablePipelite
The @EnablePipelite annotation activates the entire Pipelite infrastructure in the Spring context.
Its flowConfigurations attribute declares the @FlowConfiguration classes that contain the flow definitions:
@SpringBootApplication
@EnablePipelite(flowConfigurations = OrderFlowConfiguration.class) (1)
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
| 1 | Lists the @FlowConfiguration classes to register. Spring constructs them as beans and FlowConfigurationBeanPostProcessor scans their @DefineFlow methods. |
The @FlowConfiguration class defines flows via @DefineFlow methods:
@FlowConfiguration
public class OrderFlowConfiguration {
private final OrderService orderService;
public OrderFlowConfiguration(OrderService orderService) { (1)
this.orderService = orderService;
}
@DefineFlow
public FlowDefinition orderFlow() {
return Pipelite.defineFlow("order-flow")
.fromSource("kafka://orders")
.process("handle", exchange ->
orderService.handle(exchange.getInputPayloadAs(Order.class)))
.toSink("slf4j://orders-log")
.build();
}
@DefineFlow
public FlowDefinition orderAuditFlow() {
return Pipelite.defineFlow("order-audit-flow")
.fromSource("time://audit-tick?period=60000")
.toSink("slf4j://audit-log")
.build();
}
}
| 1 | Standard Spring constructor injection — OrderService must be a Spring-managed bean. |
For the complete @FlowConfiguration / @DefineFlow reference, including plain-Java usage and dependency resolution, see FlowConfiguration SPI.
Auto-configured components
@EnablePipelite imports PipeliteConfigurationImportSelector, which registers:
| Bean | Status | Responsibility |
|---|---|---|
|
Active |
The framework singleton context, built by |
|
Active |
Detects |
|
Active |
Implements |
|
Active |
Initializes the context with internal factories. |
|
Deprecated |
Legacy |
Lifecycle with Spring
PipeliteContextLifecycleManager integrates with the Spring lifecycle:
-
start()→ invoked by Spring after theApplicationContextrefresh, once all@FlowConfigurationbeans have been processed byFlowConfigurationBeanPostProcessor. -
stop()→ invoked by Spring during orderly shutdown.
Registering multiple flows
Multiple @DefineFlow methods in one class:
@FlowConfiguration
public class AllFlowsConfiguration {
@DefineFlow
public FlowDefinition orderFlow() { ... }
@DefineFlow
public FlowDefinition paymentFlow() { ... }
}
Multiple @FlowConfiguration classes in @EnablePipelite:
@EnablePipelite(flowConfigurations = {
OrderFlowConfiguration.class,
PaymentFlowConfiguration.class,
AuditFlowConfiguration.class
})
Deprecated: @Bean FlowDefinition pattern
Prior to 1.0.0-SNAPSHOT, flows were declared as @Bean methods returning FlowDefinition and detected by FlowDefinitionRegistrar:
// Deprecated — do not use in new code
@Configuration
@EnablePipelite
public class PipeliteConfig {
@Bean
public FlowDefinition myFlow() {
return Pipelite.defineFlow("my-flow")
.fromSource("time://tick?period=10000")
.toSink("slf4j://log")
.build();
}
}
Migrate to @FlowConfiguration / @DefineFlow with @EnablePipelite(flowConfigurations = …).
FlowDefinitionRegistrar is @Deprecated and will be removed in a future major release.