春ブートサポートがクラス定義に新しい日付のために必要とされる場合、以下のコメントは@Configurationを持つクラスまたはクラスの先頭に追加する必要がjsr310 LOCALDATE、LocalDateTimeを、同様に、春・データ-JPAを使用した場合:
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters;
@EntityScan(
basePackageClasses = {ServicePromotionApplication.class, Jsr310JpaConverters.class}
)
public class ServicePromotionApplication {
public static void main(String[] args) {
SpringApplication.run(ServicePromotionApplication.class, args);
}
@StreamListener(PromotionCacheProcessor.SYNC_CACHE)
public void syncPromotionCache(Message<PromotionNoticeVo> message) {
log.info("接收到Spring Cloud Stream消息: {}", message);
long t1 = System.currentTimeMillis();
promotionCacheService.loadCache(message.getPayload().getPromotionType());
long t2 = System.currentTimeMillis();
log.info("处理消息结束, 耗时: {}ms", t2 - t1);
}
@StreamListener(PromotionCacheProcessor.SYNC_RECEIVED)
public void syncPromotionReceived(Message<PromotionNoticeVo> message) {
log.info("接收到Spring Cloud Stream消息: {}", message);
long t1 = System.currentTimeMillis();
promotionCacheService.loadCache(message.getPayload().getPromotionType());
long t2 = System.currentTimeMillis();
log.info("处理消息结束, 耗时: {}ms", t2 - t1);
}
}