{"id":5759,"date":"2020-01-10T18:14:52","date_gmt":"2020-01-10T12:44:52","guid":{"rendered":"https:\/\/www.innovationm.com\/blog\/?p=5759"},"modified":"2026-01-14T11:44:48","modified_gmt":"2026-01-14T06:14:48","slug":"externalize-property-file-for-traditional-war-deployment-in-spring-boot","status":"publish","type":"post","link":"https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/","title":{"rendered":"Externalize Property File for Traditional War Deployment in Spring Boot"},"content":{"rendered":"<p>Sometimes we have to configure property files from outside of classpath so that anyone can access this file without looking into application. Spring boot provides many ways to configure this but most of them are used only if we read the property file from classpath if we are going to read from file system then it will not accessible and will get some error so now we are going to see how to overcome from this problem.<\/p>\n<p><strong>Spring-boot default search for property file is :<\/strong><\/p>\n<ol>\n<li>\/config subdirectory of the current directory<\/li>\n<li>The current directory<\/li>\n<li>A classpath \/config package<\/li>\n<li>The classpath root<\/li>\n<\/ol>\n<p>This is the standard order.<\/p>\n<p>To externalize property file we have to override configure the location of application by changing the property of spring.config.location.<\/p>\n<p>If we use spring.config.location property then it will replace default location of property file and profile setup also. we can provide additional locations also which will be searched before the default locations.<\/p>\n<pre class=\"lang:js decode:true\">@SpringBootApplication\r\npublic class Application extends SpringBootServletInitializer {\r\n\r\n\/\/ set spring.config.location here if we want to run the application as a jar\r\npublic static void main(String[] args) {\r\n\r\nnew SpringApplicationBuilder(Application.class)\r\n.sources(Application.class)\r\n.properties(getProperties())\r\n.run(args);\r\n\r\n}<\/pre>\n<p>\/\/ set spring.config.location here if we want to deploy the application as a war on tomcat<\/p>\n<pre class=\"lang:js decode:true \">@Override\r\nprotected SpringApplicationBuilder configure(SpringApplicationBuilder springApplicationBuilder) {\r\nreturn springApplicationBuilder\r\n.sources(Application.class)\r\n.properties(getProperties());\r\n}\r\n\r\nstatic Properties getProperties() {\r\nProperties props = new Properties();\r\nprops.put(\"spring.config.location\",\"file:\/\/\/D:\/file_dir\/application.properties\");\r\nreturn props;\r\n}\r\n\r\n}\r\n\r\n<\/pre>\n<p><span style=\"font-size: 1rem;\"><strong>Conclusion:<\/strong><\/span><\/p>\n<p>In this post, I explained how you can run your Spring Boot application on external Tomcat. For me, this was a real-world situation where I had to solve this query.<\/p>\n<p>Hopefully, this will provide some useful knowledge when you will face a similar problem. If you like my post, do not forget to share!<\/p>\n<p>Lastly, for deeper understanding, I suggest you read the official Spring documentation\u00a0here.<\/p>\n<p>As we can see, the Spring Boot framework itself takes care of externalized configuration for us.<br \/>\nOften, we just have to place the property values in the correct files and locations, but we can also use Spring&#8217;s Java API for more control.<\/p>\n<p>InnovationM is a globally renowned\u00a0Mobile <a href=\"https:\/\/www.innovationm.com\/services\/app-development\/india\/\">app development company in India<\/a>\u00a0that caters to a strong &amp; secure Android app development, iOS app development, hybrid app development services. Our commitment &amp; engagement towards our target gives us brighter in the world of technology and has led us to establish success stories consecutively which makes us the best\u00a0iOS app development company in India.<\/p>\n<p>Thanks for giving your valuable time. Keep reading and keep learning.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes we have to configure property files from outside of classpath so that anyone can access this file without looking into application. Spring boot provides many ways to configure this but most of them are used only if we read the property file from classpath if we are going to read from file system then [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5760,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[256,441],"tags":[],"class_list":["post-5759","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java-application","category-spring-boot"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Externalize Property File for Traditional War Deployment in Spring Boot - InnovationM - Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Externalize Property File for Traditional War Deployment in Spring Boot - InnovationM - Blog\" \/>\n<meta property=\"og:description\" content=\"Sometimes we have to configure property files from outside of classpath so that anyone can access this file without looking into application. Spring boot provides many ways to configure this but most of them are used only if we read the property file from classpath if we are going to read from file system then [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/\" \/>\n<meta property=\"og:site_name\" content=\"InnovationM - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-10T12:44:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-14T06:14:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/01\/Blog-Spring-boot.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1141\" \/>\n\t<meta property=\"og:image:height\" content=\"634\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"InnovationM Admin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InnovationM Admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\\\/\"},\"author\":{\"name\":\"InnovationM Admin\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"headline\":\"Externalize Property File for Traditional War Deployment in Spring Boot\",\"datePublished\":\"2020-01-10T12:44:52+00:00\",\"dateModified\":\"2026-01-14T06:14:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\\\/\"},\"wordCount\":372,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/Blog-Spring-boot.png\",\"articleSection\":[\"Java Application\",\"Spring Boot\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\\\/\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\\\/\",\"name\":\"Externalize Property File for Traditional War Deployment in Spring Boot - InnovationM - Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/Blog-Spring-boot.png\",\"datePublished\":\"2020-01-10T12:44:52+00:00\",\"dateModified\":\"2026-01-14T06:14:48+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/Blog-Spring-boot.png\",\"contentUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/Blog-Spring-boot.png\",\"width\":1141,\"height\":634,\"caption\":\"Externalize Property File for Traditional War Deployment in Spring Boot\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Externalize Property File for Traditional War Deployment in Spring Boot\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\",\"name\":\"InnovationM - Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\",\"name\":\"InnovationM Admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"caption\":\"InnovationM Admin\"},\"sameAs\":[\"http:\\\/\\\/www.innovationm.com\\\/\"],\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/author\\\/innovationmadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Externalize Property File for Traditional War Deployment in Spring Boot - InnovationM - Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/","og_locale":"en_US","og_type":"article","og_title":"Externalize Property File for Traditional War Deployment in Spring Boot - InnovationM - Blog","og_description":"Sometimes we have to configure property files from outside of classpath so that anyone can access this file without looking into application. Spring boot provides many ways to configure this but most of them are used only if we read the property file from classpath if we are going to read from file system then [&hellip;]","og_url":"https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/","og_site_name":"InnovationM - Blog","article_published_time":"2020-01-10T12:44:52+00:00","article_modified_time":"2026-01-14T06:14:48+00:00","og_image":[{"width":1141,"height":634,"url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/01\/Blog-Spring-boot.png","type":"image\/png"}],"author":"InnovationM Admin","twitter_misc":{"Written by":"InnovationM Admin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/#article","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/"},"author":{"name":"InnovationM Admin","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"headline":"Externalize Property File for Traditional War Deployment in Spring Boot","datePublished":"2020-01-10T12:44:52+00:00","dateModified":"2026-01-14T06:14:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/"},"wordCount":372,"commentCount":0,"image":{"@id":"https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/01\/Blog-Spring-boot.png","articleSection":["Java Application","Spring Boot"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/","url":"https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/","name":"Externalize Property File for Traditional War Deployment in Spring Boot - InnovationM - Blog","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/#primaryimage"},"image":{"@id":"https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/01\/Blog-Spring-boot.png","datePublished":"2020-01-10T12:44:52+00:00","dateModified":"2026-01-14T06:14:48+00:00","author":{"@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"breadcrumb":{"@id":"https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/#primaryimage","url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/01\/Blog-Spring-boot.png","contentUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/01\/Blog-Spring-boot.png","width":1141,"height":634,"caption":"Externalize Property File for Traditional War Deployment in Spring Boot"},{"@type":"BreadcrumbList","@id":"https:\/\/www.innovationm.com\/blog\/externalize-property-file-for-traditional-war-deployment-in-spring-boot\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.innovationm.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Externalize Property File for Traditional War Deployment in Spring Boot"}]},{"@type":"WebSite","@id":"https:\/\/www.innovationm.com\/blog\/#website","url":"https:\/\/www.innovationm.com\/blog\/","name":"InnovationM - Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.innovationm.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed","name":"InnovationM Admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","caption":"InnovationM Admin"},"sameAs":["http:\/\/www.innovationm.com\/"],"url":"https:\/\/www.innovationm.com\/blog\/author\/innovationmadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/5759","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/comments?post=5759"}],"version-history":[{"count":1,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/5759\/revisions"}],"predecessor-version":[{"id":8919,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/5759\/revisions\/8919"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media\/5760"}],"wp:attachment":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media?parent=5759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/categories?post=5759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/tags?post=5759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}