Skip to content

Instantly share code, notes, and snippets.

@GHGHGHKO
GHGHGHKO / vaultTemplate-error.log
Last active January 2, 2023 12:05
Error creating bean with name 'vaultTemplate' defined
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'vaultTemplate' defined in class path resource [org/springframework/cloud/vault/config/VaultAutoConfiguration.class]: Failed to instantiate [org.springframework.vault.core.VaultTemplate]: Factory method 'vaultTemplate' threw exception with message: Error creating bean with name 'vaultSessionManager' defined in class path resource [org/springframework/cloud/vault/config/VaultAutoConfiguration.class]: Unsatisfied dependency expressed through method 'vaultSessionManager' parameter 0: Error creating bean with name 'clientAuthentication' defined in class path resource [org/springframework/cloud/vault/config/VaultAutoConfiguration.class]: Failed to instantiate [org.springframework.vault.authentication.ClientAuthentication]: Factory method 'clientAuthentication' threw exception with message: Cannot create authentication mechanism for TOKEN. This method requires either a Token (spring.cloud.vault.token) or a token file at ~/.vault-
@GHGHGHKO
GHGHGHKO / application.yml
Last active January 2, 2023 11:59
disable vault
spring:
cloud:
vault:
enabled: false
@GHGHGHKO
GHGHGHKO / HelloWorldController.kt
Last active January 3, 2023 11:03
kotlin HelloWorldController
package com.example.pepega.helloworld
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping(value = ["/helloWorld/v1"])
class HelloWorldController {
@GHGHGHKO
GHGHGHKO / UserMaster.kt
Created January 3, 2023 12:18
entity without ID
package com.example.pepega.common.domain
import jakarta.persistence.Entity
import jakarta.persistence.Table
@Entity
@Table(name = "user_master")
class UserMaster {
}
@GHGHGHKO
GHGHGHKO / BaseEntity.kt
Created January 3, 2023 12:34
base entity
package com.example.pepega.common.domain
import jakarta.persistence.Column
import jakarta.persistence.Id
import jakarta.persistence.MappedSuperclass
import org.springframework.data.annotation.LastModifiedDate
import org.springframework.data.domain.Persistable
import java.time.LocalDateTime
import java.util.UUID
/*
* (non-Javadoc)
* @see org.springframework.data.repository.CrudRepository#save(java.lang.Object)
*/
@Transactional
@Override
public <S extends T> S save(S entity) {
Assert.notNull(entity, "Entity must not be null.");
public boolean isNew(T entity) {
ID id = getId(entity);
Class<ID> idType = getIdType();
if (!idType.isPrimitive()) {
return id == null;
}
if (id instanceof Number) {
@GHGHGHKO
GHGHGHKO / HelloWorld.kt
Last active January 4, 2023 13:17
HelloWorld entity
package com.example.pepega.helloworld.domain
import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.Id
import jakarta.persistence.Table
import java.util.UUID
@Entity
@Table(name = "Foo")
@GHGHGHKO
GHGHGHKO / build.gradle.kts
Created January 4, 2023 13:22
gradle plugins with kotlin jpa by start.spring.io
kotlin("plugin.spring") version "1.7.22"
kotlin("plugin.jpa") version "1.7.22"
@GHGHGHKO
GHGHGHKO / HelloWorld.kt
Created January 10, 2023 11:19
Entity final keywords
package com.example.pepega.helloworld.domain
import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.Id
import java.util.UUID
@Entity
class HelloWorld(
message: String