Skip to content

Instantly share code, notes, and snippets.

View avinash10584's full-sized avatar
🏠
Working from home

Avinash Singh avinash10584

🏠
Working from home
View GitHub Profile
spring:
data:
mongodb:
uri: mongodb+srv://${mongo.username}:${mongo.password}@${mongo.cluster}/shopping-list?retryWrites=true&w=majority
server:
port: 3025
applications:
- name: spring-boot-shopping-list-mongodb
memory: 768M
random-route: true
env:
SPRING_PROFILES_ACTIVE: cloud
@avinash10584
avinash10584 / Dockerfile
Created May 29, 2020 20:09
Spring Boot Dockerfile
FROM openjdk:15-jdk-slim
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
FROM openjdk:15-jdk-slim as bulid
WORKDIR application
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
RUN java -Djarmode=layertools -jar app.jar extract
FROM openjdk:15-jdk-slim
WORKDIR application
COPY --from=bulid application/dependencies/ ./
COPY --from=bulid application/spring-boot-loader/ ./
FROM openjdk:15-jdk-slim as bulid
WORKDIR application
COPY mvnw .
COPY .mvn .mvn
COPY pom.xml .
COPY src src
RUN ./mvnw install -DskipTests
# syntax = docker/dockerfile:experimental
FROM openjdk:15-jdk-slim as bulid
WORKDIR application
COPY mvnw .
COPY .mvn .mvn
COPY pom.xml .
COPY src src
@avinash10584
avinash10584 / TodoListController.java
Created June 14, 2020 06:20
TodoListController.java
@RestController("/")
public class TodoListController {
private ToDoList sample = new ToDoList(1, Arrays.asList(new ToDo(1, "Comment", false),
new ToDo(2, "Clap", false),
new ToDo(3, "Follow Author", false)), false);
@GetMapping
public ToDoList getList() {
return sample;
@avinash10584
avinash10584 / TodoListController.java
Created June 14, 2020 06:27
TodoListController.java
@RestController("/")
public class TodoListController {
private ToDoList sample = new ToDoList(1, Arrays.asList(new ToDo(1, "Comment", false), new ToDo(2, "Clap", false),
new ToDo(3, "Follow Author", false)), false);
@GetMapping
public ToDoList getList() {
return sample;
}
@avinash10584
avinash10584 / TodoListController.java
Created June 17, 2020 20:25
TodoListController.java
package com.codingfullstack.springboot.redis.rest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Optional;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
@avinash10584
avinash10584 / application-cluster.yml
Created June 17, 2020 22:19
application-cluster.yml
server:
port: 4024
servlet:
context-path: /app
spring:
application:
name: todolist-redis
cache:
type: redis