我正在开发本应在本月晚些时候部署的Spring Boot API。我们为存储库创建了自己的接口,并扩展了CrudRepository。 Spring Boot autowires的一切。装饰弹簧启动存储库
我想要做的是添加更多日志功能,如LOGGER.info("searched for solution ID")
。
目前我们的代码看起来是这样的:
@Repository
public interface ProductSolutionRepository extends CrudRepository<ProductSolution, String> {
public List<ProductSolution> findBySolutionId(@Param("solutionId") int solutionId);
由于Spring配置一切真的没有看到装饰这些功能添加日志记录功能的一种方式。有人可以帮我指点一下文档,展示一个很好的例子,或者解释日志装饰器背后的概念吗?
龙目岛或AOP也许? – Marged
查看https://stackoverflow.com/questions/26258158/how-to-instrument-advice-a-spring-data-jpa-repository,你需要的是AOP –