springboot的环境搭建-创新互联

<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>springstart</groupId>

 <artifactId>com.zcp.springstart</artifactId>

 <version>1.0.0</version>

 <packaging>jar</packaging>

 <!-- 方式一 :依赖父工程 -->

 <!-- <parent>

  <groupId>org.springframework.boot</groupId>

  <artifactId>spring-boot-starter-parent</artifactId>

  <version>1.5.8.RELEASE</version>

 </parent> -->

 <properties>

  <project.bulid.sourceEncoding>UTF-8</project.bulid.sourceEncoding>

  <maven.compiler.source>1.7</maven.compiler.source>

  <maven.compiler.target>1.7</maven.compiler.target>

 </properties>

 <!-- 方式二: 配置这个依赖 -->

 <dependencyManagement>

  <dependencies>

   <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies -->

<dependency>

  <groupId>org.springframework.boot</groupId>

  <artifactId>spring-boot-dependencies</artifactId>

  <version>1.5.8.RELEASE</version>

  <type>pom</type>

  <scope>import</scope>

</dependency>

  </dependencies>

 </dependencyManagement>

 <dependencies>

  <dependency>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-starter</artifactId>

  </dependency>

</dependencies>

</project>

spring boot的启动入口的方式

package com.zcp.springstart;

import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;

import org.springframework.context.ConfigurableApplicationContext;

import org.springframework.context.annotation.Bean;

@SpringBootApplication

public class App {

@Bean

public Runnable createRunnable(){

return new Runnable() {

@Override

public void run() {

System.out.println(">>>>>>>>>>>>runn---------");

}

};

}

public static void main(String[] args) {

ConfigurableApplicationContext context = SpringApplication.run(App.class, args);

context.getBean(Runnable.class).run();

}

}

说明:springboot的启动入口类,默认为配置类,故可以在该类中注入bean。

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。

新闻名称:springboot的环境搭建-创新互联
转载来于:https://www.cdcxhl.com/article8/dcsdip.html

成都网站建设公司_创新互联,为您提供网站排名网站策划网站改版网站营销动态网站网站制作

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都定制网站网页设计