Skip to content

Instantly share code, notes, and snippets.

View tuhin47's full-sized avatar
☠️

MD Towhidul Islam tuhin47

☠️
View GitHub Profile
@tuhin47
tuhin47 / Spring Current User.md
Created April 29, 2021 17:02
Spring Current User

CurrentUser.java

@Target({ElementType.PARAMETER, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@AuthenticationPrincipal
public @interface CurrentUser {
}
@tuhin47
tuhin47 / Spring Date And User Audit.md
Created April 29, 2021 17:00
Spring Date And User Audit

Spring Date And User Audit

DateAudit.java

@MappedSuperclass
@Data
@EntityListeners(AuditingEntityListener.class)
@JsonIgnoreProperties(
		value = { "createdAt", "updatedAt" },
@tuhin47
tuhin47 / Java Json Deserializer.md
Created April 29, 2021 03:32
Java Json Deserializer

Java Code

public class InstantTimeDeserializer extends JsonDeserializer<Instant> {
    @Override
    public Instant deserialize(JsonParser arg0, DeserializationContext arg1) throws IOException {
        return Instant.parse(arg0.getText());
    }
}
@tuhin47
tuhin47 / Database_Docker_IN_Terminal.md
Last active April 28, 2021 18:35
Mysql Docker Run and Open By terminal

MySQL

Run MySQL docker Command:

docker run --name mysql47 -e MYSQL_ROOT_PASSWORD=root -p 3333:3306 -d mysql

Connect from terminal:

mysql -h 127.0.0.1 -P 3333 -u root -p
@tuhin47
tuhin47 / Dockerfile
Last active April 28, 2021 18:10
Spring boot + MySQL docker
FROM adoptopenjdk/openjdk11:alpine-jre
# Refer to Maven build -> finalName
ARG JAR_FILE=target/HibernateSpringBootCalculatePropertyPostLoad-1.0.jar
# cd /opt/app
WORKDIR /opt/app
# cp target/spring-boot-web.jar /opt/app/app.jar
COPY ${JAR_FILE} app.jar
@tuhin47
tuhin47 / notepad_plus_log4j.xml
Created November 18, 2020 04:55
notepad++ log4j extention
<NotepadPlus>
<UserLang name="Log4J" ext="log" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="2" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00 01 02 03 04</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>