Skip to content

Instantly share code, notes, and snippets.

View iamvickyav's full-sized avatar
😎
Savvy

Vicky AV iamvickyav

😎
Savvy
View GitHub Profile

Creating JAR file using CMD

If your source code has other jar files as dependency

Folder Structure

.
├── com
│   ├── vicky
@iamvickyav
iamvickyav / Groovy+MySQL.md
Last active September 27, 2021 04:47
Groovy + MySQL (insert if not exist)

With User Input

import groovy.sql.GroovyResultSet
import groovy.sql.Sql

import javax.swing.JOptionPane

class Test {

MySQL Local Setup in MAC

brew install mysql

mysql

$(brew --prefix mysql)/bin/mysqladmin -u root password root

mysql -h localhost -P 3306 -u root -p (Enter password as root to login)

Refer JAR files in classpath using command

> javac -classpath commons-text-1.9.jar:commons-lang3-3.0.1.jar:. Main.java
> java -classpath commons-text-1.9.jar:commons-lang3-3.0.1.jar:. Main
import org.apache.commons.text.diff.StringsComparator;
import org.apache.commons.text.diff.EditScript;
@iamvickyav
iamvickyav / docker-compose.yml
Last active April 13, 2024 21:41
docker-compose.yml for MySQL with init script
version : '3'
services:
mysql:
image: mysql
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: root
ports:
- "3306:3306"
volumes:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
@JsonFilter("userFilter")
public class User {
private Integer id;
private String name;
private Date dob;
private String city;
// constructors, getters & setters are ignored
}
public class User {
private Integer id;
private String name;
private Date dob;
private String city;
// constructors, getters & setters are ignored
}
// How to ignore fields in Java Object while serializing
// Approach 1 - @JsonIgnoreProperties
@JsonIgnoreProperties(value = {"id", "dob"})
public class User {
private Integer id;
private String name;
private Date dob;