Skip to main content

Posts

Showing posts from February, 2019

Many to Many mapping in Spring boot

In this blog, I will explain how to use many-to-many mapping in Spring boot Application What you need? JAVA MySql Eclipse IDE ( whatever you like IDE, I'm using Eclipse for this example) Maven ( you can use the Gradle as well) Initial Plan spring boot application will be created using spring initializer web tool and imported as a maven project to the eclipse ide. Scenarios will be post and tags. one post have more than one tags and one tags have more than one posts. Two model classes will be created for Post and Tags. Finally, the command line runner interface will be used to run the application. Below diagram is the database model diagram which we going to install using the spring boot application. Let's Start to Code. You need to configure the application.properties file for database connections. add the following content to the src/main/resources/application.properties spring.datasource.url=jdbc:mysql://localhost:3306/learning spring.dataso

One to Many Mapping using Spring boot

In this blog, I will explain how to use one-to-many mapping in Spring boot Application What you need? JAVA MySql Eclipse IDE ( whatever you like IDE, I'm using Eclipse for this example) Maven ( you can use the Gradle as well) Initial Plan I will create a spring boot application project using the  Spring Initializer  web tool and import the project as a maven project. after configuring the all necessary setting, I will code for one-to-many mapping. Below diagram is the database model diagram which we going to install using the spring boot application. Let's Start to Code. You need to configure the application.properties file for database connections. add the following content to the src/main/resources/application.properties spring.datasource.url=jdbc:mysql://localhost:3306/learning spring.datasource.username=root spring.datasource.password=root spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect spring.jpa.hibernate

One to One Mapping with Spring boot

In this blog, I will explain how to use one-to-one mapping in Spring boot Application What you need? JAVA MySql Eclipse IDE ( whatever you like IDE, I'm using Eclipse for this example) Maven ( you can use the Gradle as well) Initial Plan I will create a spring boot application project using the Spring Initializer web tool and import the project as a maven project. after configuring the all necessary setting, I will code for one-to-one mapping. Below diagram is the database model diagram which we going to install using the spring boot application. Let's Start to Code. You need to configure the application.properties file for database connections. add the following content to the src/main/resources/application.properties spring.datasource.url=jdbc:mysql://localhost:3306/learning spring.datasource.username=root spring.datasource.password=root spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect spring.jpa.hibern

Run Spring boot application on Docker

In this blog, I will explain how to  run the .jar file on Docker Engine Docker  containers are the fastest growing cloud-enabling technology and driving a new era of computing and application architecture with their lightweight approach to bundle applications and dependencies into isolated, yet highly portable application packages. What you need? Docker running on your computer. Initial Plan I will create a simple spring boot application and then create a Dockerfile to build the docker image. finally, I will run the application on Docker container If you don't have Docker running on your computer. Here is the link to install the Docker   Step 1: Create Spring-boot application Navigate this link to create the initial spring-boot application. Import the project to the Eclipse IDE or whatever you like and create the simple rest endpoint. Here is my code. import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.a