My First Full Stack Spring Boot / JQuery Application
Part 1 - Creating an Entity
Click here to view details about Spring annotations.
Generate Project
- Navigate to
start.spring.io - Select the following dependencies:
Web ToolsSpring Data JPAH2 Database
- Press the
Downloadbutton - Navigate to the
~/Downloadsdirectory view the newly downloadeddemo.zipfile. - Unzip the
demo.zipdirectory to extract the contents of the newly downloaded file to a folder nameddemo. - Navigate to the newly extracted
demofolder. - Execute
mvn spring-boot:runfrom the root directory ofdemofolder to verify that the application can be built by maven - Navigate to
localhost:8080from a browser to ensure that theWhitelabel Pageis displayed.
Open In IDE
- Open the newly downloaded project in IntelliJ
- Ensure that the project is opened via the
pom.xml. - Ensure that the
pom.xmlis opened as a project, not as a file.
Create an Entity
- Create a
PersonEntity.
@Entity
public class Person {
@Id
@GeneratedValue
private Long id;
private String firstName;
private String lastName;
private Date birthDate;
public Person() {
}
public Person(Long id, String firstName, String lastName, Date birthDate) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.birthDate = birthDate;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public Date getBirthDate() {
return birthDate;
}
public void setBirthDate(Date birthDate) {
this.birthDate = birthDate;
}
}
View the Entity
- Modify the
/resources/application.propertiesfile by adding the following configurations
server.port=8080
spring.h2.console.enabled=true
spring.h2.console.view=/h2-console
spring.datasource.url=jdbc:h2:mem:testdb
- Run the application
- Navigate to
localhost:8080/h2-consoleto view the data-layer of the application



