我使用sprint boot 1.3,spring 4.2
在这堂课上
@Service
public class PaymentServiceImpl implements PaymentService {
....
@Transactional
@Override
public void processPayment() {
List<Payment> payments = paymentRepository.findDuePayment();
processCreditCardPayment(payments);
}
}
Run Code Online (Sandbox Code Playgroud)
我想每隔x刻拨打一次processPayment.
此x时刻在数据库中设置.用户可以修改它.
所以我想我不能使用anotation.
我开始这样做了
@EntityScan(basePackageClasses = {MyApp.class, Jsr310JpaConverters.class})
@SpringBootApplication
@EnableCaching
@EnableScheduling
public class MyApp {
@Autowired
private DefaultConfigService defaultConfigService;
public static void main(String[] args) {
SpringApplication.run(MyApp.class, args);
}
@Bean
public TaskScheduler poolScheduler() {
SimpleAsyncTaskExecutor taskScheduler = new SimpleAsyncTaskExecutor();
DefaultConfigDto defaultConfigDto = defaultConfigService.getByFieldName("payment-cron-task");
String cronTabExpression = "0 0 4 * * ?";
if (defaultConfigDto != …
Run Code Online (Sandbox Code Playgroud) 在AWS SDK,EC2实例可以通过编程的推出AmazonEC2Client.一般的GCP或计算引擎是否专门为相同的操作提供基于CLI的 gcloud
命令?或者也可以从Java/Python/Go/etc控制GCE实例?哪些SDK适用于这些语言,其示例和文档在哪里?
我在GCP世界中寻找相同的东西:
client = new AmazonEC2Client(credentials);
client.runInstances(new RunInstancesRequest())
Run Code Online (Sandbox Code Playgroud)