提交 8de491ed 编写于 作者: X xiongchun

新增范例:创建一个基于盘古框架的空应用

上级 0c193e10
......@@ -14,4 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
spring.application.name=pangu-showcases-empty-springboot-based
\ No newline at end of file
spring.application.name=pangu-showcases-empty-springboot-based
logging.level.root=INFO
\ No newline at end of file
/target/
/bin/
!.mvn/wrapper/maven-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/build/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
#### :mushroom: 本范例演示功能
1.创建一个基于盘古框架的空应用
#### :four_leaf_clover: 如何创建&启动一个盘古应用
- **第一步:安装pom依赖**
``` xml
<parent>
<groupId>com.gitee.pulanos.pangu</groupId>
<artifactId>pangu-framework-parent</artifactId>
<version>latest.version.xxx</version>
<relativePath/>
</parent>
```
```xml
<dependency>
<groupId>com.gitee.pulanos.pangu</groupId>
<artifactId>pangu-framework-spring-boot-starter</artifactId>
</dependency>
```
- **第二步:启动类**
采用SpringBoot标准启动方式启动。
``` java
@SpringBootApplication
public class EmptyPanguApplication {
public static void main(String[] args) {
PanGuApplicationBuilder.init(EmptyPanguApplication.class).run(args);
}
@Component
public class EmptyService{
@PostConstruct
public void print(){
log.info("这是一个基于盘古开发框架的空应用...");
}
}
}
```
<?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>
<parent>
<groupId>com.gitee.pulanos.pangu</groupId>
<artifactId>pangu-framework-parent</artifactId>
<version>5.0.7</version>
<relativePath/>
</parent>
<groupId>com.gitee.pulanos.pangu</groupId>
<artifactId>pangu-examples-empty</artifactId>
<packaging>jar</packaging>
<version>1.0.0</version>
<dependencies>
<dependency>
<groupId>com.gitee.pulanos.pangu</groupId>
<artifactId>pangu-framework-spring-boot-starter</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
/*
* 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.gitee.pulanos.pangu.showcases.empty;
import com.gitee.pulanos.pangu.framework.PanGuApplicationBuilder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
/**
* @author xiongchun
*/
@Slf4j
@SpringBootApplication
public class EmptyPanguApplication {
public static void main(String[] args) {
PanGuApplicationBuilder.init(EmptyPanguApplication.class).run(args);
}
@Component
public class EmptyService{
@PostConstruct
public void print(){
log.info("这是一个基于盘古开发框架的空应用...");
}
}
}
#
# 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.
#
spring.application.name=pangu-examples-empty
logging.level.root=INFO
logging.level.com.gitee.pulanos.pangu=INFO
\ No newline at end of file
#
# 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.
#
spring.profiles.active=${spring.profiles.active:dev}
\ No newline at end of file
......@@ -12,6 +12,7 @@
<modules>
<module>pangu-examples-empty-springboot-based</module>
<module>pangu-examples-empty</module>
<module>pangu-examples-config-remote-nacos</module>
<module>pangu-examples-webapi</module>
<module>pangu-examples-crud</module>
......
......@@ -75,7 +75,7 @@ public final class Constants {
/**
* 应用启动成功
*/
public final static String APP_START_SUCCESS = "(ô‿ô) PanGu Dev Framework Started successfully ㊥ 盘古开发框架启动成功\\0";
public final static String APP_START_SUCCESS = "(ô‿ô) PanGu Dev Framework Started successfully ㊥ 盘古开发框架启动成功";
/**
* 应用退出
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册