79549613

Date: 2025-04-02 03:41:27
Score: 0.5
Natty:
Report link

You can use @ConditionalOnProperty to restrict startup conditions

@Component
@ConditionalOnProperty(name = "refresh.interval")
public class TestConfig {
    
    @Scheduled(fixedRateString = "${refresh.interval}")
    public void refresh() {
        System.out.println("refresh");
    }
}
Reasons:
  • Whitelisted phrase (-1.5): You can use
  • Low length (0.5):
  • Has code block (-0.5):
  • User mentioned (1): @ConditionalOnProperty
  • Low reputation (1):
Posted by: Feng Wei