interceptory
This commit is contained in:
1 parent
3c3bbb8863
commit
f5eff23562
2 files changed
+41
-1
No files matched your search
@@ -5,12 +5,16 @@ import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ComponentScan
|
||||
@EnableAutoConfiguration
|
||||
public class Application implements CommandLineRunner {
|
||||
@EnableWebMvc
|
||||
public class Application extends WebMvcConfigurerAdapter implements CommandLineRunner{
|
||||
@Autowired
|
||||
CustomerRepository repository;
|
||||
|
||||
@@ -55,4 +59,8 @@ public class Application implements CommandLineRunner {
|
||||
// context.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(new SampleInterceptor()).addPathPatterns("/**");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user