@Test public void interfaceTraced() throws IOException { Resource resource = new ClassPathResource("/application.test.properties"); Properties props = PropertiesLoaderUtils.loadProperties(resource); LogTraceAspect traceAspect = super.applicationContext.getBean(LogTraceAspect.class); logConfigs.setEnvironment(props.get("log.environment").toString()); // 所谓接口拦截是拦截所有非接口类后分析是否有接口拦截注解,造成所有非实现类可能被拦截两次。因此不适合拦截应用 int oldLogsCount = this.countRowsInTable(LOG_TABLE_NAME); proposalService.testInterfaceTraced(); // proposalService.save(); ThreadUtils.sleep(1000 * 3); Assert.assertEquals(oldLogsCount + 1, this.countRowsInTable(LOG_TABLE_NAME)); }