我spring4gwt在我的项目中使用.
我有以下登录服务实现:
@Service("loginService")
public class LoginServiceImpl extends RemoteServiceServlet implements LoginService {
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public UserBean checkUser(String userName, String password) throws Exception {
HttpSession httpSession = getThreadLocalRequest().getSession();
}
}
Run Code Online (Sandbox Code Playgroud)
当我调用loginService.checkUser("test","test")(在托管模式下)时,我得到一个NullPointerException,因为getThreadLocalRequest()返回NULL而不是实际的会话.
我还没有尝试过网络模式.
为什么我会得到一个空会话?它与spring4gwt有关吗?