0

我正在使用 mvn 和 appengine-maven-plugin 为 java 8 暂存和部署我的应用引擎标准项目。这在本地工作,但部署的项目停止工作,如果我查看 target/appengine-staging/app.yaml 有那里有一些神秘的非工作路线,标准的 /.* 路线已经消失了。

我在哪里可以找到有关生成 app.yaml 的内容以及构建这些处理程序所引用的内容的一些信息?它们看起来与某些真实路线相似,但并不完全匹配。

mvn appengine:stage -DskipTests -Dspring.profiles.active=development
# ./target/appengine-staging/app.yaml contains bad handlers

我的 apppengine-web.xml

<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
  <threadsafe>true</threadsafe>
  <sessions-enabled>true</sessions-enabled>
  <runtime>java8</runtime>
  <instance-class>B1</instance-class>
  <basic-scaling>
    <max-instances>1</max-instances>
    <idle-timeout>10m</idle-timeout>
  </basic-scaling>
  <env-variables>
    <env-var name="SPRING_PROFILES_ACTIVE" value="development" />
  </env-variables>
</appengine-web-app>

我的 web.xml

<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>tasks</web-resource-name>
            <url-pattern>/**/delete_handler</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>admin</role-name>
        </auth-constraint>
    </security-constraint>
</web-app>

WebSecurityConfigurerAdapter

@Configuration
@EnableWebSecurity
public class ApplicationSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    public void configure(WebSecurity web) throws Exception {
        web
          .ignoring()
            .antMatchers("/**/health")
            .antMatchers("/**/delete_handler")
            ;
      }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable()
        .authorizeRequests()
            .antMatchers("/**/health").permitAll()
            .antMatchers("/**/delete_handler").permitAll()
            .antMatchers("/_ah/*").permitAll()
            .anyRequest().authenticated()
            .and().httpBasic();
    }

    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
         // snip
    }

}

生成的非工作 app.yaml

runtime: java8
instance_class: B1
basic_scaling:
  max_instances: 1
  idle_timeout: 10m
inbound_services:
- warmup
derived_file_type:
- java_precompiled
threadsafe: True
auto_id_policy: default
env_variables:
  'SPRING_PROFILES_ACTIVE': 'development'
api_version: '1.0'
handlers:
- url: /
  script: unused
  login: optional
  secure: optional
- url: /_ah/.*.*.*/delete_handler
  script: unused
  login: admin
  secure: optional
- url: /.*/
  script: unused
  login: optional
  secure: optional
- url: /_ah/.*
  script: unused
  login: optional
  secure: optional

skip_files: app.yaml
4

0 回答 0