• Spring Boot 之 Hello World 战记


    1. Maven创建SpringBoot项目

    2. application.properties

    spring.session.store-type=none // 解决默认的30+编译错误

    3. demoNative.iml (屏蔽Mongo依赖)

        <!--
        <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-mongodb:1.5.6.RELEASE" level="project" />
        <orderEntry type="library" name="Maven: org.mongodb:mongodb-driver:3.4.2" level="project" />
        <orderEntry type="library" name="Maven: org.mongodb:bson:3.4.2" level="project" />
        <orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.4.2" level="project" />
        <orderEntry type="library" name="Maven: org.springframework.data:spring-data-mongodb:1.10.6.RELEASE" level="project" />
        -->
    

    4. pom.xml (屏蔽Mongo依赖)

    		<!--
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-data-mongodb</artifactId>
    		</dependency>
    		-->

    5. DemoApplication.java

    @SpringBootApplication(exclude = {MongoAutoConfiguration.class, SecurityAutoConfiguration.class}) // 屏蔽默认Mongo设置(解决Socket链接错误) 屏蔽Tomcat用户认证(解决提示输入用户名密码)
    @RestController // 使之能够路由适配
    public class DemoApplication {
    
    	@RequestMapping("/") // 默认路由为"Hello World!"
    	public String hello(){
    		return "Hello World!";
    	}
    
    	public static void main(String[] args) {
    		SpringApplication.run(DemoApplication.class, args);
    	}
    }
    

      

    http://localhost:8080 默认显示 Hello World!

  • 相关阅读:
    React Native 架构演进
    React Native 架构一览
    React Native 在 Airbnb 的起起落落
    React Native简史
    图解云服务模型的演进
    伯克利研究员们眼中的Cloud Computing
    彻底理解 IaaS、PaaS、SaaS
    JS更随机的随机数
    JS自动化
    fingerprint2 计算浏览器指纹分析
  • 原文地址:https://www.cnblogs.com/itfantasy/p/7307742.html
Copyright © 2020-2023  润新知