@Configuration @ConditionalOnProperty(name = "my.autoconfig.enabled", havingValue = "true") public class MyAutoConfiguration { @Bean public MyComponent myComponent() { return new MyComponent(); } } my.autoconfig.enabled=true @Component public class MyApplication { @Autowired private MyComponent myComponent; // ... }


上一篇:
下一篇:
切换中文