Students-WebApp

May 20, 2023 ยท View on GitHub

Build and deploy Lint Code Base

StudentsWebApp-screenshot

This repo is a Pet-project of web application represent list of students from database (HSQLDB, MySQl), with a java based spring framework configuration (a plain old XML configuration here) and with a 3-layer architecture (i.e. presentation --> service --> repository). Created by following the example of this repository spring-projects/spring-framework-petclinic.

Running web-app locally

With Maven command line

git clone https://github.com/ilya-vdovenko/Students-WebApp.git
cd Students-WebApp
./mvnw jetty:run-war
# For Windows : ./mvnw.cmd jetty:run-war

You can then access app here: localhost:8080/Students-WebApp

Working with in your IDE

Prerequisites

The following items should be installed in your system:

Steps

  1. Import project and past url to the project. Or on the command line
git clone https://github.com/ilya-vdovenko/Students-WebApp.git
  1. (If through CL) Inside IDE
File -> Import -> Maven -> Existing Maven project
  1. After import, click jetty:run from maven window, or type in IDE command line mvn jetty:run

  2. Visit localhost:8080/Students-WebApp in your browser.

Database configuration

By default, Students-WebApp uses an in-memory database (HSQLDB) which gets populated at startup with data. A similar setup is provided for MySQL in case a persistent database configuration is needed. To run web-app locally using persistent database, it is needed to run with profile defined in main pom.xml file.

For MySQL database, it is needed to run with 'MySQL' profile defined in main pom.xml file.

./mvnw jetty:run-war -P JDBC_MySQL

Before do this, would be good to check properties defined in MySQL profile inside pom.xml file.

<properties>
    <maven.spring.profiles.active>jdbc</maven.spring.profiles.active>
    <maven.skipTests>%regex[.*Jpa.*Tests.*]</maven.skipTests>
    <maven.db.script>mysql</maven.db.script>
    <maven.jpa.database>MYSQL</maven.jpa.database>
    <maven.jdbc.driverClassName>com.mysql.cj.jdbc.Driver</maven.jdbc.driverClassName>
    <maven.jdbc.url>jdbc:mysql://localhost:3306, mysql:3306/institute?failOverReadOnly=false</maven.jdbc.url>
    <maven.jdbc.username>institute</maven.jdbc.username>
    <maven.jdbc.password>institute</maven.jdbc.password>
</properties>

You can use docker-compose.yml file for run MySQL. Be sure that you had install Docker-compose.

docker-compose -f "docker-compose.yml" up -d --build

License

Students-WebApp is released under version 2.0 of the Apache License.