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
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes(); | |
HttpServletRequest httpServletRequest = servletRequestAttributes.getRequest(); | |
HttpServletResponse httpServletResponse = servletRequestAttributes.getResponse(); |
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.AllArgsConstructor; | |
import lombok.Data; | |
@Data | |
@AllArgsConstructor | |
public class LazyDeveloper { | |
private String firstName; | |
private String lastName; |
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.joda.time.DateTime; | |
public class StartEndTimeWithJodaTime { | |
private DateTime startTime; | |
private DateTime endTime; | |
public void process() { | |
startTime = DateTime.now(); |
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
public class ComparingUtils { | |
public static <T extends Comparable<T>> ComparisonBuilder<T> is(T comparable) { | |
return new ComparisonBuilder<>(comparable); | |
} | |
public static class ComparisonBuilder<T> { | |
private Comparable<T> subject; |
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
// Use HttpComponentsClientHttpRequestFactory to fix the issue | |
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; | |
... | |
RestTemplate restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory()); |
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
#!/bin/bash | |
# DESCRIPTION | |
# ----------- | |
# | |
# Produces CSV output like this: | |
# | |
# LAST CHANGE TIME, TIME ELAPSED, AUTHOR, BRANCH | |
# 2017-01-16 14:56:26 +0000, 3 months ago, john.doe@example.com, origin/bug-fix-1 | |
# 2017-01-23 18:27:53 +0300, 2 months ago, john.doe@example.com, origin/new-feature-1 |
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
#!/bin/bash | |
# Run tests | |
mvn clean test --fail-never | |
# Print header | |
echo | |
echo "TEST NAME, TESTS COUNT, FAILURES COUNT, ERRORS COUNT, SKIPPED COUNT, TIME ELAPSED" | |
# Prepare report |
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
#!/bin/bash | |
python -m SimpleHTTPServer |
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.Component; | |
@Component | |
public class ApplicationContextHolder implements ApplicationContextAware { | |
private static ApplicationContext applicationContext; |
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.apache.commons.collections4.CollectionUtils; | |
import org.apache.commons.collections4.IteratorUtils; | |
import org.apache.commons.lang3.StringUtils; | |
import org.hibernate.query.criteria.internal.path.PluralAttributePath; | |
import org.springframework.data.domain.Page; | |
import org.springframework.data.domain.PageRequest; | |
import org.springframework.data.repository.support.PageableExecutionUtils; | |
import javax.persistence.EntityManager; | |
import javax.persistence.TypedQuery; |