This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
SimpleDriverDataSource simpleDriverDataSource(JdbcConnectionDetails properties) { | |
SimpleDriverDataSource simpleDriverDataSource = new SimpleDriverDataSource(); | |
simpleDriverDataSource.setUrl(properties.getJdbcUrl()); | |
simpleDriverDataSource.setDriver(new org.postgresql.Driver()); | |
simpleDriverDataSource.setUsername(properties.getUsername()); | |
simpleDriverDataSource.setPassword(properties.getPassword()); | |
return simpleDriverDataSource; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.maciejwalkowiak.wiremock.spring; | |
import com.fasterxml.jackson.core.JsonProcessingException; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.github.tomakehurst.wiremock.client.MappingBuilder; | |
import com.github.tomakehurst.wiremock.junit.Stubbing; | |
import com.github.tomakehurst.wiremock.matching.RequestPatternBuilder; | |
import com.github.tomakehurst.wiremock.matching.StringValuePattern; | |
import org.springframework.http.HttpStatus; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.awspring.cloud.autoconfigure.imds; | |
import java.net.URI; | |
import com.github.tomakehurst.wiremock.WireMockServer; | |
import org.junit.jupiter.api.AfterEach; | |
import org.junit.jupiter.api.BeforeEach; | |
import org.junit.jupiter.api.Test; | |
import software.amazon.awssdk.imds.Ec2MetadataClient; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.io.OutputStreamWriter; | |
import java.io.PrintWriter; | |
import jakarta.servlet.ServletOutputStream; | |
import jakarta.servlet.WriteListener; | |
import jakarta.servlet.http.HttpServletResponse; | |
import jakarta.servlet.http.HttpServletResponseWrapper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.InetAddress; | |
import java.net.InetSocketAddress; | |
import java.net.ServerSocket; | |
public class SocketUtils { | |
public static int findFreePort(int minPort, int maxPort) { | |
for (int i = minPort; i < maxPort; i++) { | |
if (isPortAvailable(i)) { | |
return i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.aot.hint.MemberCategory; | |
import org.springframework.aot.hint.RuntimeHints; | |
import org.springframework.aot.hint.RuntimeHintsRegistrar; | |
import org.springframework.aot.hint.TypeReference; | |
import java.util.List; | |
public class WebJarsHints implements RuntimeHintsRegistrar { | |
@Override | |
public void registerHints(RuntimeHints hints, ClassLoader classLoader) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Output sqs.gif | |
Set FontSize 24 | |
Set Width 1200 | |
Set Height 600 | |
Hide Sleep 1s Show | |
Type "./sqs.sh" | |
Sleep 0.5s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
START=$(date +%s.%N) | |
while [ "$(curl -s -o /dev/null -L -w ''%{http_code}'' http://localhost:8080/hello)" != "200" ]; | |
do sleep 0.001; | |
done | |
END=$(date +%s.%N) | |
DIFF=$(echo "($END - $START) * 1000" | bc) | |
echo "Measured" | |
echo $DIFF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Map; | |
import org.apache.commons.logging.Log; | |
import org.apache.commons.logging.LogFactory; | |
import reactor.core.publisher.Mono; | |
import org.springframework.context.i18n.LocaleContextHolder; | |
import org.springframework.graphql.server.WebGraphQlHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.awspring.cloud.s3.crossregion; | |
import java.util.concurrent.ConcurrentHashMap; | |
import java.util.concurrent.ConcurrentLinkedDeque; | |
import java.util.concurrent.locks.ReadWriteLock; | |
import java.util.concurrent.locks.ReentrantReadWriteLock; | |
import org.springframework.lang.Nullable; | |
import org.springframework.util.Assert; |
NewerOlder