From c2b2c1634b8119e9d8911d3a047cc4683040f26a Mon Sep 17 00:00:00 2001 From: Nicky <362330721@qq.com> Date: Sat, 16 Jun 2018 16:48:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=90=AFspringBoot=E7=83=AD=E9=83=A8?= =?UTF-8?q?=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pom.xml | 14 +++++-- .../taoshop-common-core/pom.xml | 38 +------------------ .../common/core/base/config/WebConfig.java | 21 ++++++++++ src/taoshop-portal/pom.xml | 14 ++++++- .../com/muses/taoshop/portal/Application.java | 2 +- 5 files changed, 46 insertions(+), 43 deletions(-) create mode 100644 src/taoshop-common/taoshop-common-core/src/main/java/com/muses/taoshop/common/core/base/config/WebConfig.java diff --git a/src/pom.xml b/src/pom.xml index 828a9f8..95af58e 100644 --- a/src/pom.xml +++ b/src/pom.xml @@ -71,6 +71,15 @@ + + org.springframework.boot + spring-boot-maven-plugin + + true + true + + + @@ -100,13 +109,10 @@ org.springframework.boot spring-boot-devtools + provided true - - org.springframework.boot - spring-boot-starter-thymeleaf - diff --git a/src/taoshop-common/taoshop-common-core/pom.xml b/src/taoshop-common/taoshop-common-core/pom.xml index 32cb127..efd7334 100644 --- a/src/taoshop-common/taoshop-common-core/pom.xml +++ b/src/taoshop-common/taoshop-common-core/pom.xml @@ -17,8 +17,6 @@ UTF-8 - 1.7 - 1.7 @@ -30,39 +28,5 @@ - - - - - maven-clean-plugin - 3.0.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.7.0 - - - maven-surefire-plugin - 2.20.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - + diff --git a/src/taoshop-common/taoshop-common-core/src/main/java/com/muses/taoshop/common/core/base/config/WebConfig.java b/src/taoshop-common/taoshop-common-core/src/main/java/com/muses/taoshop/common/core/base/config/WebConfig.java new file mode 100644 index 0000000..1d1108d --- /dev/null +++ b/src/taoshop-common/taoshop-common-core/src/main/java/com/muses/taoshop/common/core/base/config/WebConfig.java @@ -0,0 +1,21 @@ +package com.muses.taoshop.common.core.base.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.util.ResourceUtils; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + +@EnableWebMvc +@Configuration +public class WebConfig extends WebMvcConfigurerAdapter { + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + + registry.addResourceHandler("/templates/**").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX+"/templates/"); + registry.addResourceHandler("/static/**").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX+"/static/"); + super.addResourceHandlers(registry); + } + +} \ No newline at end of file diff --git a/src/taoshop-portal/pom.xml b/src/taoshop-portal/pom.xml index 9ba4e1c..0729cdd 100644 --- a/src/taoshop-portal/pom.xml +++ b/src/taoshop-portal/pom.xml @@ -24,13 +24,23 @@ + + org.springframework.boot + spring-boot-devtools + provided + true + + com.muses.taoshop.provider taoshop-provider-item 1.0-SNAPSHOT - + + org.springframework.boot + spring-boot-starter-thymeleaf + @@ -59,6 +69,7 @@ 1.8 1.8 + true 1.8 UTF-8 @@ -77,4 +88,5 @@ + diff --git a/src/taoshop-portal/src/main/java/com/muses/taoshop/portal/Application.java b/src/taoshop-portal/src/main/java/com/muses/taoshop/portal/Application.java index b75df14..36cf576 100644 --- a/src/taoshop-portal/src/main/java/com/muses/taoshop/portal/Application.java +++ b/src/taoshop-portal/src/main/java/com/muses/taoshop/portal/Application.java @@ -29,7 +29,7 @@ import org.springframework.web.bind.annotation.*; @EnableTransactionManagement //@EnableCaching @EnableAsync -//@EnableAutoConfiguration +@EnableAutoConfiguration //TODO 修改该注解可以实现自动部署 @SpringBootApplication(exclude={DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, MybatisAutoConfiguration.class}) public class Application { -- GitLab