forked from wuyouzhuguli/SpringAll
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0666cc
commit 727f860
Showing
357 changed files
with
34,532 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.alibaba</groupId> | ||
<artifactId>dubbo-admin</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>dubbo-admin</name> | ||
<description>Demo project for Spring Boot</description> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.0.2.RELEASE</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<java.version>1.8</java.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.alibaba.boot</groupId> | ||
<artifactId>velocity-spring-boot-starter</artifactId> | ||
<version>0.1.0</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<version>3.7</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.alibaba</groupId> | ||
<artifactId>dubbo</artifactId> | ||
<version>2.6.2</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.curator</groupId> | ||
<artifactId>curator-framework</artifactId> | ||
<version>2.12.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.alibaba</groupId> | ||
<artifactId>fastjson</artifactId> | ||
<version>1.2.46</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
|
||
</project> |
33 changes: 33 additions & 0 deletions
33
...o-OPS-Mointor/dubbo-admin/src/main/java/com/alibaba/dubboadmin/DubboAdminApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.alibaba.dubboadmin; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.context.ApplicationContext; | ||
|
||
@SpringBootApplication | ||
public class DubboAdminApplication { | ||
|
||
public static void main(String[] args) { | ||
ApplicationContext act = SpringApplication.run(DubboAdminApplication.class, args); | ||
SpringUtil.setApplicationContext(act); | ||
|
||
|
||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
52.Dubbo-OPS-Mointor/dubbo-admin/src/main/java/com/alibaba/dubboadmin/SpringUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.alibaba.dubboadmin; | ||
|
||
|
||
import com.alibaba.dubbo.common.logger.Logger; | ||
import com.alibaba.dubbo.common.logger.LoggerFactory; | ||
|
||
import org.springframework.context.ApplicationContext; | ||
|
||
public class SpringUtil { | ||
|
||
public static final Logger logger = LoggerFactory.getLogger(SpringUtil.class); | ||
private static ApplicationContext applicationContext = null; | ||
|
||
public static void setApplicationContext(ApplicationContext applicationContext){ | ||
if(SpringUtil.applicationContext == null){ | ||
logger.info("set applicationcontext"); | ||
SpringUtil.applicationContext = applicationContext; | ||
} | ||
|
||
} | ||
|
||
//获取applicationContext | ||
public static ApplicationContext getApplicationContext() { | ||
return applicationContext; | ||
} | ||
|
||
//通过name获取 Bean. | ||
public static Object getBean(String name){ | ||
return getApplicationContext().getBean(name); | ||
|
||
} | ||
|
||
//通过class获取Bean. | ||
public static <T> T getBean(Class<T> clazz){ | ||
return getApplicationContext().getBean(clazz); | ||
} | ||
|
||
//通过name,以及Clazz返回指定的Bean | ||
public static <T> T getBean(String name,Class<T> clazz){ | ||
return getApplicationContext().getBean(name, clazz); | ||
} | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
52.Dubbo-OPS-Mointor/dubbo-admin/src/main/java/com/alibaba/dubboadmin/config/I18nConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.alibaba.dubboadmin.config; | ||
|
||
import java.util.Locale; | ||
|
||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.servlet.LocaleResolver; | ||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; | ||
import org.springframework.web.servlet.i18n.SessionLocaleResolver; | ||
|
||
|
||
@Configuration | ||
@EnableAutoConfiguration | ||
@ComponentScan | ||
//@ImportResource({"classpath*:dubbo-admin.xml"}) | ||
public class I18nConfig implements WebMvcConfigurer { | ||
|
||
@Bean | ||
public LocaleResolver localeResolver() { | ||
SessionLocaleResolver sessionLocaleResolver = new SessionLocaleResolver(); | ||
sessionLocaleResolver.setDefaultLocale(Locale.CHINA); | ||
return sessionLocaleResolver; | ||
|
||
} | ||
|
||
@Bean | ||
public LocaleChangeInterceptor localeChangeInterceptor() { | ||
LocaleChangeInterceptor lci = new LocaleChangeInterceptor(); | ||
lci.setParamName("lang"); | ||
return lci; | ||
} | ||
|
||
@Override | ||
public void addInterceptors(InterceptorRegistry registry) { | ||
registry.addInterceptor(localeChangeInterceptor()); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...OPS-Mointor/dubbo-admin/src/main/java/com/alibaba/dubboadmin/config/XmlConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.alibaba.dubboadmin.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.ImportResource; | ||
|
||
|
||
@Configuration | ||
@ImportResource({"classpath*:dubbo-admin.xml"}) | ||
public class XmlConfiguration { | ||
|
||
} |
Oops, something went wrong.