Spring Boot Operating System Conditions provides @Conditional
s for OS detection.
- Autoconfiguration
- Bean of type io.github.bitfist.springframework.boot.OperatingSystem named
operatingSystem
- Conditional @ConditionalOnOperatingSystem annotation
@Configuration(proxyBeanMethods = false)
@ConditionalOnOperatingSystem(OperatingSystem.WINDOWS)
public class WindowsConfiguration {
// ...
}
@Configuration
public class SomeConfiguration {
@Bean
Object someBeanProducer(OperatingSystem operatingSystem) {
// ...
}
}
The GitHub documentation explains in detail how to use GitHub packages.