Skip to content

Instantly share code, notes, and snippets.

View daniellavoie's full-sized avatar

Daniel Lavoie daniellavoie

View GitHub Profile
@daniellavoie
daniellavoie / pom.xml
Created October 9, 2016 10:44
Spring Boot Minimal pom
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
</parent>
<groupId>com.invivoo</groupId>
@daniellavoie
daniellavoie / ReadFile.java
Created October 10, 2016 05:39
Blocking operation that returns a list of String from a file.
package com.invivoo.springcloud.util;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class ReadFile {
@daniellavoie
daniellavoie / run-kubik
Created October 10, 2016 05:58
Kubik Eclipse Run Configuration
--kubik.ean13=1
--kubik.environment=development
--kubik.company.name=Open
--spring.datasource.url=jdbc:mysql://localhost:3306/kubik-test?useUnicode=yes&characterEncoding=UTF-8
--spring.datasource.password=test
--spring.datasource.username=test
--elasticsearch.hostname=localhost
--elasticsearch.port=9300
--kos.notification.enabled=false
--kubik.dilicom.enabled=false
@daniellavoie
daniellavoie / docker-compose.yml
Created October 10, 2016 11:14
MySQL Docker instance
services:
mysql:
image: tutum/mysql
environment:
- MYSQL_PASS=test
- MYSQL_USER=test
- ON_CREATE_DB=test
ports:
- 3306
public class Product {
private String ean13;
private String name;
private double unitPrice;
private double taxRate;
public Product(){
}
<html>
<body>
<h1>Je suis un produit de test !</h1>
</body>
</html>
@daniellavoie
daniellavoie / database
Created October 10, 2016 13:37
database
spring.datasource.url=jdbc:mysql://localhost:3306/test?useUnicode=yes&characterEncoding=UTF-8
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.password=test
spring.datasource.testOnBorrow=true
spring.datasource.username=test
spring.datasource.validation-query=SELECT 1
public void importProduct() {
try {
for (String line : ReadFileUtil.readFile(new ClassPathResource("data.csv").getFile().getAbsolutePath())) {
String[] elements = line.split(",");
Product product = new Product();
product.setEan13(elements[0]);
product.setName(elements[1]);
product.setUnitPrice(Double.valueOf(elements[2]));
product.setTaxRate(Double.valueOf(elements[3]));
@daniellavoie
daniellavoie / bootstrap.properties
Last active October 11, 2016 13:33
Config Properties
spring.cloud.config.server.git.uri=
[{"name":"CONFIGSERVER","instances":[{"id":"CONFIGSERVER_localhost:configserver:8888","url":"http://localhost:8888","name":"localhost:configserver:8888","status":"UP"}]},{"name":"EUREKA-SERVER","instances":[{"id":"EUREKA-SERVER_localhost:eureka-server:8761","url":"http://localhost:8761","name":"localhost:eureka-server:8761","status":"UP"}]},{"name":"PRODUCT-SERVER","instances":[{"id":"PRODUCT-SERVER_product-server-1","url":"http://localhost:53907","name":"product-server-1","status":"UP"}]},{"name":"ZUUL-SERVER","instances":[{"id":"ZUUL-SERVER_localhost:zuul-server:8080","url":"http://localhost:8080","name":"localhost:zuul-server:8080","status":"UP"}]}]