首页 > 解决方案 > 升级到最新版本的 JHipster 时出现的问题

问题描述

在阅读了从 Full Stack Development with Jhipster 升级到最新版本的 JHipster 的章节后,我执行了升级,一切正常,但完成后,文件中的所有更改,如:src\main\java\es\mibar\web \config\SecurityConfiguration.java 不见了。

这包括我升级后需要的更改,所以问题是:

是否有任何标志可以保留我的文件并同时升级版本?因为经历每一次改变都是相当漫长的。

此处详述的内容https://www.jhipster.tech/upgrading-an-application/在这方面看起来没有帮助

@Override
public void configure(HttpSecurity http) throws Exception {
    // @formatter:off
    http
        .csrf()
        .csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
    .and()
        .addFilterBefore(corsFilter, CsrfFilter.class)
        .exceptionHandling()
            .authenticationEntryPoint(problemSupport)
            .accessDeniedHandler(problemSupport)
    .and()
        .rememberMe()
        .rememberMeServices(rememberMeServices)
        .rememberMeParameter("remember-me")
        .key(jHipsterProperties.getSecurity().getRememberMe().getKey())
    .and()
        .formLogin()
        .loginProcessingUrl("/api/authentication")
        .successHandler(ajaxAuthenticationSuccessHandler())
        .failureHandler(ajaxAuthenticationFailureHandler())
        .permitAll()
    .and()
        .logout()
        .logoutUrl("/api/logout")
        .logoutSuccessHandler(ajaxLogoutSuccessHandler())
        .permitAll()
    // .and()
    //     .headers()
    //     .contentSecurityPolicy("default-src 'self'; frame-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://storage.googleapis.com; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:")
    // .and()
    //     .referrerPolicy(ReferrerPolicyHeaderWriter.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN)
    // .and()
    //     .featurePolicy("geolocation 'none'; midi 'none'; sync-xhr 'none'; microphone 'none'; camera 'none'; magnetometer 'none'; gyroscope 'none'; speaker 'none'; fullscreen 'self'; payment 'none'")
    // .and()
    //     .frameOptions()
    //     .deny()
    .and()
        .authorizeRequests()
        .antMatchers("/api/authenticate").permitAll()
        .antMatchers("/api/register").permitAll()
        .antMatchers("/api/activate").permitAll()
        .antMatchers("/api/account/reset-password/init").permitAll()
        .antMatchers("/api/account/reset-password/finish").permitAll()
        .antMatchers("/api/feedbacks").permitAll()
        .antMatchers("/api/menudailyfollowers").permitAll()
        .antMatchers("/api/config-variables").permitAll()
        .antMatchers("/api/locals").permitAll()
        .antMatchers("/api/locations").permitAll()
        .antMatchers("/api/degustation-menus").permitAll()
        .antMatchers("/api/daily-menus").permitAll()
        .antMatchers("/api/courses").permitAll()
        .antMatchers("/api/tags").permitAll()
        .antMatchers("/api/payments").permitAll()
        .antMatchers("/api/photos").permitAll()
        .antMatchers("/api/spectacles").permitAll()
        .antMatchers("/api/comments").permitAll()
        .antMatchers("/api/feedbacks").permitAll()
        .antMatchers("/api/menudailyfollowers").permitAll()
        .antMatchers(HttpMethod.GET, "/api/locals/*/view").permitAll()
        .antMatchers(HttpMethod.GET, "/api/locals/*").permitAll()
        .antMatchers(HttpMethod.GET, "/api/locations/*/view").permitAll()
        .antMatchers(HttpMethod.GET, "/api/locations/*").permitAll()
        .antMatchers(HttpMethod.GET, "/api/degustation-menus/*/view").permitAll()
        .antMatchers(HttpMethod.GET, "/api/degustation-menus/*").permitAll()
        .antMatchers(HttpMethod.GET, "/api/daily-menus/*/view").permitAll()
        .antMatchers(HttpMethod.GET, "/api/daily-menus/*").permitAll()
        .antMatchers(HttpMethod.GET, "/api/courses/*/view").permitAll()
        .antMatchers(HttpMethod.GET, "/api/courses/*").permitAll()
        .antMatchers(HttpMethod.GET, "/api/tags/*").permitAll()
        .antMatchers(HttpMethod.GET, "/api/payments/*").permitAll()
        .antMatchers(HttpMethod.GET, "/api/photos/*/view").permitAll()
        .antMatchers(HttpMethod.GET, "/api/photos/*").permitAll()
        .antMatchers(HttpMethod.GET, "/api/spectacles/*/view").permitAll()
        .antMatchers(HttpMethod.GET, "/api/spectacles/*").permitAll()
        .antMatchers(HttpMethod.GET, "/api/comments/*/view").permitAll()
        .antMatchers(HttpMethod.GET, "/api/comments/*").permitAll()
        .antMatchers(HttpMethod.GET, "/feedbacks/new").permitAll()
        .antMatchers(HttpMethod.GET, "/menudailyfollowers/new").permitAll()
        .antMatchers("/api/**").authenticated()
        .antMatchers("/management/health").permitAll()
        .antMatchers("/management/info").permitAll()
        .antMatchers("/management/prometheus").permitAll()
        .antMatchers("/management/**").hasAuthority(AuthoritiesConstants.ADMIN);
    // @formatter:on
}

}

// 注释中的部分和所有添加的 .antMatchers("/api/locations").permitAll() 都消失了。

谢谢

标签: jhipster

解决方案


除了通过 git 控制更改的可能性之外,您可能还需要遵循以下提示:https ://stackoverflow.com/a/60258520/7773582


推荐阅读