Use Gradle/Liquibase to apply others' recent database changes: gradlew update
This file contains hidden or 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
### dependencies | |
<dependency> | |
<groupId>org.springframework.cloud</groupId> | |
<artifactId>spring-cloud-starter-bootstrap</artifactId> | |
<version>4.0.0</version> | |
<scope>test</scope> | |
</dependency> | |
<dependency> | |
<groupId>com.playtika.testcontainers</groupId> | |
<artifactId>embedded-postgresql</artifactId> |
This file contains hidden or 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
private static String getHtmlContentByUrl(String url) { | |
String content = null; | |
URLConnection connection; | |
try { | |
connection = new URL(url).openConnection(); | |
Scanner scanner = new Scanner(connection.getInputStream()); | |
scanner.useDelimiter("\\Z"); | |
content = scanner.next(); | |
} catch (Exception ex) { | |
ex.printStackTrace(); |
This file contains hidden or 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
version: '3.3' | |
services: | |
postgres: | |
image: postgres:14-alpine | |
container_name: postgres | |
environment: | |
POSTGRES_USER: "postgres" | |
POSTGRES_PASSWORD: "postgres" | |
POSTGRES_DB: "demo" |
This file contains hidden or 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
--- Dependencies --- | |
<dependency> | |
<groupId>org.springframework.cloud</groupId> | |
<artifactId>spring-cloud-starter-bootstrap</artifactId> | |
<version>3.1.4</version> | |
<scope>test</scope> | |
</dependency> | |
<dependency> | |
<groupId>com.playtika.testcontainers</groupId> |
This file contains hidden or 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
spring.datasource.url=jdbc:h2://mem:db;DB_CLOSE_DELAY=-1 | |
spring.datasource.username=123 | |
spring.datasource.password=123 | |
spring.jpa.properties.hibernate.format_sql=true | |
spring.jpa.properties.hibernate.show_sql=true | |
spring.jpa.properties.hibernate.use_sql_comments=false | |
spring.jpa.show-sql=true | |
spring.jpa.hibernate.ddl-auto=create-drop |
This file contains hidden or 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
spring: | |
jpa: | |
properties: | |
hibernate: | |
cache: | |
use_second_level_cache: true | |
use_query_cache: true | |
region: | |
factory_class: org.hibernate.cache.jcache.JCacheRegionFactory | |
javax: |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.ehcache.org/v3" | |
xsi:schemaLocation=" | |
http://www.ehcache.org/v3 | |
https://www.ehcache.org/schema/ehcache-core.xsd"> | |
<cache-template name="default"> | |
<expiry> | |
<ttl unit="days">1</ttl> | |
</expiry> |
This file contains hidden or 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
driverlist=org.postgresql.Driver | |
appender=com.p6spy.engine.spy.appender.StdoutLogger | |
logMessageFormat=ru.izimin.HibernateBasicSqlFormatter | |
excludecategories=info,debug,result,resultset,rollback,commit | |
databaseDialectDateFormat=YYYY-MM-dd HH:mm:ss | |
exclude=SPRING_SESSION,SPRING_SESSION_ATTRIBUTES | |
filter=true | |
# spring.datasource.driver-class-name: com.p6spy.engine.spy.P6SpyDriver | |
# spring.datasource.url: jdbc:p6spy:postgresql://localhost:5432/db |
This file contains hidden or 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
public class HibernateBasicSqlFormatter implements MessageFormattingStrategy { | |
private final Formatter formatter = new BasicFormatterImpl(); | |
@Override | |
public String formatMessage(int connectionId, String now, long elapsed, String category, String prepared, String sql, String url) { | |
String res = !sql.isEmpty() ? sql : prepared; | |
if (res.isEmpty()) { | |
return ""; | |
} |