/** * Set the view names (or name patterns) that can be handled by this view * resolver. View names can contain simple wildcards such that 'my*', '*Report' * and '*Repo*' will all match the view name 'myReport'. * @see UrlBasedViewResolver#setViewNames */ public UrlBasedViewResolverRegistration viewNames(String... viewNames) { this.viewResolver.setViewNames(viewNames); return this; }
@Test public void viewNames() throws Exception { this.resolver.setViewClass(TestView.class); this.resolver.setViewNames("my*"); Mono<View> mono = this.resolver.resolveViewName("my-view", Locale.US); assertNotNull(mono.block()); mono = this.resolver.resolveViewName("not-my-view", Locale.US); assertNull(mono.block()); }
/** * Set the view names (or name patterns) that can be handled by this view * resolver. View names can contain simple wildcards such that 'my*', '*Report' * and '*Repo*' will all match the view name 'myReport'. * @see UrlBasedViewResolver#setViewNames */ public UrlBasedViewResolverRegistration viewNames(String... viewNames) { this.viewResolver.setViewNames(viewNames); return this; }