I'm trying to upload a file using Spring MVC and Thymeleaf but I'm getting an exception saying that multi-part configuration has not been provided.
This is my Thymeleaf Form:
<form action="#" th:action="@{/settings/profile}"
    th:object="${profileSettingsForm}" method="POST" enctype="multipart/form-data">
    <div class="form-group">
        <label for="profilePicture">Picture</label> <input type="file"
            th:field="*{profilePicture}" id="profilePicture" name="profilePicture">
    </div>
    <div class="form-group">
        <label for="username">Username</label> <input type="text"
            th:field="*{username}" class="form-control" id="username"
            placeholder="Type your new username">
    </div>
    <div class="form-group">
        <label for="biography">Biography</label>
        <textarea th:field="*{biography}" class="form-control" id="biography"
            rows="3" placeholder="Type your new biography"></textarea>
    </div>
    <button type="submit" class="btn btn-primary">Submit</button>
</form>
This is my form binding class:
public class ProfileSettingsForm {
    private static final String NOT_BLANK_MESSAGE = "{notBlank.message}";
    private MultipartFile profilePicture;
    @NotBlank(message = ProfileSettingsForm.NOT_BLANK_MESSAGE)
    private String username;
    @NotBlank(message = ProfileSettingsForm.NOT_BLANK_MESSAGE)
    private String biography;
    public ProfileSettingsForm() {
    }
    public ProfileSettingsForm(String username, String biography) {
        this.username = username;
        this.biography = biography;
    }
    // Getters and setters
}
Also, I have configured the Multipart resolver as the documentation says in my WebMvcConfig.java like this:
@Bean
public CommonsMultipartResolver multipartResolver() {
    CommonsMultipartResolver resolver = new CommonsMultipartResolver();
    resolver.setDefaultEncoding("utf-8");
    resolver.setMaxUploadSize(10000);
    return resolver;
}
Why is the upload form not working even when I have set up my MultiPartResolver? Am I missing something?