This repository has been archived on 2020-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
e-commerce/web_backend/src/main/java/org/hso/ecommerce/app/Config.java

31 lines
1.2 KiB
Java
Raw Normal View History

2020-01-25 22:13:26 +01:00
package org.hso.ecommerce.app;
2020-04-27 09:48:24 +02:00
import org.hso.ecommerce.components.ErrorDemoInterceptor;
2020-03-05 20:34:59 +01:00
import org.hso.ecommerce.components.InfoDemoInterceptor;
2020-04-27 09:48:24 +02:00
import org.hso.ecommerce.components.LoginIntercepter;
2020-05-05 17:24:25 +02:00
import org.hso.ecommerce.components.ShoppingCartInterceptor;
2020-04-08 18:27:46 +02:00
import org.springframework.context.annotation.Bean;
2020-01-25 22:13:26 +01:00
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class Config implements WebMvcConfigurer {
2020-04-08 18:27:46 +02:00
// Copied from https://stackoverflow.com/questions/18218386/cannot-autowire-service-in-handlerinterceptoradapter/18218439
// Currently not needed for the other interceptors. They will be removed anyway.
@Bean
public LoginIntercepter buildLoginIntercepter() {
return new LoginIntercepter();
}
2020-01-25 22:13:26 +01:00
@Override
public void addInterceptors(InterceptorRegistry registry) {
2020-04-08 18:27:46 +02:00
registry.addInterceptor(buildLoginIntercepter());
2020-02-06 19:44:51 +01:00
registry.addInterceptor(new ErrorDemoInterceptor());
2020-03-05 20:34:59 +01:00
registry.addInterceptor(new InfoDemoInterceptor());
2020-05-05 17:24:25 +02:00
registry.addInterceptor(new ShoppingCartInterceptor());
2020-01-25 22:13:26 +01:00
}
2020-02-06 19:44:51 +01:00
}