This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import springfox.documentation.builders.ApiInfoBuilder; | |
import springfox.documentation.builders.AuthorizationScopeBuilder; | |
import springfox.documentation.builders.PathSelectors; | |
import springfox.documentation.builders.RequestHandlerSelectors; | |
import springfox.documentation.service.ApiInfo; | |
import springfox.documentation.service.ApiKey; | |
import springfox.documentation.service.AuthorizationScope; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.context.annotation.Profile; | |
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | |
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | |
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | |
@EnableWebSecurity | |
public class SecurityConfigDisable extends WebSecurityConfigurerAdapter { | |
@Override | |
protected void configure(HttpSecurity http) throws Exception { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lombok.*; | |
import org.springframework.data.annotation.CreatedBy; | |
import org.springframework.data.annotation.CreatedDate; | |
import org.springframework.data.annotation.LastModifiedBy; | |
import org.springframework.data.annotation.LastModifiedDate; | |
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | |
import javax.persistence.EntityListeners; | |
import javax.persistence.MappedSuperclass; | |
import java.util.Calendar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Stage 1 ### | |
FROM openjdk:8 AS BUILD_IMAGE | |
ENV APP_HOME=/root/dev/myapp/ | |
RUN mkdir -p $APP_HOME/src/main/java | |
WORKDIR $APP_HOME | |
COPY build.gradle gradlew gradlew.bat $APP_HOME | |
COPY gradle $APP_HOME/gradle | |
# download dependencies | |
RUN ./gradlew build -x :bootRepackage -x test --continue | |
COPY . . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.beans.BeansException; | |
import org.springframework.context.ApplicationContext; | |
import org.springframework.context.ApplicationContextAware; | |
import org.springframework.stereotype.Service; | |
import org.springframework.web.context.request.RequestContextHolder; | |
import java.util.Objects; | |
@Service | |
public class SpringBeanUtil implements ApplicationContextAware { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.Optional; | |
import java.util.function.Predicate; | |
public final class EnumUtils { | |
public static <E extends Enum<E>> Optional<E> getByPredicate(final Class<E> enumClass, Predicate<E> predicate){ | |
return Arrays.stream(enumClass.getEnumConstants()) | |
.filter(predicate) | |
.findFirst(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Slf4j | |
@Component | |
public class AppStartupRunner implements ApplicationRunner { | |
@Autowired | |
private ServletContext servletContext; | |
@Override | |
public void run(ApplicationArguments args) throws Exception { | |
log.info(">>>>>>> Context Path is : {}", servletContext.getContextPath()); // Result: "/my-context" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lombok.Getter; | |
import lombok.Setter; | |
import lombok.ToString; | |
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | |
import org.springframework.boot.context.properties.ConfigurationProperties; | |
import org.springframework.boot.context.properties.EnableConfigurationProperties; | |
import java.util.List; | |
@Getter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; | |
import org.springframework.boot.test.context.SpringBootTest; | |
import org.springframework.test.context.ActiveProfiles; | |
import org.springframework.test.context.junit4.SpringRunner; | |
@RunWith(SpringRunner.class) | |
@SpringBootTest | |
@AutoConfigureTestDatabase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@TypeDefs({ | |
@TypeDef(defaultForType = UUID.class, typeClass = UUIDCharType.class) | |
}) | |
package com.example; | |
import org.hibernate.annotations.TypeDef; | |
import org.hibernate.annotations.TypeDefs; | |
import org.hibernate.type.UUIDCharType; | |
import java.util.UUID; |
OlderNewer