/springboot-mybatis-plus

mybatis-plus, updatewrapper, java scheduled tasks

Primary LanguageJava

Scheduled

Method 1

multi-thread

@Component
@EnableScheduling
@EnableAsync
public class UpdateRecordMultiScheduledTask {

    @Async
    @Scheduled(cron = "0/10 * * * * ?")
    public void theFirstTask() {
        System.err.println("Multi task +++++ " + LocalDateTime.now());
    }
}

Method 2

@Configuration
@EnableScheduling
public class UpdateRecordScheduledTask {

    @Scheduled(cron = "0/5 * * * * ?")
    public void theFirstTask() {
        System.err.println("Scheduled task: ----- " + LocalDateTime.now());
    }
}

mybatis plus

UPDATE

Using UpdateWrapper.

LambdaUpdateWrapper will get WARNING: An illegal reflective access operation has occurred.