zoukankan      html  css  js  c++  java
  • @SpringBootApplication注解

    一、安全机制屏蔽

    在使用 SpringBoot + Activiti 时,启动服务访问模块时,浏览器会弹出一个登录界面。

    这是因为Activiti 框架整合了SpringSecurity框架,如果我们不需要安全验证时可以禁用springsecurity。

      @SpringBootApplication(exclude={SecurityAutoConfiguration.class,ManagementWebSecurityAutoConfiguration.class},

    scanBasePackages={"com.boctech.rdop.devresource","com.boctech.rdop.devapi"})

    二、@SpringBootApplication

      @SpringBootApplication = (默认属性)@Configuration + @EnableAutoConfiguration + @ComponentScan。

      1.@Configuration:提到@Configuration就要提到他的搭档@Bean。使用这两个注解就可以创建一个简单的spring配置类,可以用来替代相应的xml配置文件。

      @Configuration的注解类标识这个类可以使用Spring IoC容器作为bean定义的来源。@Bean注解告诉Spring,一个带有@Bean的注解方法将返回一个对象,该对象应该被注册为在Spring应用程序上下文中的bean。

      2.@EnableAutoConfiguration:能够自动配置spring的上下文,试图猜测和配置你想要的bean类,通常会自动根据你的类路径和你的bean定义自动配置。

      把 spring-boot-autoconfigure.jar/META-INF/spring.factories中每一个xxxAutoConfiguration文件都加载到容器中

      3.@ComponentScan:会自动扫描指定包下的全部标有@Component的类,并注册成bean,当然包括@Component下的子注解@Service,@Repository,@Controller。

  • 相关阅读:
    redis redis-cli 操作指令
    Apache 配置默认编码
    Apache 查找httpd.conf文件
    Apache 错误日志
    dataTable 自定义排序
    bootstrap select2 参数详解
    获取元素滚动条高度
    TP5 操作DB is null is not null 条件
    TP5 自带分页类的传参
    jquery 获取 file 表单 上传的文件名
  • 原文地址:https://www.cnblogs.com/daichunchun/p/15009387.html
Copyright © 2011-2022 走看看