You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.4 KiB
41 lines
1.4 KiB
package org.pqh.achieve.config;
|
|
|
|
import org.pqh.core.config.HibernateConfig;
|
|
import org.springframework.context.ApplicationContext;
|
|
import org.springframework.context.annotation.*;
|
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
|
import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
|
|
|
/**
|
|
* Created by reborn on 2017/7/28.
|
|
*/
|
|
@Configuration
|
|
@EnableWebMvc
|
|
@ComponentScan(basePackages = "org.pqh")
|
|
@EnableAspectJAutoProxy
|
|
@Import(HibernateConfig.class)
|
|
public class SpringConfig extends WebMvcConfigurationSupport{
|
|
|
|
private static ApplicationContext applicationContext;
|
|
|
|
public static <T>T getBean(Class<T> c){
|
|
return applicationContext.getBean(c);
|
|
}
|
|
|
|
@Override
|
|
public void setApplicationContext(ApplicationContext applicationContext) {
|
|
super.setApplicationContext(applicationContext);
|
|
SpringConfig.applicationContext=applicationContext;
|
|
}
|
|
|
|
@Bean("viewReslover")
|
|
public InternalResourceViewResolver internalResourceViewResolver(){
|
|
InternalResourceViewResolver internalResourceViewResolver=new InternalResourceViewResolver();
|
|
internalResourceViewResolver.setPrefix("/WEB-INF/jsp/");
|
|
internalResourceViewResolver.setSuffix(".jsp");
|
|
return internalResourceViewResolver;
|
|
}
|
|
|
|
|
|
}
|
|
|