提交 | 用户 | 时间
|
e7c126
|
1 |
/* |
H |
2 |
* Copyright 1999-2018 Alibaba Group Holding Ltd. |
|
3 |
* |
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
* you may not use this file except in compliance with the License. |
|
6 |
* You may obtain a copy of the License at |
|
7 |
* |
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
* |
|
10 |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
* See the License for the specific language governing permissions and |
|
14 |
* limitations under the License. |
|
15 |
*/ |
|
16 |
|
|
17 |
package com.alibaba.nacos; |
|
18 |
|
|
19 |
import com.alibaba.nacos.sys.filter.NacosTypeExcludeFilter; |
|
20 |
import org.springframework.boot.SpringApplication; |
|
21 |
import org.springframework.boot.autoconfigure.AutoConfigurationExcludeFilter; |
|
22 |
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|
23 |
import org.springframework.boot.context.TypeExcludeFilter; |
|
24 |
import org.springframework.boot.web.servlet.ServletComponentScan; |
|
25 |
import org.springframework.context.annotation.ComponentScan; |
|
26 |
import org.springframework.context.annotation.ComponentScan.Filter; |
|
27 |
import org.springframework.context.annotation.FilterType; |
|
28 |
import org.springframework.scheduling.annotation.EnableScheduling; |
|
29 |
|
|
30 |
/** |
|
31 |
* Nacos starter. |
|
32 |
* <p> |
|
33 |
* Use @SpringBootApplication and @ComponentScan at the same time, using CUSTOM type filter to control module enabled. |
|
34 |
* </p> |
|
35 |
* |
|
36 |
* @author nacos |
|
37 |
*/ |
|
38 |
@SpringBootApplication |
|
39 |
@ComponentScan(basePackages = "com.alibaba.nacos", excludeFilters = { |
|
40 |
@Filter(type = FilterType.CUSTOM, classes = {NacosTypeExcludeFilter.class}), |
|
41 |
@Filter(type = FilterType.CUSTOM, classes = {TypeExcludeFilter.class}), |
|
42 |
@Filter(type = FilterType.CUSTOM, classes = {AutoConfigurationExcludeFilter.class})}) |
|
43 |
@ServletComponentScan |
|
44 |
@EnableScheduling |
|
45 |
public class IailabNacosApplication { |
|
46 |
|
|
47 |
public static void main(String[] args) { |
|
48 |
// true 单机模式 false 为集群模式 集群模式需搭配 cluster.conf 使用 使用方法请查看文档 |
|
49 |
System.setProperty("nacos.standalone", "true"); |
|
50 |
System.setProperty("server.tomcat.accesslog.enabled", "false"); |
|
51 |
// 本地集群搭建使用 分别在所有 nacos 目录下创建 conf/cluster.conf 文件用于编写集群ip端口 |
|
52 |
// 注意 如果本地启动多个 nacos 此目录不能相同 例如 nacos1 nacos2 nacos3 对应三个nacos服务 |
|
53 |
// System.setProperty("nacos.home", "D:/nacos"); |
|
54 |
SpringApplication.run(IailabNacosApplication.class, args); |
|
55 |
} |
|
56 |
} |
|
57 |
|