general formatting work
This commit is contained in:
@@ -24,13 +24,16 @@ public class LoggingAspect {
|
||||
};
|
||||
|
||||
@Pointcut("@target(org.springframework.stereotype.Repository)")
|
||||
public void repositoryMethods() {}
|
||||
public void repositoryMethods() {
|
||||
}
|
||||
|
||||
@Pointcut("@annotation(org.baeldung.aop.annotations.Loggable)")
|
||||
public void loggableMethods() {}
|
||||
public void loggableMethods() {
|
||||
}
|
||||
|
||||
@Pointcut("@args(org.baeldung.aop.annotations.Entity)")
|
||||
public void methodsAcceptingEntities() {}
|
||||
public void methodsAcceptingEntities() {
|
||||
}
|
||||
|
||||
@Before("repositoryMethods()")
|
||||
public void logMethodCall(JoinPoint jp) {
|
||||
|
||||
@@ -16,7 +16,8 @@ public class PerformanceAspect {
|
||||
private static Logger logger = Logger.getLogger(PerformanceAspect.class.getName());
|
||||
|
||||
@Pointcut("within(@org.springframework.stereotype.Repository *)")
|
||||
public void repositoryClassMethods() {}
|
||||
public void repositoryClassMethods() {
|
||||
}
|
||||
|
||||
@Around("repositoryClassMethods()")
|
||||
public Object measureMethodExecutionTime(ProceedingJoinPoint pjp) throws Throwable {
|
||||
|
||||
@@ -21,13 +21,16 @@ public class PublishingAspect {
|
||||
}
|
||||
|
||||
@Pointcut("@target(org.springframework.stereotype.Repository)")
|
||||
public void repositoryMethods() {}
|
||||
public void repositoryMethods() {
|
||||
}
|
||||
|
||||
@Pointcut("execution(* *..create*(Long,..))")
|
||||
public void firstLongParamMethods() {}
|
||||
public void firstLongParamMethods() {
|
||||
}
|
||||
|
||||
@Pointcut("repositoryMethods() && firstLongParamMethods()")
|
||||
public void entityCreationMethods() {}
|
||||
public void entityCreationMethods() {
|
||||
}
|
||||
|
||||
@AfterReturning(value = "entityCreationMethods()", returning = "entity")
|
||||
public void logMethodCall(JoinPoint jp, Object entity) throws Throwable {
|
||||
|
||||
@@ -14,9 +14,6 @@ public class Foo {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Foo{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
'}';
|
||||
return "Foo{" + "id=" + id + ", name='" + name + '\'' + '}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,20 +13,19 @@ public class UserController {
|
||||
|
||||
@RequestMapping(value = "/", method = RequestMethod.GET)
|
||||
public String showForm(final Model model) {
|
||||
final User user = new User();
|
||||
user.setFirstname("John");
|
||||
user.setLastname("Roy");
|
||||
user.setEmailId("John.Roy@gmail.com");
|
||||
model.addAttribute("user", user);
|
||||
return "index";
|
||||
final User user = new User();
|
||||
user.setFirstname("John");
|
||||
user.setLastname("Roy");
|
||||
user.setEmailId("John.Roy@gmail.com");
|
||||
model.addAttribute("user", user);
|
||||
return "index";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/processForm", method = RequestMethod.POST)
|
||||
public String processForm(@ModelAttribute(value = "user") final User user,
|
||||
final Model model) {
|
||||
// Insert User into DB
|
||||
model.addAttribute("name", user.getFirstname() + " " + user.getLastname());
|
||||
return "hello";
|
||||
public String processForm(@ModelAttribute(value = "user") final User user, final Model model) {
|
||||
// Insert User into DB
|
||||
model.addAttribute("name", user.getFirstname() + " " + user.getLastname());
|
||||
return "hello";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user