Skip to content

Instantly share code, notes, and snippets.

View mehmetcemyucel's full-sized avatar

Mehmet Cem Yücel mehmetcemyucel

View GitHub Profile
package config
import (
"fmt"
"github.com/spf13/viper"
"reflect"
"strings"
)
var readFromEnv = func(v *viper.Viper) *viper.Viper {
package main
import (
"go.uber.org/zap"
"helloWorld/pkg/api"
"helloWorld/pkg/config/config"
"helloWorld/pkg/config/migrate"
"helloWorld/pkg/config/postgre"
"helloWorld/pkg/logging"
"helloWorld/pkg/router"
@mehmetcemyucel
mehmetcemyucel / WebSecurityNew.java
Created March 29, 2021 04:42
spring-native-example
package com.cem.springnativeexample.configuration.security;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@mehmetcemyucel
mehmetcemyucel / UserControllerNew.java
Created March 29, 2021 04:41
spring-native-example
package com.cem.springnativeexample.controller;
import com.cem.springnativeexample.controller.model.User;
import com.cem.springnativeexample.service.UserService;
import com.sun.istack.NotNull;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Collection;
import java.util.Optional;
@mehmetcemyucel
mehmetcemyucel / UserEntity.java
Created March 28, 2021 16:31
spring-native-example
package com.cem.springnativeexample.repository.entity;
import com.cem.springnativeexample.controller.model.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
@mehmetcemyucel
mehmetcemyucel / UserService.java
Created March 28, 2021 16:30
spring-native-example
package com.cem.springnativeexample.service;
import com.cem.springnativeexample.controller.model.User;
import com.cem.springnativeexample.repository.UserRepository;
import com.cem.springnativeexample.repository.entity.UserEntity;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@mehmetcemyucel
mehmetcemyucel / UserController.java
Last active March 28, 2021 16:28
spring-native-example
package com.cem.springnativeexample.controller;
import com.cem.springnativeexample.controller.model.User;
import com.cem.springnativeexample.service.UserService;
import com.sun.istack.NotNull;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Collection;
import java.util.Optional;
@mehmetcemyucel
mehmetcemyucel / WebSecurity.java
Last active March 28, 2021 16:28
spring-native-example
package com.cem.springnativeexample.configuration.security;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@mehmetcemyucel
mehmetcemyucel / pom.xml
Created March 28, 2021 14:15
spring-native-example
<?xml version="1.0" encoding="UTF-8"?>
<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 https://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>2.4.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
@mehmetcemyucel
mehmetcemyucel / Composite.java
Created March 27, 2021 09:52
spring-native-proxy
public class Main {
public static void main(String[] args) {
ProxyFactory factory = new ProxyFactory(new SimplePojo());
factory.addInterface(Pojo.class);
factory.addAdvice(new RetryAdvice());
Pojo pojo = (Pojo) factory.getProxy();