Skip to content

Instantly share code, notes, and snippets.

# To expose Spring Boot info actuator
management:
endpoints:
web:
exposure:
include: info
@j-tim
j-tim / application.yml
Last active December 10, 2021 12:07
Spring Boot 2.6.x Actuator Info contributor properties example
spring:
application:
name: example-app
info:
application:
name: ${spring.application.name}
description: Very cool Spring Boot application
version: '@project.version@'
spring-cloud-version: '@spring-cloud.version@'
@j-tim
j-tim / application.yml
Last active December 10, 2021 12:31
Spring Boot 2.6.x Actuator Info contributor complete config example
spring:
application:
name: example-app
management:
info:
env:
enabled: true
endpoints:
@j-tim
j-tim / pom.xml
Created December 10, 2021 10:13
Spring Boot starter actuator snippet
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
@j-tim
j-tim / docker-compose.yml
Last active August 27, 2021 20:02
Example Docker compose file with extra host config to reach the Docker host from inside a running Docker container
version: "3.8"
services:
ubuntu:
image: ubuntu
container_name: ubuntu
extra_hosts:
- "host.docker.internal:host-gateway"
command: sleep infinity
@j-tim
j-tim / helloWorld.groovy
Last active August 27, 2021 20:07
Spring Boot Hello World Web application using Groovy
@RestController
class SpringBootWebApplication {
@RequestMapping("/")
String hello() {
"Hello world container. You are able to reach the Docker host!\n"
}
}
@j-tim
j-tim / settings.xml
Created March 29, 2021 19:27
Maven settings.xml to use an Azure Artifacts feed as a mirror.
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"
xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<mirrors>
<mirror>
<id>maven-feed</id>
<url>
https://pkgs.dev.azure.com/YourOrganizatioOrNameHere/_packaging/maven-feed/maven/v1
@j-tim
j-tim / ClassPathResourceUtils.java
Created March 2, 2021 15:25
Utility to read class path resources as String. Required dependency is on spring-core.
package nl.jtim.utils.resources;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.FileCopyUtils;
import java.io.IOException;
import java.io.InputStream;
public class ClassPathResourceUtils {
@j-tim
j-tim / azure-pipelines.yml
Created October 26, 2020 14:45
Azure Pipeline to build and push OCI (Docker) image
# 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 / azure-pipelines.yml
Created October 26, 2020 12:23
Azure Pipelines example to build OCI (Docker) image using the Spring Boot Maven plugin
# 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'