zoukankan      html  css  js  c++  java
  • WebSecurityConfig不起作用的解决

    Springboot security 的使用,三步:

    1、pom中增加:

    <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-security</artifactId>
            </dependency>
    

      

    2、增加config类:

    @Configuration
    @EnableWebSecurity
    @EnableGlobalMethodSecurity(prePostEnabled = true)
    public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    

      

    3、在main函数上增加解析包名:(重点,少了这一个com.bcd.mycallback,造成WebSecurityConfig不起作用的解决)

    @EnableScheduling
    @EnableTransactionManagement
    @SpringBootApplication
    @EnableOpenApi
    @EnableDiscoveryClient
    @EnableAsync
    @ComponentScan(basePackages = {
            "com.moxi.mogublog.commons.config",
            "com.moxi.mogublog.commons.fallback",
            "com.moxi.mogublog.xo.utils",
            "com.moxi.mogublog.utils",
            "com.bcd.mycallback",
            "com.moxi.mogublog.xo.service"})
    public class MyCallbackApplication {
    
        public static void main(String[] args) {
            TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
            SpringApplication.run(MyCallbackApplication.class, args);
        }
    
        /**
         * 设置时区
         */
        @PostConstruct
        void setDefaultTimezone() {
            TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
        }
    }
    

      

  • 相关阅读:
    Python常见问题
    经典SQL语句大全(转)
    VMware ESX常用命令
    每天一个linux命令(目录)
    Linux 技巧:让进程在后台可靠运行的几种方法(转)
    软件测试随手记(转)
    linux下查看磁盘空间
    MQ5.3在redhat9上的安装
    我的MQ笔记
    RedHat Linux下MQ安装步骤及MQ常用命令
  • 原文地址:https://www.cnblogs.com/hoge66/p/15813903.html
Copyright © 2011-2022 走看看