@Configuration
public class AppConfig {
@Autowired
@Lazy
UserService userService;
@Bean
public BCryptPasswordEncoder bCryptPasswordEncoder() {
return new BCryptPasswordEncoder(5);
}
@Autowired
protected void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userService).passwordEncoder(bCryptPasswordEncoder());
}
}
@Autowired
protected void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userService).passwordEncoder(bCryptPasswordEncoder());
}
- тут вообще какая-то аброкадабра. Что в конфиге делает void? Почему он бросает эксепшн?...
@Autowired
AuthenticationManagerBuilder auth;
@PostConstruct
void init() {
auth.userDetailsService(this).passwordEncoder(bCryptPasswordEncoder);
}
...
var s = Arrays.asList("a", "a", "a", "b", "b", "b", "c");
var map = s.stream()
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
var max = map.entrySet().stream()
.max(Map.Entry.comparingByValue())
.map(Map.Entry::getValue)
.orElse(0L);
var result = map.entrySet().stream()
.filter(e -> e.getValue().equals(max))
.map(Map.Entry::getKey)
.collect(Collectors.toList()); // [a, b]
int dice;
int[] tab = new int[3];
boolean gameOver = false;
System.out.println("\n\t -= SNAIL RUN =- ");
while (!gameOver) {
System.out.println("\n");
for (int i = 0; i < tab.length; i++) {
// Generating random numbers
dice = ThreadLocalRandom.current().nextInt(1, 6 + 1);
tab[i] += dice;
if (tab[i] > 50) {
gameOver = true;
}
System.out.print("Dice" + (i + 1) + "=" + dice + " | ");
}
System.out.println("\n");
for (int i = 0; i < tab.length; i++) {
System.out.print(tab[i] + " | ");
}
System.out.println("\n________________________________________________________________");
}
System.out.println("\nGAME OVER");
Integer a = 127;
Integer b = 127;
System.out.println(a == b); // true
Integer i = 128;
Integer j = 128;
System.out.println(i == j); //false
System.out.println(i.equals(j)); //true
Double a = 1998d;
Double b = 1998d;
System.out.println(a == b); // false
System.out.println(a.equals(b)); // true