2011-10-21 3 views
0

캐스트 나는 현재 내 스프링 MVC 프로젝트를 많이에서 다음을 수행하십시오 스프링 MVC는 주요한 목적

protected String onSubmit(UploadMessagesCommand command, Principal principal) throws Exception { 
    MyCustomUserDetailsImpl user = (MyCustomUserDetailsImpl) principal; 
    //etc 
} 

는이 작업을 얻기의 더 나은 방법이있다, 그래서 사용자 인수와 함께 주요 인수를 대체 할 수 있습니다 캐스트를 피하시겠습니까?

답변

3

나는 사용자 (세부 정보)를 직접 사용할 수 있다는 것을 탄력적으로 나타 냈습니다.

protected String onSubmit(UploadMessagesCommand command, User user) throws Exception { 
    //etc 
}