Web Applications Build and Deploy Exercise
1.Go over to spring initializr and create your project: https://start.spring.io/
a.Under project select: Maven project
b.Under Language select: Java
c.Under Spring Boot select: 3.0.0 (Highest version that is not (SNAPSHOT or RC1)
d.Under Project Metadata, for artifact enter: java_web_final_project
e.Under Packaging select: Jar
f.Under Java select your version of Java: 19
g.Click Add Dependencies and select: Spring Web, Spring Data JPA, MySQL Driver.
h.Click: GENERATE
Or you can use this pre-initialized project
2.Your objectives for the api portion of the project are as follows
a.You will model some data of your choosing (in class we used Candy and Songs, for example)
i.This data must have at least two instance fields other than an id
ii.This data must have an id field that is automatically generated by Spring Data JPA
b.Your data will be persisted MySQL database
c.Your controller must have routes for all four main CRUD methods (Get, Post, Put, Delete)
3.In your src directory, add a frontend/build directory where you will add some frontend pages to your site
4.In your pom.xml, add the below code just before the closing tag
build-frontend
true
maven-resources-plugin
copy-build-folder
process-classes
copy-resources
src/frontend/build
${basedir}/target/classes/static
5.In your new frontend/build directory, add an index.html file and an index.js file
6.Your frontend pages will
a.Display data in an organized way in the home address on your webpage
b.Use asynchronous JS to make CRUD requests to the backend of your web application
i.For get requests, you must use DOM manipulation to dynamically add the data retrieved from your HTTP request to your index.html page
ii.For all other requests, you must use DOM manipulation to dynamically retrieve data from your webpage and incorporate it into an HTTP request to the backend of your application
7.Build and execute your the jar file for your completed project. If your jar file, when run, shows a dynamic webpage at the home address of your web application that makes use of data stored in the backend of your app, then you may submit your .jar file on canvas at any time.
8.With any time that you have remaining
a.Style your webpage and make it yours!
b.Add more pages to your frontend that make different types of HTTP requests to your backend.
c.Containerize your application
d.Make your api more RESTful by adding HATEOAS links