'ITWeb'에 해당되는 글 799건

  1. 2021.08.19 [Architecture] Microservices Pattern.
  2. 2021.08.18 [DBMS] QueryPie
  3. 2021.08.18 [Java] html strip + multi whitespace strip
  4. 2021.08.09 [MySQL] HikariCP Connection Pool 관리 예.
  5. 2021.08.02 [Log4J2] Executable Jar + Springboot framework 사용 예.
  6. 2021.07.27 [OpenJDK] 다운로드 받아서 설치.
  7. 2021.07.27 [Bash] 문자열 비교 예제
  8. 2021.07.19 [HikariCP] Java 버전 호환
  9. 2021.07.15 [JUnit] intellij 에서 junit 테스트 코드 작성 시 경험 하는 에러.
  10. 2021.07.02 [Intellij] intellij-java-google-style.xml 적용하기

[Architecture] Microservices Pattern.

ITWeb/스크랩 2021. 8. 19. 10:35

https://microservices.io/patterns/index.html

 

Microservices Pattern: A pattern language for microservices

Microservices.io is brought to you by Chris Richardson. Experienced software architect, author of POJOs in Action, the creator of the original CloudFoundry.com, and the author of Microservices patterns. Chris helps clients around the world adopt the micros

microservices.io

 

:

[DBMS] QueryPie

ITWeb/스크랩 2021. 8. 18. 13:27

https://www.querypie.com/ko

 

QueryPie | Centralized Data Access and Privacy Control across the Cloud

QueryPie improves data governance within your organization by centralizing data access policies.

www.querypie.com

 

:

[Java] html strip + multi whitespace strip

ITWeb/개발일반 2021. 8. 18. 11:30
content = content.replaceAll("<[^>]*>", "");  // html strip
content = content.replaceAll("( )+", " " );   // multi whitespace to single whitespace

사용할 일이 있는데 기억력이 떨어져서 기록 해 봅니다.

:

[MySQL] HikariCP Connection Pool 관리 예.

ITWeb/개발일반 2021. 8. 9. 08:12

 

HikariCP 를 사용하고 있는데 Connection Pool 에 대한 반납과 재사용이 원활 하지 않을 때가 있습니다.

Application 내부에서 사용과 반납을 너무 빈번하게 하고 있을 경우 이런 문제가 발생 하는 것 같습니다.

보통은 별 문제 없이 사용을 했으나 이런 문제가 발생 한다면 명시적으로 Close 를 해주고 다시 Connection 을 생성해 주면 문제를 해소 할 수 있습니다.

 

기억하기 위해 기록 합니다.

 

    config.setDriverClassName("com.mysql.cj.jdbc.Driver");
    config.setJdbcUrl("jdbc:mysql://....");
    config.setUsername(user);
    config.setPassword(pwd);
    config.setMaximumPoolSize(maxPoolSize);
    config.setMinimumIdle(minimumIdle);
    config.setConnectionTimeout(30000);
    config.setValidationTimeout(10000);
    config.setConnectionTestQuery("SELECT 1");
    config.addDataSourceProperty("autoReconnect", "true");
    config.addDataSourceProperty("serverTimezone", "Asia/Seoul");
    config.addDataSourceProperty("cachePrepStmts", "true");
    config.addDataSourceProperty("prepStmtCacheSize", "250");
    config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
    config.addDataSourceProperty("dataSource.useServerPrepStmts", "true");
    config.addDataSourceProperty("characterEncoding","utf8");
    config.addDataSourceProperty("useUnicode","true");
    
    this.ds = new HikariDataSource(config);

 

getConnection() 은 pool 에서 얻어 옵니다.

getConnection().close() 하면 pool 을 반납 하게 됩니다. 

 

근데 이게 반납과 재사용이 잘 안된다. 그러면 ds.close() 하고 다시 connection 을 생성 합니다. (HikariDataSource ds)

 

:

[Log4J2] Executable Jar + Springboot framework 사용 예.

ITWeb/개발일반 2021. 8. 2. 20:45

 

springboot framework 을 이용해서 executable jar 구현 시 log4j2 사용 예)
- @Slf4j 사용
- logback.xml 사용
- -Dlogback.configurationFile=$DIR_HOME/logback.xml

로그가 중복으로 남을 경우)
https://logging.apache.org/log4j/2.x/manual/configuration.html#Additivity
- <logger name="..." ... additivity="false" />
- 단순하게 보면, Logger 에 선언 된 appender 로 한번 기록하고 root logger 에 의해서 한번 기록 하게 되는 구조 입니다.

