Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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);
}