我的Facebook登录流程分为几个步骤:
用户被重定向到授权URL:
https://www.facebook.com/dialog/oauth/?client_id= {...}&redirect_uri = {...}&scope = {...}&state = {...}
用户身份验证后,我得到验证码(codefacebook请求中的字段)
我使用code参数来获取请求中的访问令牌,如下所示:
https://graph.facebook.com/oauth/access_token?client_id= {...}&client_secret = {...}&redirect_uri = {...}&code = {...}
我想使用Facebook测试用户为我的Facebook登录流程编写一个自动化测试。但是为此,我需要获取code参数。
如何code像实际用户登录一样为Facebook测试用户获取参数?
真的在等待您的帮助!
在使用 Spring AOP 之前,我有一个这样的工作代码:
@Controller
public class UserChoiceController {
@Autowired
private CityPropertyEditor cityPropertyEditor;
//...
}
Run Code Online (Sandbox Code Playgroud)
在哪里
@Component("cityPropertyEditor")
public class CityPropertyEditor extends java.beans.PropertyEditorSupport {
//...
}
Run Code Online (Sandbox Code Playgroud)
在哪里
@Component
public class java.beans.PropertyEditorSupport implements java.beans.PropertyEditor {
//...
}
Run Code Online (Sandbox Code Playgroud)
我的 CityPropertyEditor 自动装配工作正常。但是在为所有方法添加 Spring AOP 切入点之后:
@Pointcut("execution(* my.package.name..*.*(..))")
private void allMethodsExecution(){}
Run Code Online (Sandbox Code Playgroud)
CityPropertyEditor 的自动装配崩溃了。事实上,bean 不再属于 CityPropertyEditor 类,而只是 PropertyEditor:
applicationContext.getBean("cityPropertyEditor") instanceof CityPropertyEditor; // returns false
applicationContext.getBean("cityPropertyEditor") instanceof PropertyEditorSupport; // returns false
applicationContext.getBean("cityPropertyEditor") instanceof PropertyEditor; // unexpectedly returns TRUE!
Run Code Online (Sandbox Code Playgroud)
所以我不得不将类从 CityPropertyEditor 更改为 PropertyEditor 作为解决方法。有趣的是,它只涉及这个 bean。每个其他 bean 都像以前一样自动装配。我怎样才能以正确的方式解决它(不使用 bean …