2 Star 0 Fork 0

skey/cms

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
CmsSpringBootApplication.java 3.31 KB
一键复制 编辑 原始数据 按行查看 历史
skey 提交于 2021-12-20 11:07 . no commit message
package dswork.cms;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
/**
* 以SpringBoot方式运行时,如项目中有@WebServlet、@WebFilter、@WebListener需加上@ServletComponentScan({"package-name1", "package-name2"})
* 以SpringBoot方式运行时,可通过src/main/resources下的application.properties文件进行相关的配置(端口、context-path等)
*/
@SpringBootApplication
@ServletComponentScan({"dswork.cms", "common.cms", "dswork.sso"})
@ComponentScan({"common.cms"})
public class CmsSpringBootApplication
{
public static void main(String[] args)
{
SpringApplication.run(CmsSpringBootApplication.class, args);
}
@Bean
public InternalResourceViewResolver cmsViewResolver()
{
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setViewClass(CmsInternalResourceView.class); // 设置检查器
resolver.setContentType("text/html;charset=UTF-8");
resolver.setPrefix("/html");
resolver.setSuffix("");
resolver.setOrder(1);
return resolver;
}
// @Bean
// public FilterRegistrationBean<dswork.sso.WebFilter> buildWebFilter()
// {
// FilterRegistrationBean<dswork.sso.WebFilter> filterRegistrationBean = new FilterRegistrationBean<dswork.sso.WebFilter>();
// filterRegistrationBean.setOrder(1);
// filterRegistrationBean.setFilter(new dswork.sso.WebFilter());
// filterRegistrationBean.setName("websso");
// filterRegistrationBean.addUrlPatterns("/cms/*");
// return filterRegistrationBean;
// }
//
// @Bean
// public FilterRegistrationBean<dswork.authown.AuthOwnSSOFilter> buildAuthOwnSSOFilter()
// {
// FilterRegistrationBean<dswork.authown.AuthOwnSSOFilter> filterRegistrationBean = new FilterRegistrationBean<dswork.authown.AuthOwnSSOFilter>();
// filterRegistrationBean.setOrder(2);
// filterRegistrationBean.setFilter(new dswork.authown.AuthOwnSSOFilter());
// filterRegistrationBean.setName("authOwnSSOFilter");
// filterRegistrationBean.addUrlPatterns("/cms/*");
// return filterRegistrationBean;
// }
@Bean
public FilterRegistrationBean<dswork.authown.AuthOwnFilter> buildAuthOwnFilter()
{
FilterRegistrationBean<dswork.authown.AuthOwnFilter> filterRegistrationBean = new FilterRegistrationBean<dswork.authown.AuthOwnFilter>();
filterRegistrationBean.setOrder(2);
filterRegistrationBean.setFilter(new dswork.authown.AuthOwnFilter());
filterRegistrationBean.setName("authOwnFilter");
filterRegistrationBean.addUrlPatterns("/cms/*");
return filterRegistrationBean;
}
// @Bean
// @SuppressWarnings("all")
// public org.springframework.boot.web.servlet.ServletListenerRegistrationBean servletListenerRegistrationBean()
// {
// org.springframework.boot.web.servlet.ServletListenerRegistrationBean servletListenerRegistrationBean = new org.springframework.boot.web.servlet.ServletListenerRegistrationBean();
// servletListenerRegistrationBean.setListener(new se.jiderhamn.classloader.leak.prevention.ClassLoaderLeakPreventor());
// return servletListenerRegistrationBean;
// }
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/skeychen/cms.git
git@gitee.com:skeychen/cms.git
skeychen
cms
cms
master

搜索帮助