Skip to content
prashant edited this page Dec 4, 2019 · 3 revisions

Welcome to the PassengerApp_Angular_SpringBoot_MySQL wiki!

Spring Boot Application is provide here:

https://github.com/pkmsoftpro/PassengerApp_Angular_SpringBoot_MySQL/tree/springboot_crud_mysql

CRUD for Angular Material Table

Project showcasing my CRUD (Create, Read, Update, Delete) implementation on Angular's Mat-Table. Most importantly frontend updates accordingly with operations. This is important if you're using data from backend (some DB like MySQL). It can be used for local generated data as well.

Project uses Angular version 8 including Angular Material 8.

Angular app using SpringBoot Application does backend updates to MySQL DB. You can find entire HttpClient REST code from this project inside dataService.

# PassengerApp_Angular_SpringBoot_MySQL

Angular FullStack Application, Spring Boot, MySql

Used Spring Boot and JPA.

Add the following bean to allow GET,PUT,POST,DELETE through CORS(Cross Origin Resource Sharing).

  @Bean
    public WebMvcConfigurer corsConfigurer() {
        return new WebMvcConfigurerAdapter() {
            @Override
            public void addCorsMappings(CorsRegistry registry) {
                registry.addMapping("/userendpoint/**")
                        .allowedOrigins("*")
                        .allowedMethods("GET", "POST", "PUT", "DELETE");
            }
        };
    }

Data Set:

https://github.com/pkmsoftpro/PassengerApp_Angular_SpringBoot_MySQL/blob/springboot_crud_mysql/src/main/resources/train.csv

MySQL Script:

1. create database test1;
2. use  test1;
3. create table passengers(
      Passengerid int,
      Pclass int,
      Name varchar(100),
      Sex varchar(10),
      Age double(5,2),
      Sibsp int,
      Parch int,
      Ticket varchar(20),
      Fare double(10,2),
      Cabin varchar(20),
      Embarked varchar(1)
    ); 

Utility class to populate the database:

https://github.com/pkmsoftpro/PassengerApp_Angular_SpringBoot_MySQL/blob/springboot_crud_mysql/src/main/java/com/utility/PopulateData.java