Skip to content

Instantly share code, notes, and snippets.

@j-tim
j-tim / pom.xml
Last active October 29, 2020 12:50
Build snippet from a pom.xml to configure OCI images using the spring-boot-maven-plugin.
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<name>yourcontainerregistry.azurecr.io/${project.artifactId}</name>
</image>
<layers>
@j-tim
j-tim / azure-pipelines.yml
Created October 26, 2020 12:02
Azure Pipelines Maven project example
# Maven
# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/java
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
@j-tim
j-tim / SimpleControllerTest.java
Created October 26, 2020 11:59
Simple Spring WebMvcTest
package com.example.azure.devops;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.test.web.servlet.MockMvc;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
@j-tim
j-tim / SimpleController.java
Created October 26, 2020 11:58
Simple Rest Controller
package com.example.azure.devops;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class SimpleController {
@GetMapping
public String hello() {
@j-tim
j-tim / pom.xml
Created May 17, 2020 20:37
Spring Boot Properties Migrator
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-properties-migrator</artifactId>
<scope>runtime</scope>
</dependency>
@j-tim
j-tim / application.yml
Created May 17, 2020 20:36
Wavefront Spring Boot 2.3
spring:
application:
name: "spring-boot-app"
wavefront:
application:
name: "spring-boot-wavefront-demo"
service: ${spring.application.name}
management:
metrics:
export:
@j-tim
j-tim / pom.xml
Created May 17, 2020 20:36
OpenTracing starter dependency
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-cloud-starter</artifactId>
<version>0.5.3</version>
</dependency>
@j-tim
j-tim / pom.xml
Created May 17, 2020 20:35
Spring Cloud Sleuth starter
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
@j-tim
j-tim / pom.xml
Created May 17, 2020 20:35
Wavefront Spring Boot starter
<dependency>
<groupId>com.wavefront</groupId>
<artifactId>wavefront-spring-boot-starter</artifactId>
</dependency>
@j-tim
j-tim / application.yml
Created May 17, 2020 20:33
Spring Boot 2.3 Kubernetes propes health actuator
management:
health:
probes:
enabled: true
endpoint:
health:
show-details: always