macro 6 жил өмнө
parent
commit
d918b0c818

+ 0 - 4
mall-admin/src/main/java/com/macro/mall/MallAdminApplication.java

@@ -1,17 +1,13 @@
 package com.macro.mall;
 
-import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.transaction.annotation.EnableTransactionManagement;
 
 /**
  * 应用启动入口
  * Created by macro on 2018/4/26.
  */
 @SpringBootApplication
-@MapperScan({"com.macro.mall.mapper","com.macro.mall.dao"})
-@EnableTransactionManagement
 public class MallAdminApplication {
     public static void main(String[] args) {
         SpringApplication.run(MallAdminApplication.class, args);

+ 15 - 0
mall-admin/src/main/java/com/macro/mall/config/MyBatisConfig.java

@@ -0,0 +1,15 @@
+package com.macro.mall.config;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+/**
+ * MyBatis配置类
+ * Created by macro on 2019/4/8.
+ */
+@Configuration
+@EnableTransactionManagement
+@MapperScan({"com.macro.mall.mapper","com.macro.mall.dao"})
+public class MyBatisConfig {
+}

+ 0 - 5
mall-demo/src/main/java/com/macro/mall/MallDemoApplication.java

@@ -1,14 +1,9 @@
 package com.macro.mall;
 
-import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
 
 @SpringBootApplication
-@MapperScan("com.macro.mall.mapper")
 public class MallDemoApplication{
 	public static void main(String[] args) {
 		SpringApplication.run(MallDemoApplication.class, args);

+ 13 - 0
mall-demo/src/main/java/com/macro/mall/demo/config/MyBatisConfig.java

@@ -0,0 +1,13 @@
+package com.macro.mall.demo.config;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * MyBatis配置类
+ * Created by macro on 2019/4/8.
+ */
+@Configuration
+@MapperScan("com.macro.mall.mapper")
+public class MyBatisConfig {
+}

+ 0 - 4
mall-portal/src/main/java/com/macro/mall/portal/MallPortalApplication.java

@@ -1,13 +1,9 @@
 package com.macro.mall.portal;
 
-import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.scheduling.annotation.EnableScheduling;
 
 @SpringBootApplication
-@MapperScan({"com.macro.mall.mapper","com.macro.mall.portal.dao"})
-@EnableScheduling
 public class MallPortalApplication {
 
     public static void main(String[] args) {

+ 15 - 0
mall-portal/src/main/java/com/macro/mall/portal/config/MyBatisConfig.java

@@ -0,0 +1,15 @@
+package com.macro.mall.portal.config;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+/**
+ * MyBatis配置类
+ * Created by macro on 2019/4/8.
+ */
+@Configuration
+@EnableTransactionManagement
+@MapperScan({"com.macro.mall.mapper","com.macro.mall.portal.dao"})
+public class MyBatisConfig {
+}

+ 13 - 0
mall-portal/src/main/java/com/macro/mall/portal/config/SpringTaskConfig.java

@@ -0,0 +1,13 @@
+package com.macro.mall.portal.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+/**
+ * 定时任务配置
+ * Created by macro on 2019/4/8.
+ */
+@Configuration
+@EnableScheduling
+public class SpringTaskConfig {
+}

+ 0 - 2
mall-search/src/main/java/com/macro/mall/search/MallSearchApplication.java

@@ -1,11 +1,9 @@
 package com.macro.mall.search;
 
-import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 
 @SpringBootApplication
-@MapperScan({"com.macro.mall.mapper","com.macro.mall.search.dao"})
 public class MallSearchApplication {
 
     public static void main(String[] args) {

+ 13 - 0
mall-search/src/main/java/com/macro/mall/search/config/MyBatisConfig.java

@@ -0,0 +1,13 @@
+package com.macro.mall.search.config;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * MyBatis配置类
+ * Created by macro on 2019/4/8.
+ */
+@Configuration
+@MapperScan({"com.macro.mall.mapper","com.macro.mall.search.dao"})
+public class MyBatisConfig {
+}