修改网站名配置方式

This commit is contained in:
xiongxiaoyang 2019-12-28 11:46:34 +08:00
parent 8db9eb6042
commit 3986557be9
10 changed files with 46 additions and 24 deletions

View File

@ -3,6 +3,7 @@ package xyz.zinglizingli;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.TaskScheduler;
@ -13,6 +14,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
@EnableCaching
@EnableScheduling
@MapperScan({"xyz.zinglizingli.*.mapper"})
@ServletComponentScan
public class BookApplication {
public static void main(String[] args) {

View File

@ -7,25 +7,35 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.support.WebApplicationContextUtils;
import xyz.zinglizingli.books.core.crawl.BaseCrawlSource;
import xyz.zinglizingli.books.core.utils.Constants;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
/**
* @author 11797
*/
@Component
@WebListener
@Slf4j
@RequiredArgsConstructor
public class StartListener implements ApplicationListener<ContextRefreshedEvent> {
public class StartListener implements ServletContextListener {
private final BaseCrawlSource crawlSource;
@Value("${crawl.book.new.enabled}")
private String crawlEnable;
@SneakyThrows
@Value("${website.name}")
private String webSiteName;
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
public void contextInitialized(ServletContextEvent servletContextEvent) {
servletContextEvent.getServletContext().setAttribute("websiteName",webSiteName);
if (!Constants.ENABLE_NEW_BOOK.equals(crawlEnable.trim())) {
log.info("程序启动");
new Thread(() -> {
@ -45,4 +55,8 @@ public class StartListener implements ApplicationListener<ContextRefreshedEvent>
}
}
@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {
}
}

View File

@ -2,6 +2,7 @@ package xyz.zinglizingli.books.web;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
@ -11,6 +12,8 @@ import xyz.zinglizingli.books.service.BookService;
import xyz.zinglizingli.common.cache.CommonCacheUtil;
import xyz.zinglizingli.books.core.config.IndexRecBooksConfig;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@ -21,6 +24,7 @@ import java.util.Map;
@Controller
@RequestMapping
@RequiredArgsConstructor
@Slf4j
public class IndexController {

View File

@ -1,3 +1,6 @@
website:
name: 笔趣阁新书门
server:
port: 8080

View File

@ -1 +0,0 @@
website.name=小说精品屋

View File

@ -5,12 +5,12 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title th:text="#{website.name}+'_小说列表'"></title>
<title th:text="${application.websiteName}+'_小说列表'"></title>
<meta name="keywords" th:content="#{website.name}+',精品小说,弹幕网站,弹幕,弹幕小说网站,免费小说,小说阅读,小说排行,轻小说,txt小说下载,电子书下载,动漫轻小说,日本轻小说'">
<meta name="keywords" th:content="${application.websiteName}+',精品小说,弹幕网站,弹幕,弹幕小说网站,免费小说,小说阅读,小说排行,轻小说,txt小说下载,电子书下载,动漫轻小说,日本轻小说'">
<meta name="description"
th:content="#{website.name}+'是国内优秀的小说弹幕网站,'+#{website.name}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'">
th:content="${application.websiteName}+'是国内优秀的小说弹幕网站,'+${application.websiteName}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'">
<div th:include="common/css :: css"></div>

View File

@ -5,17 +5,17 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title th:text="#{website.name}"></title>
<title th:text="${application.websiteName}"></title>
<meta name="keywords" th:content="#{website.name}+',精品小说,弹幕网站,弹幕,弹幕小说网站,免费小说,小说阅读,小说排行,轻小说,txt小说下载,电子书下载,动漫轻小说,日本轻小说'">
<meta name="keywords" th:content="${application.websiteName}+',精品小说,弹幕网站,弹幕,弹幕小说网站,免费小说,小说阅读,小说排行,轻小说,txt小说下载,电子书下载,动漫轻小说,日本轻小说'">
<meta name="description"
th:content="#{website.name}+'是国内优秀的小说弹幕网站,'+#{website.name}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'">
th:content="${application.websiteName}+'是国内优秀的小说弹幕网站,'+${application.websiteName}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'">
<meta property="og:type" content="novel_index"/>
<meta property="og:title" th:content="#{website.name}"/>
<meta property="og:title" th:content="${application.websiteName}"/>
<meta property="og:description"
th:content="#{website.name}+'是国内优秀的小说弹幕网站,'+#{website.name}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'"/>
th:content="${application.websiteName}+'是国内优秀的小说弹幕网站,'+${application.websiteName}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'"/>
<div th:include="common/css :: css"></div>

View File

@ -5,17 +5,17 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title th:text="#{website.name}+'_漫画专区'"></title>
<title th:text="${application.websiteName}+'_漫画专区'"></title>
<meta name="keywords" th:content="#{website.name}+',精品小说,弹幕网站,弹幕,弹幕小说网站,免费小说,小说阅读,小说排行,轻小说,txt小说下载,电子书下载,动漫轻小说,日本轻小说'">
<meta name="keywords" th:content="${application.websiteName}+',精品小说,弹幕网站,弹幕,弹幕小说网站,免费小说,小说阅读,小说排行,轻小说,txt小说下载,电子书下载,动漫轻小说,日本轻小说'">
<meta name="description"
th:content="#{website.name}+'是国内优秀的小说弹幕网站,'+#{website.name}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'">
th:content="${application.websiteName}+'是国内优秀的小说弹幕网站,'+${application.websiteName}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'">
<meta property="og:type" content="mh_novel_index"/>
<meta property="og:title" th:content="#{website.name}+'_漫画专区'"/>
<meta property="og:title" th:content="${application.websiteName}+'_漫画专区'"/>
<meta property="og:description"
th:content="#{website.name}+'是国内优秀的小说弹幕网站,'+#{website.name}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'"/>
th:content="${application.websiteName}+'是国内优秀的小说弹幕网站,'+${application.websiteName}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'"/>
<div th:include="common/css :: css"></div>

View File

@ -5,17 +5,17 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title th:text="#{website.name}+'_轻小说专区'"></title>
<title th:text="${application.websiteName}+'_轻小说专区'"></title>
<meta name="keywords" th:content="#{website.name}+',精品小说,弹幕网站,弹幕,弹幕小说网站,免费小说,小说阅读,小说排行,轻小说,txt小说下载,电子书下载,动漫轻小说,日本轻小说'">
<meta name="keywords" th:content="${application.websiteName}+',精品小说,弹幕网站,弹幕,弹幕小说网站,免费小说,小说阅读,小说排行,轻小说,txt小说下载,电子书下载,动漫轻小说,日本轻小说'">
<meta name="description"
th:content="#{website.name}+'是国内优秀的小说弹幕网站,'+#{website.name}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'">
th:content="${application.websiteName}+'是国内优秀的小说弹幕网站,'+${application.websiteName}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'">
<meta property="og:type" content="soft_novel_index"/>
<meta property="og:title" th:content="#{website.name}+'_轻小说专区'"/>
<meta property="og:title" th:content="${application.websiteName}+'_轻小说专区'"/>
<meta property="og:description"
th:content="#{website.name}+'是国内优秀的小说弹幕网站,'+#{website.name}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'"/>
th:content="${application.websiteName}+'是国内优秀的小说弹幕网站,'+${application.websiteName}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'"/>
<div th:include="common/css :: css"></div>

View File

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>登录|注册</title>
<meta name="description"
th:content="#{website.name}+'是国内优秀的小说弹幕网站,'+#{website.name}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'">
th:content="${application.websiteName}+'是国内优秀的小说弹幕网站,'+${application.websiteName}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'">
<div th:include="common/css :: css"></div>