GithubHelp home page GithubHelp logo

sanjaykuriyal / springboot-tutorial Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jssaggu/springboot-tutorial

0.0 0.0 0.0 364 KB

SpringBoot Tutorial by Saggu.UK

Home Page: http://saggu.uk

Java 100.00%

springboot-tutorial's Introduction

SpringBoot Tutorial

Java Maven CI

Videos Available here

All the tutorial videos are available on Saggu.uk YouTube channel.

Watch the video

Spring Profiles

How to run using a profile?

mvn spring-boot:run -DskipTests -Dspring-boot.run.profiles={Profile-Name}

e.g. For Dev

mvn spring-boot:run -DskipTests -Dspring-boot.run.profiles={Profile-Name}

e.g. Different Port

mvn spring-boot:run -Dspring-boot.run.arguments=--server.port=8080
mvn spring-boot:run -Dspring-boot.run.arguments=--server.port=8090

or

mvn clean install -DskipTests
java -jar target/springboot-tutorial-0.0.1-SNAPSHOT.jar --server.port=8080 --management.server.port=9090

Spring Caching

Note: Just enable one cache provider

Redis

Dependency
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-redis</artifactId>
    <version>${cache.version}</version>
</dependency>
application.yml

Add the following:

spring:
  cache:
    redis:
      time-to-live: 100S
    type: redis
How to install Redis using Docker?
  • docker pull redis
  • docker run --name saggu.uk -p 6379:6379 -d redis

Hazelcast

Dependency
<dependency>
    <groupId>com.hazelcast</groupId>
    <artifactId>hazelcast-all</artifactId>
    <version>4.2.4</version>
</dependency>
Add hazelcast.yaml
hazelcast:
  network:
    join:
      multicast:
        enabled: true

Flyway

Using Maven

H2

mvn clean -Dflyway.configFiles=src/main/docker/flyway-h2.conf -Dflyway.locations=filesystem:src/main/resources/db/migration/ flyway:migrate

Postgres

mvn clean -Dflyway.configFiles=src/main/docker/flyway-postgres.conf -Dflyway.url=jdbc:postgresql://localhost:5432/postgres -Dflyway.locations=filesystem:src/main/resources/db/migration/ flyway:migrate

Other goals

Official doc: https://flywaydb.org/documentation/usage/maven/

Name Description
migrate Migrates the database
clean Drops all objects in the configured schemas
info Prints the details and status information about all the migrations
validate Validates the applied migrations against the ones available on the classpath
undo Flyway Teams Undoes the most recently applied versioned migration
baseline Baselines an existing database, excluding all migrations up to and including baselineVersion
repair Repairs the schema history table

Connect to H2 Database from IntelliJ

Database > Add New > H2
    URL: `jdbc:h2:file:./springboot-tutorial/target/foobar`<br>
    UserName: sa<br>
    Pwd: <Empty>

Using Docker

Run docker compose up -d from src/main/docker folder.

Login to DBeaver

springboot-tutorial's People

Contributors

dependabot[bot] avatar jasvinder-saggu avatar jssaggu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.