-
是spring框架在你拋出的異常是Exception不會發生回滾,必須是RuntimeException的時候才會回滾,所以在寫自己的異常類的時候需要繼承RuntimeException,才能讓spring識別,事務才能成功。查看全部
-
@Before("log()") public void doBefore(JoinPoint joinPoint) { ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); HttpServletRequest request = (HttpServletRequest) attributes.getRequest(); logger.info("url={}", request.getRequestURL()); logger.info("method={}", request.getMethod()); logger.info("ip={}", request.getRemoteAddr()); logger.info("class_method={}", joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName()); logger.info("args ={}", joinPoint.getArgs()); logger.info("111111111111111111111111111111"); } @AfterReturning(returning = "object", pointcut = "log()") public void doAfterReturn(Object object) { logger.info("response={}", object); }查看全部
-
使用spring boot 進行測試查看全部
-
1、切點定義 2、get對象,對象的屬性對應get請求中的key查看全部
-
trrrrr查看全部
-
mvn clean package打包項目時跳過單元測試: mvn clean package -Dmaven.test.skip=true查看全部
-
mvn clean package對項目打包,在打包時會自動執行所有單元測試查看全部
-
對Controller的單元測試,使用MockMvc類,自動注入后,調用mockMvc.perform(MockMvcRequestBuilders.get("[url]")).andExpect(MockMvcResultMatchers.status().isOk());查看全部
-
對Controller單元測試的方式: 三個注解為, 1. @RunWith(SpringRunner.class) 2. @SpringBootTest 3. @AutoConfigureMockMvc查看全部
-
單元測試注解: 1.@RunWith(SpringRunner.class) 2.@SpringBootTest查看全部
-
單元測試查看全部
-
@AfterReturning用法查看全部
-
joinPoint用法和requestAttributes用法查看全部
-
AOP使用實例,girlList方法中的兩個點(..)表示傳入任意參數都會被攔截查看全部
-
Aspect使用實例(攔截)查看全部
舉報
0/150
提交
取消