60 lines
2.3 KiB
Java
60 lines
2.3 KiB
Java
package hello;
|
|
|
|
import hello.agh.edu.bazy.interceptor.RequestInterceptor;
|
|
import org.springframework.boot.CommandLineRunner;
|
|
import org.springframework.boot.SpringApplication;
|
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
|
|
|
|
|
@ComponentScan
|
|
@EnableAutoConfiguration(exclude = HibernateJpaAutoConfiguration.class)
|
|
@EnableWebMvc
|
|
/*
|
|
@ImportResource("classpath:/database-blueprint1.xml")
|
|
*/
|
|
public class Application extends WebMvcConfigurerAdapter implements CommandLineRunner {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
SpringApplication.run(Application.class, args);
|
|
}
|
|
|
|
@Override
|
|
public void run(String... args) throws Exception {
|
|
|
|
|
|
// context.close();
|
|
}
|
|
|
|
@Override
|
|
public void addInterceptors(InterceptorRegistry registry) {
|
|
//TODO INTERCEPTORS DO NOT FIRE ON PATHS
|
|
// TODO only /** works
|
|
registry.addInterceptor(new RequestInterceptor("GIS_CRUD")).addPathPatterns("/gis/*/*", "/gis/*");
|
|
// registry.addInterceptor(new RequestInterceptor("OBJECTS_CRUD")).addPathPatterns("/objects**");
|
|
registry.addInterceptor(new RequestInterceptor("SENSORS_CRUD")).addPathPatterns("/sensors/*/*", "/sensors/*");
|
|
// registry.addInterceptor(new RequestInterceptor("REQUIREMENTS_CRUD")).addPathPatterns("/requirements**");
|
|
// registry.addInterceptor(new RequestInterceptor("RULES_CRUD")).addPathPatterns("/rules**");
|
|
// registry.addInterceptor(new RequestInterceptor("PROFILES_CRUD")).addPathPatterns("/profiles**");
|
|
}
|
|
|
|
/*
|
|
@Bean(name = "gisosmDataSource")
|
|
public GisDataSource dataSource() {
|
|
GisDataSource dataSource = new GisDataSource();
|
|
dataSource.setDriverClassName("org.postgis.DriverWrapper");
|
|
dataSource.setUrl("jdbc:postgresql_postGIS://10.156.207.136:5432/osm");
|
|
dataSource.setPassword("ztb2015");
|
|
dataSource.setUsername("postgres");
|
|
return dataSource; }
|
|
|
|
|
|
*/
|
|
|
|
}
|