Spring Boot Web - Override WebJar resource

577 Views Asked by At

3rd-party WebJar contains JSP file in the root of resources folder. So I can get this page by URL like http://host/app/target.jsp

Now I want to override this target.jsp in my codebase. I've tried to put this JSP into the root of resources folder and also to resources/static folder with the same name, but no luck it still using WebJar file.

What tricks should I perform to resolve this issue?

Thanks in advance.

1

There are 1 best solutions below

1
On

Try to add a new view controller as given below and move custom JSP to another folder.

@Configuration
@EnableWebMvc
public class WebAppConfigurator extends WebMvcConfigurerAdapter{

@Override
public void addViewControllers(ViewControllerRegistry registry) {
    registry.addViewController("target.jsp").setViewName("/custom/target.jsp");
}