transactional configuration move to command handlers
This commit is contained in:
@@ -4,8 +4,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
@Configuration
|
||||
class DemandForecastingConfiguration {
|
||||
|
||||
@@ -13,7 +11,6 @@ class DemandForecastingConfiguration {
|
||||
private ProductDemandRepository repository;
|
||||
|
||||
@Bean
|
||||
@Transactional
|
||||
DemandService demandService() {
|
||||
return new DemandService(repository);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.time.Clock;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Component
|
||||
@Transactional
|
||||
@AllArgsConstructor
|
||||
@RepositoryEventHandler
|
||||
public class CommandsHandler {
|
||||
@@ -44,7 +45,6 @@ public class CommandsHandler {
|
||||
|
||||
@Scheduled(cron = "0 0 12 * * ?")
|
||||
@EventListener(ApplicationReadyEvent.class)
|
||||
@Transactional
|
||||
public void clean() {
|
||||
adjustments.deleteByCleanAfterGreaterThanEqual(LocalDate.now(clock));
|
||||
reviews.deleteByCleanAfterGreaterThanEqual(LocalDate.now(clock));
|
||||
|
||||
Reference in New Issue
Block a user