akuma8 (12) [Avatar] Offline
#1
Hi Craig,

I bought the book and I am reading chapter 2 but it seems like the class WebMvcConfigurerAdapter is deprecated. My Maven's parent version is 2.0.0.M3.

Also could you provide a way of how testing this code, above all the posts methods? How to test JSR 303 validation with Spring?

Thanks a lot.
habuma (277) [Avatar] Offline
#2
akuma8 wrote:Hi Craig,

I bought the book and I am reading chapter 2 but it seems like the class WebMvcConfigurerAdapter is deprecated. My Maven's parent version is 2.0.0.M3.

Also could you provide a way of how testing this code, above all the posts methods? How to test JSR 303 validation with Spring?

Thanks a lot.


Yes, regarding WebMvcConfigurerAdapter...since the MEAP was pushed, I learned that that particular class has gone away in favor of Java 8 default methods in WebMvcConfigurer. I need to update the example, for sure...in the meantime, suffice it to say that instead of extending WebMvcConfigurerAdapter, you can implement WebMvcConfigurer and override the methods the same way.
akuma8 (12) [Avatar] Offline
#3
I extended "WebMvcConfigurationSupport" which is the equivalent in Spring 5.
483055 (1) [Avatar] Offline
#4
I did it this way:

@Configuration
public class WebConfig implements WebMvcConfigurer {

@Override
public void addViewControllers(ViewControllerRegistry registry) {
WebMvcConfigurer.super.addViewControllers(registry);
registry.addViewController("/").setViewName("home");
}

}

and it is working like a charm