spring-guides/gs-spring-boot-docker

Gradle, how to deal with viewResolver inside Docker

kopax opened this issue · 3 comments

kopax commented

In order to customize my login form, I have set the following bean :

	@Bean
	public InternalResourceViewResolver resolver(){
		InternalResourceViewResolver resolver = new InternalResourceViewResolver();
		resolver.setPrefix("/WEB-INF/views/");
		resolver.setSuffix(".jsp");
		return resolver;
	}

I have my jsp file under src/main/webapp/WEB-INF/views/login.jsp

This work fine outside docker, but with docker I get the following error :

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Mon Dec 05 12:54:59 GMT 2016
There was an unexpected error (type=Not Found, status=404).
/WEB-INF/views/login.jsp

Is it only me or their some missing instruction here ?

dsyer commented

JSP only works with war files I think. I assume you are building a war file? If so you will need the docker command to be java -jar path_to.war. I don't think we need to put anything in this guide about how to run JSPs.

kopax commented

@dsyer I agree for this guide. Just keep it mind this guide is the only accessible guide and people will refer to it when they need spring and docker.

To be honest, It's my first from scratch java web application, I didn't knew about the war.

How do you update this build.gradle in order to get a war instead of a jar ?