@RequestMapping(value = "/signup", method = RequestMethod.POST)
    public String showSignupForm(Model model, @ModelAttribute SignupCommand command, BindingResult errors) {
        signupValidator.validate(command, errors);

        if (errors.hasErrors()) {
            return showSignupForm(model, command);
        }

        // Create the user
        userService.createUser(command.getUsername(), command.getEmail(), command.getPassword());

        // Login the newly created user
        SecurityUtils.getSubject().login(new UsernamePasswordToken(command.getUsername(), command.getPassword()));

        return "redirect:/s/home";
    }
Web MVC controller that handles signup requests.
samples/spring-hibernate/src/main/java/org/apache/shiro/samples/sprhib/web/SignupController.java