Skip to content

Instantly share code, notes, and snippets.

View BorzdeG's full-sized avatar
🏠
Working from home

Viktor Alenkov BorzdeG

🏠
Working from home
View GitHub Profile
@BorzdeG
BorzdeG / settings.gradle
Last active December 14, 2015 23:15
settings.gradle template
rootDir.eachDirRecurse() { dir ->
if (new File(dir, 'build.gradle').exists()) {
logger.trace('found module: ' + dir.name)
final String prjName = ':' + dir.name
logger.lifecycle('include project: ' + prjName)
include prjName
project(prjName).projectDir = dir
}
}
@BorzdeG
BorzdeG / Spring.Java8.toGrantedAuthorities
Last active August 19, 2017 06:35
example Java 8 Streams
import org.springframework.security.core.GrantedAuthority;
import org.springframework.util.StringUtils;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import java.util.stream.Collectors;
/**
* Строки в роли для Spring Security. В каждой строке может быть несколько ролей через запятую
* Результат: набор ролей, консолидированный из переданных roles
*/
public static Set<GrantedAuthority> toGrantedAuthoritiesDemo(final String[] roles) {