Spring Boot with PostgreSQL & pgAdmin in Docker

ALT TEXT

1. Getting started with Spring IO

Embarking on your journey with Spring IO is a breeze, and I'm here to guide you through the initial steps. The process begins at start.spring.io, where you'll set up a Maven project with Java, opting for the latest Spring Boot version (currently 3.1.1). To personalize your project, choose "dev.vishsali" as the group ID . Our Java arsenal will be fortified with version 17, and included the following dependencies: the web dependency, Spring Data JPA, Postgres driver, and Spring Boot's Docker Compose support.

Now, let's dive into the generated project. Notice that a pre-configured compose.yml file awaits you, sparing you the effort of manual creation. This file is auto-generated due to our inclusion of the Docker Compose module and the definition of a service to be seamlessly integrated.

With the groundwork laid, proceed to generate the project. A conveniently packaged zip file will be at your disposal, ready to be unfolded in your preferred IDE or text editor. In this demonstration, I'll be navigating through the setup using the IntelliJ Ultimate Edition. So, buckle up and let's embark on this Spring IO adventure together!

Untitled

2. Writing a simple application with Events and sessions

@Entity
@NoArgsConstructor
@AllArgsConstructor
public class Event {
    @Id
    @GeneratedValue
    private Integer id;
    private String name;
    private String description;
    private LocalDate startDate;
    private LocalDate endDate;
    private String locations;
    private String websites;
}

3. Populating from Database

Assign the roadmap item to the appropriate reviewer(s). Mark the spec In Review in the Docs database.

4. Accessing PostgreSQL Database

docker exec -it eventwebservice-postgres-1 psql -U postgres -d events

Untitled

Untitled

5. Exploring data with PG Admin

Untitled

Need to connect to the Docker server for the postgres

docker inspect 0e75a583e38a | grep IPAddress

Untitled

add the details to connect to the server Happy coding, folks!