Авторизация в Spring Security
Конфиг для spring security
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.antMatcher("/**")
.authorizeRequests()
.antMatchers("/", "/login**", "/js/**", "/error**").permitAll()
.anyRequest().authenticated()
.and().logout().logoutSuccessUrl("/").permitAll()
.and()
.csrf().disable();
}
По идее при заходе на главную страницу пользователь должен по ссылке авторизоваться через гугл (oAuth), но этого не происходит. Вся моя задумка перестала работать после того как я добавил @ComponentScan в класс запуска spring application
@SpringBootApplication
@ComponentScan("util")
public class Runner {
public static void main(String[] args) {
SpringApplication.run(Runner.class, args);
}
}
Но если я не добавляю аннотацию ComponentScan вылазит другая проблема в виде ошибки
Вот класс, в котором возникает ошибка
@Component
public class WSSender {
private final SimpMessagingTemplate simpMessagingTemplate;
private final ObjectMapper objectMapper;
public WSSender(SimpMessagingTemplate template, ObjectMapper objectMapper){
this.simpMessagingTemplate = template;
this.objectMapper = objectMapper;
}
public <T> BiConsumer<EventType, T> getSender(ObjectType type, Class view){
ObjectWriter object = objectMapper
.setSerializationConfig(objectMapper.getSerializationConfig())
.writerWithView(view);
return (EventType event, T payload) -> {
String value = null;
try {
value = object.writeValueAsString(payload);
}catch (IOException ex){
throw new RuntimeException(ex);
}
simpMessagingTemplate.convertAndSend("/topic/activity", new WSEventDto(type, event, value));
};
}
Вообще мне кажется, что ответ лежит где-то на поверхности, но никак не могу додумать, что не так

