尝试实例化此类时出现此错误:
public class ActivationAjaxBehavior extends AbstractAjaxBehavior {
private static final long serialVersionUID = 3103844752146887631L;
private final String tokenKey = "token";
@SpringBean
private RegistrationService registrationService;
public ActivationAjaxBehavior() {
super();
//Injector.get().inject(this);
}
@Override
public void onRequest() {
RequestCycle requestCycle = RequestCycle.get();
ServletWebRequest webRequest = (ServletWebRequest) requestCycle
.getRequest();
HttpServletRequest request = webRequest.getContainerRequest();
String extractedToken = (String) request.getParameter(tokenKey);
try {
registrationService.confirmUser(extractedToken);
proceedToSignInPage();
} catch (WrongTokenException e) {
e.printStackTrace();
proceedToSignUpPage();
}
}
private void proceedToSignInPage() {
throw new RestartResponseException(
SignInPage.class);
}
private void proceedToSignUpPage() {
throw new RestartResponseException(
RegisterPage.class);
}
}
我认为@SpringBean 是这里的问题。但它在弹簧容器中可用......它在其他地方完全可用......
@Bean
public IRegistrationService userRegistrationService() {
return new RegistrationService(databaseBean());
}
与那个注射器未散列它得到
java.lang.RuntimeException: error while injecting object
Superclass has no null constructors but no arguments were given