transactional configuration move to command handlers

This commit is contained in:
Michał Michaluk
2018-02-22 22:33:47 +01:00
parent f1132df0a3
commit 93a7732854
9 changed files with 20 additions and 23 deletions

View File

@@ -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);
}

View File

@@ -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));