DevBootApplication.java.ftl 2.9 KB
Newer Older
ibizdev's avatar
ibizdev committed
1 2 3
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
zhouweidong's avatar
zhouweidong committed
4 5 6 7 8 9 10
<#assign bDynamicDS=false>
<#list sys.getAllPSDataEntities() as entity>
    <#if (entity.getStorageMode()==1 || entity.getStorageMode()==2) && entity.getDSLink()!='DEFAULT'>
        <#assign bDynamicDS=true>
        <#break>
    </#if>
</#list>
ibizdev's avatar
ibizdev committed
11 12 13 14 15 16
package ${pub.getPKGCodeName()};

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Configuration;
17
import org.springframework.context.annotation.Import;
ibizdev's avatar
ibizdev committed
18 19 20
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
sq3536's avatar
sq3536 committed
21 22
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
23
import org.springframework.context.annotation.ComponentScan;
zhouweidong's avatar
zhouweidong committed
24 25
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
sq3536's avatar
sq3536 committed
26
import java.util.List;
27
import ${pub.getPKGCodeName()}.util.web.SearchContextHandlerMethodArgumentResolver;
28
import org.springframework.beans.factory.annotation.Autowired;
ibizdev's avatar
ibizdev committed
29 30 31 32 33 34

@Slf4j
@EnableDiscoveryClient
@Configuration
@EnableTransactionManagement
@EnableFeignClients(basePackages = {"${pub.getPKGCodeName()}" })
35
@SpringBootApplication(exclude = {
36 37 38 39 40 41 42 43 44 45 46 47
        <#--<#assign bmogo=false>-->
        <#--<#if sys.getAllPSDataEntities()??>-->
        <#--<#list sys.getAllPSDataEntities() as de>-->
            <#--<#if de.getStorageMode()?? && de.getStorageMode()==2>-->
                <#--<#assign bmogo=true>-->
                <#--<#break >-->
            <#--</#if>-->
        <#--</#list>-->
        <#--</#if>-->
        <#--<#if bmogo==false>-->
            <#--org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration.class,-->
        <#--</#if>-->
zhouweidong's avatar
zhouweidong committed
48 49 50
        <#if bDynamicDS>
            com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure.class
        </#if>
51
})
52 53 54 55 56
@ComponentScan(basePackages = {"${pub.getPKGCodeName()}"}
//        ,excludeFilters={
//                @ComponentScan.Filter(type= org.springframework.context.annotation.FilterType.REGEX,pattern="${pub.getPKGCodeName()}.xxx.rest.xxx"),
//        }
)
57 58 59
@Import({
        org.springframework.cloud.openfeign.FeignClientsConfiguration.class
})
zhouweidong's avatar
zhouweidong committed
60 61
@EnableAsync
@EnableScheduling
sq3536's avatar
sq3536 committed
62
public class DevBootApplication extends WebMvcConfigurerAdapter{
ibizdev's avatar
ibizdev committed
63

64 65 66
    @Autowired
    SearchContextHandlerMethodArgumentResolver resolver;

ibizdev's avatar
ibizdev committed
67 68 69
    public static void main(String[] args) {
        SpringApplication.run(DevBootApplication.class,args);
    }
sq3536's avatar
sq3536 committed
70 71 72 73

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
        super.addArgumentResolvers(argumentResolvers);
74
        argumentResolvers.add(resolver);
sq3536's avatar
sq3536 committed
75
    }
ibizdev's avatar
ibizdev committed
76
}