我需要一些Spring AOP的帮助.我有以下代码:
@Service
public class UserSecurityService implements UserDetailsService {
@Autowired
private UserService userService;
....
}
Run Code Online (Sandbox Code Playgroud)
@Service
public class UserService extends CrudService<User, UserRepository> {
public UserService() {
super();
}
@Autowired
public UserService(UserRepository repository) {
super(repository);
this.repository = repository;
}
....
}
Run Code Online (Sandbox Code Playgroud)
@Repository
interface UserRepository extends JpaRepository<User, String> {
...
}
Run Code Online (Sandbox Code Playgroud)
应用程序的context.xml
<import resource="classpath*:spring/application-context-db.xml" />
<import resource="classpath*:spring/application-context-aop.xml" />
<import resource="classpath*:spring/application-context-mail.xml" />
<import resource="application-context-security.xml" />
<context:component-scan base-package="com.xpto">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Repository" />
</context:component-scan>
Run Code Online (Sandbox Code Playgroud)
应用程序上下文aop.xml文件
<aop:aspectj-autoproxy />
<aop:config>
<aop:aspect id="serviceLoggingAspect" ref="serviceLoggingAspectBean"> …Run Code Online (Sandbox Code Playgroud)