zoukankan      html  css  js  c++  java
  • 01.springboot入门--启用自动配置注解EnableAutoConfiguration

    springboot入门

     <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.5.6.RELEASE</version>
        </parent>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
        </dependencies>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    

    启用自动配置注解

    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
    import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RestController;
    
    @EnableAutoConfiguration(exclude = {RedisAutoConfiguration.class}) //启动自动配置,排除RedisAutoConfiguration
    @RestController
    public class IndexController {
        @RequestMapping("/")
        public String first(){
            return "hello";
        }
    
        public static void main(String[] args){
            SpringApplication.run(IndexController.class,args);
        }
    }
    
  • 相关阅读:
    事件记录
    C++和extern C
    中断控制器
    NAND FLASH控制器
    MMU实验
    存储管理器实验
    GPIO实验
    linux与Windows使用编译区别及makefile文件编写
    ubuntu如何为获得root权限
    VI常用命令及linux下软件
  • 原文地址:https://www.cnblogs.com/fly-book/p/11563005.html
Copyright © 2011-2022 走看看