{"id":142376,"date":"2026-03-30T20:26:35","date_gmt":"2026-03-30T17:26:35","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=142376"},"modified":"2026-03-30T20:26:38","modified_gmt":"2026-03-30T17:26:38","slug":"spring-boot-with-postgresql-on-heroku","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html","title":{"rendered":"Spring Boot With PostgreSQL On Heroku"},"content":{"rendered":"<p>In modern cloud-native applications, deploying backend services on platforms like Heroku and connecting them to managed databases such as PostgreSQL is a common practice. Heroku provides a fully managed PostgreSQL service (Heroku Postgres), which simplifies database provisioning, scaling, and maintenance. Let us delve into understanding Spring Boot, PostgreSQL, and Heroku.<\/p>\n<h2><a name=\"section-1\"><\/a>1. Introduction to Heroku Platform<\/h2>\n<p><a href=\"https:\/\/www.heroku.com\" target=\"_blank\" rel=\"noopener\">Heroku<\/a> is a cloud Platform as a Service (PaaS) that enables developers to build, run, and deploy applications without worrying about underlying infrastructure management. It abstracts away complexities such as server provisioning, load balancing, scaling, and maintenance, allowing developers to focus purely on application development. With support for multiple programming languages including Java, Node.js, Python, and more, Heroku provides a flexible environment for modern application development.<\/p>\n<p>One of the key concepts in Heroku is the use of <code>dynos<\/code>, which are lightweight, isolated containers that run your application processes. These dynos can be scaled horizontally to handle increased traffic, making Heroku highly suitable for scalable applications. Additionally, Heroku follows a strict twelve-factor app methodology, encouraging best practices such as environment-based configuration, stateless processes, and dependency management.<\/p>\n<p>Heroku also offers a rich ecosystem of add-ons, which are third-party services that can be easily integrated into your application. One of the most commonly used add-ons is Heroku Postgres, a fully managed PostgreSQL database service. It handles tasks such as backups, replication, failover, and scaling, significantly reducing operational overhead for developers.<\/p>\n<p>Another important aspect of Heroku is its use of environment variables for configuration. Instead of hardcoding sensitive information like database credentials, Heroku provides them dynamically through variables such as <code>DATABASE_URL<\/code>. This approach improves security and makes applications more portable across environments.<\/p>\n<p>Deployment on Heroku is also streamlined through Git-based workflows. Developers can push their code directly to Heroku, which then automatically detects the application type, installs dependencies, builds the project, and deploys it. This continuous deployment-like experience makes it extremely efficient to iterate and release updates quickly.<\/p>\n<p>Overall, Heroku simplifies the process of deploying and managing backend services, especially when combined with managed databases like PostgreSQL. It is an excellent choice for developers looking to build cloud-native applications with minimal infrastructure management while maintaining scalability, reliability, and ease of use.<\/p>\n<h2><a name=\"section-2\"><\/a>2. End-to-End Implementation<\/h2>\n<h3>2.1 Prerequisites and Environment Setup<\/h3>\n<p>To get started, ensure you have Java 17 or a later version installed on your system, along with a properly configured Spring Boot project. You should also have the Heroku CLI installed and set up to manage deployments and interact with your Heroku environment. Additionally, Git must be installed and configured, as it is required for version control and deploying your application to Heroku using Git-based workflows.<\/p>\n<h3>2.2 Project Initialization (Spring Initializr)<\/h3>\n<p>You can generate a Spring Boot project using <a href=\"https:\/\/start.spring.io\/\" target=\"_blank\" rel=\"noopener\">Spring Initializr<\/a> by selecting the required dependencies such as Spring Web for building RESTful APIs, Spring Data JPA for database interaction and ORM support, and the PostgreSQL Driver for connecting your application to a PostgreSQL database. These dependencies provide a solid foundation for building and integrating your application with a relational database.<\/p>\n<h3>2.3 Setting Up Heroku and PostgreSQL<\/h3>\n<p>Before deploying your Spring Boot application, you need to set up your Heroku environment. This includes authenticating your account, creating a new Heroku application, and provisioning a managed PostgreSQL database. Heroku provides an easy-to-use CLI that simplifies these steps and allows you to manage your application directly from the terminal.<\/p>\n<pre class=\"brush:plain; wrap-lines:false;\"># Login to Heroku\nheroku login\n\n# Create app\nheroku create your-app-name\n\n# Add PostgreSQL addon\nheroku addons:create heroku-postgresql:hobby-dev\n<\/pre>\n<p>Once these steps are completed, your Heroku application will be ready with a provisioned PostgreSQL instance. You can verify the database credentials using the Heroku dashboard or CLI, and then proceed to configure your Spring Boot application to connect to this database using the provided environment variables.<\/p>\n<h3>2.4 Adding Required Dependencies<\/h3>\n<p>To enable database interaction in your Spring Boot application, you need to include the required dependencies in your <code>pom.xml<\/code> file. These dependencies allow your application to use JPA for ORM (Object Relational Mapping) and establish a connection with a PostgreSQL database. Spring Boot simplifies configuration by auto-configuring many components based on these dependencies.<\/p>\n<pre class=\"brush:xml; wrap-lines:false;\">&lt;dependencies&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;\/artifactId&gt;\n    &lt;\/dependency&gt;\n\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.postgresql&lt;\/groupId&gt;\n        &lt;artifactId&gt;postgresql&lt;\/artifactId&gt;\n    &lt;\/dependency&gt;\n&lt;\/dependencies&gt;\n<\/pre>\n<p>The <code>spring-boot-starter-data-jpa<\/code> dependency provides support for working with relational databases using JPA and Hibernate, including features like entity management, repositories, and transaction handling. The PostgreSQL driver dependency enables your application to communicate with a PostgreSQL database by handling the low-level connection details. Once these are added, Spring Boot will automatically configure the datasource if the necessary database properties are provided.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h3>2.5 Configuring Database Connection (DATABASE_URL)<\/h3>\n<p>Once your PostgreSQL database is provisioned on Heroku, the platform automatically provides the connection details through an environment variable called <code>DATABASE_URL<\/code>. This URL contains all the necessary information such as username, password, host, port, and database name in a single string. Understanding this format is important before integrating it with your Spring Boot application.<\/p>\n<p>Heroku provides the database URL in the following format:<\/p>\n<pre class=\"brush:java; wrap-lines:false;\">postgres:\/\/username:password@host:port\/dbname\n<\/pre>\n<p>However, Spring Boot does not natively support this URL format. Instead, it expects individual properties like <code>spring.datasource.url<\/code>, <code>username<\/code>, and <code>password<\/code>. Therefore, you need to parse this URL and extract the required components so they can be configured properly within your application. This step ensures a successful connection between your Spring Boot application and the Heroku PostgreSQL database.<\/p>\n<h3>2.6 Custom DataSource Configuration<\/h3>\n<p>To connect your Spring Boot application with the Heroku PostgreSQL database, you need to programmatically configure a <code>DataSource<\/code>. Since Heroku provides the database connection as a single environment variable (<code>DATABASE_URL<\/code>), this configuration class parses that URL and converts it into a format that Spring Boot understands. This approach ensures your application can dynamically read database credentials at runtime without hardcoding them.<\/p>\n<pre class=\"brush:java; wrap-lines:false;\">\/\/ DataSourceConfig.java\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\n\nimport javax.sql.DataSource;\nimport java.net.URI;\n\nimport org.springframework.boot.jdbc.DataSourceBuilder;\n\n@Configuration\npublic class DataSourceConfig {\n\n    @Bean\n    public DataSource dataSource() {\n        try {\n            String databaseUrl = System.getenv(\"DATABASE_URL\");\n            URI dbUri = new URI(databaseUrl);\n\n            String username = dbUri.getUserInfo().split(\":\")[0];\n            String password = dbUri.getUserInfo().split(\":\")[1];\n            String jdbcUrl = \"jdbc:postgresql:\/\/\" + dbUri.getHost() + \":\" + dbUri.getPort() + dbUri.getPath();\n\n            return DataSourceBuilder.create()\n                    .url(jdbcUrl)\n                    .username(username)\n                    .password(password)\n                    .driverClassName(\"org.postgresql.Driver\")\n                    .build();\n\n        } catch (Exception e) {\n            throw new RuntimeException(\"Failed to configure DataSource\", e);\n        }\n    }\n}\n<\/pre>\n<p>This configuration reads the <code>DATABASE_URL<\/code> environment variable provided by Heroku and converts it into a standard JDBC URL required by Spring Boot. It extracts the username and password from the URL, constructs the JDBC connection string, and uses <code>DataSourceBuilder<\/code> to create a fully configured <code>DataSource<\/code> bean. By defining this as a <code>@Bean<\/code>, Spring Boot automatically uses it across the application for database operations.<\/p>\n<h3>2.7 Defining JPA Entity<\/h3>\n<p>In a Spring Boot application using JPA, an entity represents a table in the database. Each instance of the entity corresponds to a row in that table. To map your Java class to a database table, you use JPA annotations such as <code>@Entity<\/code>, which tells Spring Boot and Hibernate to treat this class as a persistent entity.<\/p>\n<pre class=\"brush:java; wrap-lines:false;\">\/\/ User.java\nimport jakarta.persistence.*;\n\n@Entity\npublic class User {\n\n    @Id\n    @GeneratedValue(strategy = GenerationType.IDENTITY)\n    private Long id;\n\n    private String name;\n\n    \/\/ getters and setters\n}\n<\/pre>\n<p>In this example, the <code>User<\/code> class is mapped to a database table (by default, the table name will be <code>user<\/code>). The <code>@Id<\/code> annotation marks the primary key of the table, while <code>@GeneratedValue<\/code> with <code>GenerationType.IDENTITY<\/code> ensures that the database automatically generates unique values for the <code>id<\/code> field. The <code>name<\/code> field is mapped to a column in the table. Getters and setters are required for JPA to access and manage the entity\u2019s state. Once defined, this entity can be used with Spring Data JPA repositories to perform CRUD operations seamlessly.<\/p>\n<h3>2.8 Creating Repository Layer<\/h3>\n<p>After defining your entity, the next step is to create a repository interface that will handle database operations. Spring Data JPA provides a powerful abstraction that eliminates the need to write boilerplate SQL queries. By simply extending the <code>JpaRepository<\/code> interface, you automatically get access to a wide range of CRUD operations such as saving, updating, deleting, and fetching data from the database.<\/p>\n<pre class=\"brush:java; wrap-lines:false;\">\/\/ UserRepository.java\nimport org.springframework.data.jpa.repository.JpaRepository;\n\npublic interface UserRepository extends JpaRepository&lt;User, Long&gt; {\n}\n<\/pre>\n<p>In this example, <code>UserRepository<\/code> manages the <code>User<\/code> entity with a primary key of type <code>Long<\/code>. Spring Boot will automatically create the implementation of this interface at runtime. You can use built-in methods like <code>save()<\/code>, <code>findById()<\/code>, <code>findAll()<\/code>, and <code>deleteById()<\/code> without writing any SQL. Additionally, you can define custom query methods by following naming conventions, such as <code>findByName(String name)<\/code>, and Spring Data JPA will generate the query automatically.<\/p>\n<h3>2.9 Building REST Controller<\/h3>\n<p>The controller layer is responsible for handling incoming HTTP requests and returning appropriate responses. In a Spring Boot application, <code>@RestController<\/code> is used to expose RESTful APIs, allowing clients to interact with your application. This layer acts as a bridge between the client and the repository, processing requests and delegating database operations to the repository layer.<\/p>\n<pre class=\"brush:java; wrap-lines:false;\">\/\/ UserController.java\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.web.bind.annotation.*;\n\nimport java.util.List;\n\n@RestController\n@RequestMapping(\"\/users\")\npublic class UserController {\n\n    @Autowired\n    private UserRepository repository;\n\n    @PostMapping\n    public User createUser(@RequestBody User user) {\n        return repository.save(user);\n    }\n\n    @GetMapping\n    public List&lt;User&gt; getUsers() {\n        return repository.findAll();\n    }\n}\n<\/pre>\n<p>In this example, the <code>@RequestMapping(\"\/users\")<\/code> defines the base URL for all endpoints in this controller. The <code>@PostMapping<\/code> endpoint allows clients to create a new user by sending a JSON request body, which is automatically mapped to the <code>User<\/code> object using <code>@RequestBody<\/code>. The <code>@GetMapping<\/code> endpoint retrieves all users from the database. The <code>@Autowired<\/code> annotation injects the <code>UserRepository<\/code>, enabling seamless interaction with the database. This setup provides a simple yet effective REST API for performing basic CRUD operations.<\/p>\n<h3>2.10 Application Configuration (application.properties)<\/h3>\n<p>The <code>application.properties<\/code> file is used to configure various settings for your Spring Boot application. In this case, it includes important configurations related to JPA, Hibernate, and server behavior. These properties help control how your application interacts with the PostgreSQL database and how it runs in different environments, including Heroku.<\/p>\n<pre class=\"brush:plain; wrap-lines:false;\">spring.jpa.hibernate.ddl-auto=update\nspring.jpa.show-sql=true\nspring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect\nserver.port=${PORT:8080}\n<\/pre>\n<p>The <code>spring.jpa.hibernate.ddl-auto=update<\/code> property ensures that Hibernate automatically updates the database schema based on your entity classes without dropping existing data. The <code>spring.jpa.show-sql=true<\/code> setting enables logging of SQL queries in the console, which is useful for debugging and development. The Hibernate dialect is set to PostgreSQL to ensure compatibility with the database. Finally, <code>server.port=${PORT:8080}<\/code> allows the application to use the port assigned by Heroku dynamically, defaulting to 8080 when running locally. This configuration ensures your application runs smoothly both in local and cloud environments.<\/p>\n<h3>2.11 Deploying Application to Heroku<\/h3>\n<p>Once your application is fully configured and tested locally, the final step is to deploy it to Heroku. Heroku uses Git-based deployment, which makes the process straightforward if your project is already under version control. You will initialize a Git repository (if not already done), commit your code, and push it to the Heroku remote repository to trigger the deployment.<\/p>\n<pre class=\"brush:plain; wrap-lines:false;\">git init\ngit add .\ngit commit -m \"Initial commit\"\n\nheroku git:remote -a your-app-name\ngit push heroku master\n<\/pre>\n<p>The <code>git init<\/code> command initializes a new Git repository, while <code>git add .<\/code> and <code>git commit<\/code> stage and save your project files. The <code>heroku git:remote<\/code> command links your local repository to your Heroku application. Finally, <code>git push heroku master<\/code> uploads your code to Heroku, which automatically builds and deploys the application. Once the deployment is complete, you can access your live application using the URL provided by Heroku.<\/p>\n<h4>2.11.1 Deployment Output and API Testing<\/h4>\n<p>After successfully deploying your application to Heroku, the platform will automatically build and start your Spring Boot application. You can monitor the deployment process and application logs using the Heroku CLI to ensure everything is running correctly. Once the application is up, it will be accessible via the public URL generated by Heroku.<\/p>\n<pre class=\"brush:plain; wrap-lines:false;\">-----&gt; Building on the Heroku platform\n-----&gt; Detecting Java app\n-----&gt; Installing OpenJDK 17\n-----&gt; Building with Maven\n-----&gt; Deploying...\n-----&gt; Launching...\n\nReleased v1\nhttps:\/\/your-app-name.herokuapp.com deployed to Heroku\n<\/pre>\n<p>You can test the deployed APIs using tools like Postman or curl. For example, sending a POST request to <code>\/users<\/code> will create a new user, and a GET request to the same endpoint will return the list of users stored in the PostgreSQL database.<\/p>\n<pre class=\"brush:plain; wrap-lines:false;\">--- (1)\nPOST \/users\n\nRequest:\n{\n  \"name\": \"John Doe\"\n}\n\nResponse:\n{\n  \"id\": 1,\n  \"name\": \"John Doe\"\n}\n\n--- (2)\nGET \/users\n\nResponse:\n[\n  {\n    \"id\": 1,\n    \"name\": \"John Doe\"\n  }\n]\n<\/pre>\n<p>This confirms that your Spring Boot application is successfully connected to Heroku and functioning as expected.<\/p>\n<h2><a name=\"section-3\"><\/a>3. Conclusion<\/h2>\n<p>Connecting a Spring Boot application to Heroku Postgres involves parsing the provided <code>DATABASE_URL<\/code> and configuring a proper DataSource. Once set up, Spring Data JPA handles most of the database interactions seamlessly. This setup is production-ready and scalable, making it ideal for deploying cloud-native Java applications with minimal operational overhead.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In modern cloud-native applications, deploying backend services on platforms like Heroku and connecting them to managed databases such as PostgreSQL is a common practice. Heroku provides a fully managed PostgreSQL service (Heroku Postgres), which simplifies database provisioning, scaling, and maintenance. Let us delve into understanding Spring Boot, PostgreSQL, and Heroku. 1. Introduction to Heroku Platform &hellip;<\/p>\n","protected":false},"author":26931,"featured_media":121875,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[222,657,854],"class_list":["post-142376","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-heroku","tag-postgresql","tag-spring-boot"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Spring Boot With PostgreSQL On Heroku - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Spring boot postgres heroku: Deploy Spring Boot with PostgreSQL on Heroku, configure database, and scale apps easily.\" \/>\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.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Boot With PostgreSQL On Heroku - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Spring boot postgres heroku: Deploy Spring Boot with PostgreSQL on Heroku, configure database, and scale apps easily.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2026-03-30T17:26:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-30T17:26:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2024\/04\/spring-boot-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Yatin Batra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Yatin Batra\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-boot-with-postgresql-on-heroku.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-boot-with-postgresql-on-heroku.html\"},\"author\":{\"name\":\"Yatin Batra\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/cda31a4c1965373fed40c8907dc09b8d\"},\"headline\":\"Spring Boot With PostgreSQL On Heroku\",\"datePublished\":\"2026-03-30T17:26:35+00:00\",\"dateModified\":\"2026-03-30T17:26:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-boot-with-postgresql-on-heroku.html\"},\"wordCount\":1764,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-boot-with-postgresql-on-heroku.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/spring-boot-logo.jpg\",\"keywords\":[\"Heroku\",\"PostgreSQL\",\"Spring Boot\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-boot-with-postgresql-on-heroku.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-boot-with-postgresql-on-heroku.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-boot-with-postgresql-on-heroku.html\",\"name\":\"Spring Boot With PostgreSQL On Heroku - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-boot-with-postgresql-on-heroku.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-boot-with-postgresql-on-heroku.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/spring-boot-logo.jpg\",\"datePublished\":\"2026-03-30T17:26:35+00:00\",\"dateModified\":\"2026-03-30T17:26:38+00:00\",\"description\":\"Spring boot postgres heroku: Deploy Spring Boot with PostgreSQL on Heroku, configure database, and scale apps easily.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-boot-with-postgresql-on-heroku.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-boot-with-postgresql-on-heroku.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-boot-with-postgresql-on-heroku.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/spring-boot-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/spring-boot-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-boot-with-postgresql-on-heroku.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Spring Boot With PostgreSQL On Heroku\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/cda31a4c1965373fed40c8907dc09b8d\",\"name\":\"Yatin Batra\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"caption\":\"Yatin Batra\"},\"description\":\"An experience full-stack engineer well versed with Core Java, Spring\\\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).\",\"sameAs\":[\"https:\\\/\\\/www.javacodegeeks.com\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/yatin-batra\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring Boot With PostgreSQL On Heroku - Java Code Geeks","description":"Spring boot postgres heroku: Deploy Spring Boot with PostgreSQL on Heroku, configure database, and scale apps easily.","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.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html","og_locale":"en_US","og_type":"article","og_title":"Spring Boot With PostgreSQL On Heroku - Java Code Geeks","og_description":"Spring boot postgres heroku: Deploy Spring Boot with PostgreSQL on Heroku, configure database, and scale apps easily.","og_url":"https:\/\/www.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2026-03-30T17:26:35+00:00","article_modified_time":"2026-03-30T17:26:38+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2024\/04\/spring-boot-logo.jpg","type":"image\/jpeg"}],"author":"Yatin Batra","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Yatin Batra","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html"},"author":{"name":"Yatin Batra","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/cda31a4c1965373fed40c8907dc09b8d"},"headline":"Spring Boot With PostgreSQL On Heroku","datePublished":"2026-03-30T17:26:35+00:00","dateModified":"2026-03-30T17:26:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html"},"wordCount":1764,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2024\/04\/spring-boot-logo.jpg","keywords":["Heroku","PostgreSQL","Spring Boot"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html","url":"https:\/\/www.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html","name":"Spring Boot With PostgreSQL On Heroku - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2024\/04\/spring-boot-logo.jpg","datePublished":"2026-03-30T17:26:35+00:00","dateModified":"2026-03-30T17:26:38+00:00","description":"Spring boot postgres heroku: Deploy Spring Boot with PostgreSQL on Heroku, configure database, and scale apps easily.","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2024\/04\/spring-boot-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2024\/04\/spring-boot-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/spring-boot-with-postgresql-on-heroku.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Spring Boot With PostgreSQL On Heroku"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/cda31a4c1965373fed40c8907dc09b8d","name":"Yatin Batra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","caption":"Yatin Batra"},"description":"An experience full-stack engineer well versed with Core Java, Spring\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).","sameAs":["https:\/\/www.javacodegeeks.com"],"url":"https:\/\/www.javacodegeeks.com\/author\/yatin-batra"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/142376","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/26931"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=142376"}],"version-history":[{"count":1,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/142376\/revisions"}],"predecessor-version":[{"id":142523,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/142376\/revisions\/142523"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/121875"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=142376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=142376"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=142376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}