我是Spring Security的初学者,所以我用两种方法编写了一个控制器:
public class HomeController : Controller
{
SessionHelper mysession = new SessionHelper();
[HttpGet]
[ActionName("Index")]
public ActionResult Index_Get(string Arrival, string Departure, string Rooms, string Persons, string Childrens, )
{
checkURL();
pageload();
ViewBag.Arrival = Arrival;
ViewBag.Departure = Departure;
ViewBag.Rooms = Rooms;
ViewBag.Persons = Persons;
ViewBag.Childrens = Childrens;
return View(mysession);
}
}
弹簧安全性的配置是:
value="@ViewBag.Arrival"
Moncontrôleurfonctionnebien mais lorsque j'utilise la annotation @Secured et j'authentifier j'avais l'exception:
java.lang.NullPointerException:null 在com.upsys.sec.service.EtudiantRestService.saveEtudiant(EtudiantRestService.java:29)〜[classes /:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)〜[na:1.8.0_102] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[na:1.8.0_102] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[na:1.8.0_102] 在java.lang.reflect.Method.invoke(Method.java:498)〜[na:1.8.0_102] 在org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)〜[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE] 在org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)〜[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE] 在org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)〜[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE] 在org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapt ....
答案 0 :(得分:0)
提名saveEtudiant
方法只是一个错误,它是private
我很抱歉。