build.gradle 예)
configurations.all {
  exclude module: 'spring-boot-starter-logging'
}
...중략...
dependencies {
...중략...
  compile group: 'org.slf4j', name: 'slf4j-api', version: "${props.getProperty('slf4j')}"
  compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: "${props.getProperty('log4j')}"
  compile group: 'ch.qos.logback', name: 'logback-classic', version: "${props.getProperty('logback')}"
  compile group: 'ch.qos.logback', name: 'logback-core', version: "${props.getProperty('logback')}"
...중략...
}

 

:

[OpenJDK] 다운로드 받아서 설치.

ITWeb/개발일반 2021. 7. 27. 09:46

아래 주소에서 설치할 버전 선택 후 다운로드 받아서 설치 하셔도 됩니다.

 

Early Access

https://download.java.net/java/early_access/jdk18/7/GPL/openjdk-18-ea+7_linux-x64_bin.tar.gz

 

GA

https://jdk.java.net/archive/

 

AdoptOpenJDK

https://adoptopenjdk.net/release_notes.html

https://adoptopenjdk.net/archive.html?variant=openjdk8&jvmVariant=hotspot 

 


                  

:

[Bash] 문자열 비교 예제

ITWeb/개발일반 2021. 7. 27. 08:11
#!/bin/bash

retry='retry'

if [ $retry = "retry" ]; then
  echo 'true - 1'
fi

if [[ $retry = "retry" ]]; then
  echo 'true - 2'
fi

if [[ "$retry" = "retry" ]]; then
  echo 'true - 3'
fi

세 예제 다 true 리턴 합니다.

:

[HikariCP] Java 버전 호환

ITWeb/개발일반 2021. 7. 19. 11:46

빌드 환경과 맞춰서 사용 하셔야 합니다.

안그러면 아래와 같은 에러를 경험 할 수 있습니다.

 

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/zaxxer/hikari/HikariConfig has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

 

Artifacts
Java 11+ maven artifact:

<dependency>
   <groupId>com.zaxxer</groupId>
   <artifactId>HikariCP</artifactId>
   <version>5.0.0</version>
</dependency>
Java 8 maven artifact (maintenance mode):

<dependency>
   <groupId>com.zaxxer</groupId>
   <artifactId>HikariCP</artifactId>
   <version>4.0.3</version>
</dependency>
Java 7 maven artifact (maintenance mode):

<dependency>
   <groupId>com.zaxxer</groupId>
   <artifactId>HikariCP-java7</artifactId>
   <version>2.4.13</version>
</dependency>
Java 6 maven artifact (maintenance mode):

<dependency>
   <groupId>com.zaxxer</groupId>
   <artifactId>HikariCP-java6</artifactId>
   <version>2.3.13</version>
</dependency>

 

:

[JUnit] intellij 에서 junit 테스트 코드 작성 시 경험 하는 에러.

ITWeb/개발일반 2021. 7. 15. 09:42

아래와 같은 에러를 경험 하셨다면 intellij 에서의 설정을 변경해 주시면 됩니다.

 

Execution failed for task ':test'.
> No tests found for given includes: [com.kakaopay.stark.pipeline.indexer.PropertiesTest.testMultilineProperty](filter.includeTestsMatching)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

 

IntelliJ -> Preferences -> Build,Execution,Deployment -> Build Tools -> Gradle

Gradle projects -> Run tests using -> Gradle (Default) 를 Intellij IDEA 로 바꾸시면 됩니다.

:

[Intellij] intellij-java-google-style.xml 적용하기

ITWeb/개발일반 2021. 7. 2. 10:10

intellij 버전이 올라 가면서 codestyle 정의가 바뀌었네요.

https://raw.githubusercontent.com/google/styleguide/gh-pages/intellij-java-google-style.xml

이전 글은 import 방법만 참고하시고 새로운 style 을 다운로드 받아서 적용해 보세요.

 


 

각자 필요한 코드 스타일은 아래서 다운로드 받으시면 됩니다.

 

[구글 코드 스타일]

https://github.com/google/styleguide

 

[Intellij 적용하기 - mac]

# 저는 intellij 2016.3 사용중입니다.

# 다운로드 받으신 intellij-java-google-style.xml 파일을 아래 경로로 복사해서 넣습니다.

 

$ cd ~/Library/Preferences/IntelliJIdea2016.3/codestyles

 

[Intellij 에서 import 하기]

Preferences -> Editor -> Code Style -> Manage Button -> Import

 

# 그러나 파일을 먼저 복사해 넣었기 때문에 import 하지 않으셔도 scheme 이 정상적으로 나옵니다.

# Scheme 을 GoogleStyle 로 변경 하시면 끝납니다.

 

: