2019-08-27

package com.hiynn.core;

//特别注意,下面的是 tk.MapperScan

import com.github.tobato.fastdfs.FdfsClientConfig;
import com.hiynn.core.commons.resolver.MyExceptionResolver;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import tk.mybatis.spring.annotation.MapperScan;

/**

  • @author zz

  • @date 2018-7-2
    /
    @ServletComponentScan
    @SpringBootApplication
    @EnableTransactionManagement
    @EnableSwagger2
    @EnableCaching
    @EnableAsync
    @EnableScheduling
    @MapperScan(basePackages = "com.hiynn.core.
    .mapper",sqlSessionFactoryRef = "localSqlSessionFactory")
    @org.mybatis.spring.annotation.MapperScans(value = {
    @org.mybatis.spring.annotation.MapperScan(basePackages = "com.hiynn.core.
    .mapper2",sqlSessionFactoryRef = "publicSqlSessionFactory"),
    @org.mybatis.spring.annotation.MapperScan(basePackages = "com.hiynn.core.
    .mapper3",sqlSessionFactoryRef = "systemSqlSessionFactory"),
    @org.mybatis.spring.annotation.MapperScan(basePackages = "com.hiynn.core.
    .mapper4",sqlSessionFactoryRef = "callSqlSessionFactory"),
    @org.mybatis.spring.annotation.MapperScan(basePackages = "com.hiynn.core.
    *.mapper5",sqlSessionFactoryRef = "countrySqlSessionFactory"),
    })
    @Import(FdfsClientConfig.class)
    public class Application extends SpringBootServletInitializer{
    public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
    }

    // 注册统一异常处理bean,用于shiro权限校验跳转
    @Bean
    public MyExceptionResolver myExceptionResolver() {
    return new MyExceptionResolver();
    }

}

你可能感兴趣的:(2019-08-27)