我有一些方法会抛出一些异常,我想使用AspectJ来建议计算执行时间,如果抛出一些异常并登录错误日志并通过重新抛出异常继续流程.
我尝试通过以下方式实现这一点,但eclipse说"未处理的异常类型".
代码 - 使用aspectj: -
public interface Iface {
public void reload() throws TException;
public TUser getUserFromUserId(int userId, String serverId) throws ResumeNotFoundException, TException;
public TUser getUserFromUsername(String username, String serverId) throws ResumeNotFoundException, TException;
public TResume getPartialActiveProfileFromUserId(int userId, int sectionsBitField, String serverId) throws ResumeNotFoundException, UserNotFoundException;
public TResume getPartialActiveProfileFromUsername(String username, int sectionsBitField, String serverId) throws ResumeNotFoundException, UserNotFoundException, TException;
}
Run Code Online (Sandbox Code Playgroud)
代码方面j: -
public aspect AspectServerLog {
public static final Logger ERR_LOG = LoggerFactory.getLogger("error");
Object around() : call (* com.abc.Iface.* (..)) {
Object ret; …Run Code Online (Sandbox Code Playgroud) 我正在为一个 api 创建一个 OpenAPI 3 规范,该规范具有需要某些属性的对象,而对于某些对象来说,它们是任意的。当我创建如下规范时,它会抛出一个错误,我无法修复该错误。
EnrollementRequest:
type: object
properties:
consent:
$ref: "#/components/schemas/ConsentEnum"
cid:
$ref: '#/components/schemas/CID'
card:
$ref: '#/components/schemas/Card'
enrollmentDateTime :
description: The date and time of enrollment with respective timezone
format: date-time
example: 2018-11-13T20:20:39+00:00
campaign_code:
description: the campaign-code for which customer wants to enroll
type: string
offer_code:
description: the offer-code for which customer wants to enroll
type: string
channelInfo:
$ref: '#/components/schemas/Channel'
required:
- consent
- cid
- enrollmentDateTime
- channelInfo
anyOf:
- campaign_code
- offer_code
Run Code Online (Sandbox Code Playgroud)
Swagger 编辑器给出如下错误 -
Errors …Run Code Online (Sandbox Code Playgroud)