{"id":18976,"date":"2022-09-20T18:00:00","date_gmt":"2022-09-21T01:00:00","guid":{"rendered":"https:\/\/coderpad.io\/?post_type=programming-language&#038;p=18976"},"modified":"2023-06-06T06:02:35","modified_gmt":"2023-06-06T13:02:35","slug":"spring","status":"publish","type":"programming-language","link":"https:\/\/coderpad.io\/languages\/java\/spring\/","title":{"rendered":"Java\/Spring"},"content":{"rendered":"\n<p>The Spring Framework is an application framework and inversion of control container for the Java platform.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Running Spring\/SpringBoot + Thymeleaf + PostgreSQL on CoderPad<\/strong><\/h2>\n\n\n\n<p>The SpringBoot pad is configured to connect to a <a href=\"https:\/\/www.postgresql.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">PostgreSQL <\/a>database. It uses the ORM tool <a href=\"https:\/\/hibernate.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Hibernate<\/a> to make it easy to interact with the database. Changes are automatically compiled as you type them, and you can add as many files to the project as you need. Refresh the iframe after compilation is complete to see your changes reflected in the output.<\/p>\n\n\n\n<p>To get started, edit the <code>src\/main\/java\/codinpad\/controller\/EmployeeController.java<\/code> file, and query your API to see the response.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Accessing your API<\/strong><\/h2>\n\n\n\n<p>We&#8217;ve installed <code><a href=\"https:\/\/curl.se\/\" target=\"_blank\" rel=\"noreferrer noopener\">curl<\/a><\/code> in the container running your application, so you can make requests to your API directly from the shell. For instance, you can run <code>curl 127.0.0.1:3000\/employees<\/code> to see your server&#8217;s output. You can also go to the <code>\/directory<\/code> page to see a basic table of the example employee data.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>IntelliSense<\/strong><\/h2>\n\n\n\n<p>IntelliSense is running across your entire project, allowing you to see when there are syntax errors or to get quick hints for how to resolve errors.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Shell<\/strong><\/h2>\n\n\n\n<p>A shell is provided to you so you can inspect your container in more detail. The shell can be used to run <a href=\"https:\/\/maven.apache.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">maven<\/a> commands with <code>mvn<\/code>.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p>\u26a0\ufe0fWhile it&#8217;s possible to edit files directly from the shell, we recommend using the editor to make your changes. That way, other people in the Pad can see your changes as they&#8217;re being made.<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Dependencies<\/strong><\/h2>\n\n\n\n<p>The dependencies are listed in the <code>pom.xml<\/code> file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Configuration<\/strong><\/h2>\n\n\n\n<p>The configuration for the application is in the <code>src\/main\/java\/resources\/application.yml<\/code> file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Database creation<\/strong><\/h2>\n\n\n\n<p>The database is an empty database that is auto populated by the application.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Container Limits<\/strong><\/h2>\n\n\n\n<p>The container running your application has a few limitations. Currently, we don&#8217;t limit your CPU usage, though this may change in future. In addition to CPU, we monitor the network bandwidth that is consumed, and limit you to 75 MB for the duration of the container. Finally, we limit the amount of memory accessible to each container to 0.5 GB.<\/p>\n","protected":false},"parent":1360,"menu_order":0,"template":"","class_list":["post-18976","programming-language","type-programming-language","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/programming-language\/18976","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/programming-language"}],"about":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/types\/programming-language"}],"up":[{"embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/programming-language\/1360"}],"wp:attachment":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/media?parent=18976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}