4

My Application : backbone.js based frontend, RESTFUL webservices based backend. I have configured a spring boot standalone application for the above spec. I have used configured spring security for token based authentication. The static content too is bundled inside the jar and served by the embedded tomcat server.

My Question : I've previously seen project setups where front-end and backend are cleanly separated by having webserver - app server setup. Now here I am bound to put both of them inside a bundle. Separation Of Concerns? Or is it better to configure spring boot to create a war for me? I feel spring boot isn't meant for creating wars ..

David Nimmagadda
  • 83
  • 1
  • 1
  • 4
  • 1
    Why? What is creating a WAR buying you? Spring Boot lets you deploy everything in a single package. That's what you need. Don't worry about notions of purity and cleanliness. – duffymo Mar 16 '15 at 11:53
  • I got this doubt when I saw all my static pages go through the WebSecurityConfigurerAdapter that I used ... Might make my tomcat slow right? Here is that question : http://stackoverflow.com/questions/29074285/how-to-ignore-spring-security-config-for-every-thing-except-a-pattern – David Nimmagadda Mar 16 '15 at 11:57
  • If you create a WAR, you still have all resources in the WAR. Spring Boot doesn't prevent you from putting your static resources on your webserver and configure the web server to use its resources instead of forwarding the request to the Spring Boot app (Tomcat is not a web server, it is a servlet container). – dunni Mar 16 '15 at 12:39
  • Thanks for the suggestions guys ... that makes sense, I'll leave my standalone spring boot app as it is and configure an apache web server before it and put my static content there ... – David Nimmagadda Mar 16 '15 at 13:12

2 Answers2

1

You can change packaging from jar to war. But in jar packaging there is one limitation that you can't use JSP Servlets technology, while war support that. To deploy war you have to write descriptor file, war.xml and also you need a server to deploy war, while jar as you know Spring boot gives an inbuilt server. I hope my answer helped.

Anurag
  • 21
  • 4
1

If you are using gradle as a build tool, you can simply use

apply plugin: 'war'

gradle war

to create a war

Community
  • 1
  • 1
Simon
  • 629
  • 3
  • 8