Search in sources :

Example 1 with EzyPostInit

use of com.tvd12.ezyfox.bean.annotation.EzyPostInit in project ezyfox-server-example by tvd12.

the class WheelService method postInit.

@EzyPostInit
public void postInit() {
    wheel = wheelRepo.findById("wheel");
    if (wheel == null) {
        wheel = loadWheelFromJsonFile();
        wheelRepo.save(wheel);
    }
    emptyFragments = wheel.getFragments().stream().filter(it -> it.getPrizeType() == WheelPrizeType.EMPTY).collect(Collectors.toList());
    AtomicInteger lastRange = new AtomicInteger(0);
    randomRanges = wheel.getFragments().stream().map(it -> lastRange.addAndGet((int) ((it.getRatio() / 100.0) * RANDOM_MAX_VALUE))).collect(Collectors.toList());
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) EzyPostInit(com.tvd12.ezyfox.bean.annotation.EzyPostInit)

Example 2 with EzyPostInit

use of com.tvd12.ezyfox.bean.annotation.EzyPostInit in project ezyhttp by youngmonkeys.

the class CustomerService method postInit.

@EzyPostInit
public void postInit() {
    save(new Customer(1L, "Hello", 25));
    save(new Customer(2L, "World", 26));
}
Also used : Customer(com.tvd12.ezyhttp.server.boot.test.data.Customer) EzyPostInit(com.tvd12.ezyfox.bean.annotation.EzyPostInit)

Aggregations

EzyPostInit (com.tvd12.ezyfox.bean.annotation.EzyPostInit)2 Customer (com.tvd12.ezyhttp.server.boot.test.data.Customer)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1