Skip to content

Instantly share code, notes, and snippets.

View iamvickyav's full-sized avatar
😎
Savvy

Vicky AV iamvickyav

😎
Savvy
View GitHub Profile
@iamvickyav
iamvickyav / File Upload in Spring MVC
Last active July 26, 2017 19:10
Important things in File Upload in Spring MVC
Different & important pieces of codes for File Upload in Spring MVC
/** Form Coding in JSP **/
<form action="upload" method="post" enctype="multipart/form-data">
<input type="file" name="file" /> <input type="submit" value="submit" />
</form>
/** Code to handle file upload **/
@RequestMapping(value="/upload")
public ModelAndView upload(@RequestParam("file") MultipartFile file,
@iamvickyav
iamvickyav / JSTL
Created July 26, 2017 19:12
How to enable JSTL in our project
/** JSTL required **/
/** pom.xml **/
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
/** In JSP file **/
@iamvickyav
iamvickyav / kill_process.txt
Created May 12, 2018 19:31
Kill a process with port number
netstat -vanp tcp | grep 8080
kill -9 1234
https://stackoverflow.com/questions/46104140/kill-tomcat-service-running-on-any-port-mac-sierra?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
@iamvickyav
iamvickyav / Spring Cassandra Error Fix.md
Last active December 23, 2018 14:37
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured - Cassandra

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured [Fixed]

If you face this issue with Spring Cassandra, please remove the following dependency from your POM file

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

How to Enable SSL in Tomcat & Spring Boot

Run ->

keytool -genkey -alias tomcat -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650

Add file in resources folder & do following changes in application.properties

Add following dependency in classpath

<dependency>
	<groupId>com.fasterxml.jackson.dataformat</groupId>
	<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
public class StackImpl {
private int[] ele
private int MAX_SIZE
private int top = -1
int size(){
top

application-.properties

Environment variable -> spring.profiles.active

application.properties is always loaded, irrespective of the spring.profiles.active value. If there is the same key-value present both in application.properties and application-.properties, the latter will override the former.

List<T> performRequest(ParameterizedTypeReference<List<T>> responseType) {
return restTemplate.exchange("http://www.mocky.io/v2/5e4d66ff2d0000309ec0df14",
HttpMethod.GET, null, responseType).getBody();
}
performRequest(new ParameterizedTypeReference<List<User>>() {});
@iamvickyav
iamvickyav / docker-compose.yml
Created March 5, 2020 13:50
docker-compose.yml for building DockerFile in current path
version: '3'
services:
app:
build: .
image: test-img
ports:
- 8080:8080