Add @Transactional to controller.

This commit is contained in:
Paulo Gustavo Veiga 2023-11-20 19:47:53 -08:00
parent d26b516eb9
commit 68c8f5c6b8
2 changed files with 7 additions and 8 deletions

View File

@ -21,12 +21,14 @@ import com.wisemapping.exceptions.ClientException;
import com.wisemapping.exceptions.OAuthAuthenticationException; import com.wisemapping.exceptions.OAuthAuthenticationException;
import com.wisemapping.exceptions.Severity; import com.wisemapping.exceptions.Severity;
import com.wisemapping.exceptions.ValidationException; import com.wisemapping.exceptions.ValidationException;
import com.wisemapping.service.NotificationService;
import com.wisemapping.model.User; import com.wisemapping.model.User;
import com.wisemapping.rest.model.RestErrors; import com.wisemapping.rest.model.RestErrors;
import com.wisemapping.security.Utils; import com.wisemapping.security.Utils;
import com.wisemapping.service.NotificationService;
import com.wisemapping.service.RegistrationException; import com.wisemapping.service.RegistrationException;
import org.apache.logging.log4j.Level; import jakarta.servlet.ServletContext;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -39,10 +41,6 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.ResponseStatus;
import jakarta.servlet.ServletContext;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.lang.reflect.UndeclaredThrowableException; import java.lang.reflect.UndeclaredThrowableException;
import java.util.Locale; import java.util.Locale;

View File

@ -24,7 +24,6 @@ import com.wisemapping.rest.model.*;
import com.wisemapping.security.Utils; import com.wisemapping.security.Utils;
import com.wisemapping.service.*; import com.wisemapping.service.*;
import com.wisemapping.validator.MapInfoValidator; import com.wisemapping.validator.MapInfoValidator;
import jakarta.transaction.Transactional;
import org.apache.commons.validator.routines.EmailValidator; import org.apache.commons.validator.routines.EmailValidator;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -36,6 +35,8 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BeanPropertyBindingResult; import org.springframework.validation.BeanPropertyBindingResult;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -48,7 +49,7 @@ import java.util.stream.Collectors;
@Controller @Controller
@Transactional @Transactional(propagation = Propagation.REQUIRED)
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
public class MindmapController extends BaseController { public class MindmapController extends BaseController {
final Logger logger = LogManager.getLogger(); final Logger logger = LogManager.getLogger();