Skip to content

概述 ​

  • 下载了新的localserver,分配的nacos命名空间dev-wjm

  • 今天主要是把前端后端都跑起来了

  • 前端一直卡住跑不起来,解决:cmd运行gateway和system的时候,按enter,不然cmd程序就卡着不动了

  • 后端跑不起来是因为spring:profiles没改成dev

    java
    spring:
      application:
        name: service-order
      profiles:
        active: dev

    在 Spring Boot 应用程序启动时,Spring Boot 会首先加载 bootstrap.yaml 文件,无论 spring.profiles.active 的值是什么。然后,Spring Boot 会根据 spring.profiles.active 的值来确定要加载哪个环境的配置文件。例如,如果 spring.profiles.active 设置为 dev,则会加载 bootstrap-dev.yaml 文件中的配置。

问题记录 ​

  • springsecurity的.antMatchers("/admin/auth/login").anonymous()和.antMatchers("/admin/auth/login").permitAll()有什么区别:

    java
    @Configuration(proxyBeanMethods = false, value = "systemSecurityConfiguration")
    public class Securityconfiguration {
        @Value("${spring.profiles.active: dev}")
        String env;
    
        @Bean("systemAuthorizeRequestsCustomizer")
        public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() {
            return (registry) -> {
                if (env != "prod") {
    //Swagger接口文档
                    registry.antMatchers("/v3/api-docs/**").permitAll()
                            .antMatchers("/swagger-ui.html").permitAll();
                }
    //RPC服务的安全配置
                registry.antMatchers(ApiConstants.PREFIX + "/**").permitAll();
            };
        }
    }

    .anonymous()匿名访问,只允许未登录用户访问。已经登录的拒绝

    .permitAll()全部允许