Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java

Add user registration?

How would I go about adding user registration to the todo today website.

So far I have created a signup form and in SecurityConfig allow access to that form. Submitting the /signup form posts to /signup and I get an error.

org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/bytecode/instrumentation/internal/FieldInterceptionHelper

In the controller, the post method for /signup validates input looks like this

@RequestMapping(value = "/signup", method = RequestMethod.POST)
    public String add(@Valid User user, BindingResult bindingResult, Model model, RedirectAttributes redirectAttributes) {
        if (bindingResult.hasErrors()) {
            return "home/signup";
        }
        String password = user.getPassword();
        String encodedPassword = new BCryptPasswordEncoder(10).encode(password);
        user.setPassword(encodedPassword);
        userService.save(user);

        redirectAttributes.addFlashAttribute("flash",
                new FlashMessage("You have successfully signed up! You may now login.", "alert-success"));

        return "redirect:/login";
}

the user service looks like this...

@Override
public void save(User user) {
        userDao.save(user);
}

my userDao looks like this...

@Repository
public interface UserDao extends CrudRepository<User, Long> {
    User findByUsername(String username);
    User save(User user);
}