參考了官方文件: 20.5.2 SockJS & Relaxing CSRF
但是官方底下的XML案例中有些錯誤, 直接貼上是不能跑了, 看了一下source code, 改成可以跑的寫法如下:
... #{T(org.springframework.security.web.csrf.CsrfFilter).DEFAULT_CSRF_MATCHER}
參考了官方文件: 20.5.2 SockJS & Relaxing CSRF
但是官方底下的XML案例中有些錯誤, 直接貼上是不能跑了, 看了一下source code, 改成可以跑的寫法如下:
... #{T(org.springframework.security.web.csrf.CsrfFilter).DEFAULT_CSRF_MATCHER}
Regular classes or regular classes annotated with the @Aspect annotation.
<br /><br />...
Always represents a method execution.
An interceptor, maintaining a chain of interceptors around the join point.
<br /><br /><br /><br />
A predicate that matches join points.
<br /><br /><br />
execution(modifiers-pattern? ret-type-pattern declaring-type-pattern? name-pattern(param-pattern) throws-pattern?)
Any public method:
execution(public * *(..))
Any method with a name beginning with “set”:
execution(* set*(..))
Any method defined by the AccountService interface:
execution(* com.xyz.service.AccountService.*(..))
Any method defined in the service package:
execution(* com.xyz.service.service.*.*(..))
Any method defined in the service package or a sub-package:
execution(* com.xyz.service..*.*(..))
see more @ Sharing common pointcut definitions
<!-- force to use CGLIB proxies --> <!-- other beans defined here... -->
A style of declaring aspects as regular Java classes annotated with annotations.
In Spring AOP, it is not possible to have aspects themselves be the target of advice from other aspects. The @Aspect annotation on a class marks it as an aspect, and hence excludes it from auto-proxying.
@Aspect public class NotVeryUsefulAspect { @Pointcut("execution(* transfer(..))") // the pointcut expression private void anyOldTransfer() {} }
Enabling @AspectJ Support:
<br />
spring-aop.xml
<br /><br /><br /><br /><br />
EntityAspect
public class EntityAspect { public void prePersist(final GenericEntity entity) { entity.setCreatedTime(LocalDateTime.now()); entity.setModifiedTime(entity.getCreatedTime()); } public void preUpdate(final GenericEntity entity) { entity.setModifiedTime(LocalDateTime.now()); } }