upgrade spring-boot project, extract auto-config, remove security

This commit is contained in:
Loredana Crusoveanu
2018-05-06 21:19:41 +03:00
parent c0131fdd8a
commit b4d4d4ec08
64 changed files with 325 additions and 373 deletions
@@ -1,6 +1,7 @@
package com.baeldung.toggle;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
@@ -10,7 +11,7 @@ import org.springframework.stereotype.Component;
@Component
public class FeaturesAspect {
private static final Logger LOG = Logger.getLogger(FeaturesAspect.class);
private static final Logger LOG = LogManager.getLogger(FeaturesAspect.class);
@Around(value = "@within(featureAssociation) || @annotation(featureAssociation)")
public Object checkAspect(ProceedingJoinPoint joinPoint, FeatureAssociation featureAssociation) throws Throwable {
@@ -11,7 +11,7 @@ public class SalaryService {
@FeatureAssociation(value = MyFeatures.EMPLOYEE_MANAGEMENT_FEATURE)
public void increaseSalary(long id) {
Employee employee = employeeRepository.findOne(id);
Employee employee = employeeRepository.findById(id).orElse(null);
employee.setSalary(employee.getSalary() + employee.getSalary() * 0.1);
employeeRepository.save(employee);
}
@@ -5,9 +5,7 @@ import javax.annotation.security.RolesAllowed;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.baeldung.autoconfiguration.MySQLAutoconfiguration;
@SpringBootApplication(exclude = MySQLAutoconfiguration.class)
@SpringBootApplication
public class ToggleApplication {
@RolesAllowed("*")
public static void main(String[] args) {