Skip to content

Instantly share code, notes, and snippets.

View apalyukha's full-sized avatar
🇺🇦

Andrii Paliukha apalyukha

🇺🇦
View GitHub Profile
@apalyukha
apalyukha / pom.xml
Created January 7, 2019 13:39
Spring Boot. Mail, підтвердження ящика
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
@apalyukha
apalyukha / application.properties
Created January 7, 2019 13:38
Spring Boot. Mail, підтвердження ящика
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.mail.host=smtp.gmail.com
[email protected]
spring.mail.password=******************
spring.mail.port=465
spring.mail.protocol=smtps
mail.debug=true
@apalyukha
apalyukha / pom.xml
Created January 7, 2019 13:30
Spring Boot. Spring session
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-jdbc</artifactId>
</dependency>
@apalyukha
apalyukha / pom.xml
Created January 7, 2019 13:23
Spring Boot: deploy
<!-- JAXB -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
@apalyukha
apalyukha / config
Created January 7, 2019 13:21
Spring Boot deploy
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:8080;
}
location /img/ {
alias /home/apalyukha/uploads/;
}
@apalyukha
apalyukha / requests.js
Created January 7, 2019 13:18
Spring Boot REST: test rest methods
// GET all
fetch('/message/').then(response => response.json().then(console.log))
// GET one
fetch('/message/2').then(response => response.json().then(console.log))
// POST add new one
fetch(
'/message',
{
@apalyukha
apalyukha / pom.xml
Created January 7, 2019 13:16
Lombok: write less code
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
@apalyukha
apalyukha / build.gradle
Created January 7, 2019 13:14
Example: Add db support
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.postgresql:postgresql')
compile('org.projectlombok:lombok')
compile('javax.xml.bind:jaxb-api')
compile('com.sun.xml.bind:jaxb-core')
compile('com.sun.xml.bind:jaxb-impl')
@apalyukha
apalyukha / application.properties
Created January 7, 2019 13:12
Spring Boot REST: add oAuth2 authorization
security.oauth2.client.clientId=some-secret.apps.googleusercontent.com
security.oauth2.client.clientSecret=very-secret
security.oauth2.client.accessTokenUri=https://www.googleapis.com/oauth2/v4/token
security.oauth2.client.userAuthorizationUri=https://accounts.google.com/o/oauth2/v2/auth
security.oauth2.client.clientAuthenticationScheme=form
security.oauth2.client.scope=openid,email,profile
security.oauth2.resource.userInfoUri=https://www.googleapis.com/oauth2/v3/userinfo
security.oauth2.resource.preferTokenInfo=true
server.port=9000
@apalyukha
apalyukha / build.gradle
Created January 7, 2019 13:11
Spring Boot REST: add oAuth2 authentication dependencies
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.0.0.RELEASE')