Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CamundaProcessAutodeployment PostConstruct ERROR #18

Closed
houkunlin opened this issue Jun 7, 2022 · 9 comments
Closed

CamundaProcessAutodeployment PostConstruct ERROR #18

houkunlin opened this issue Jun 7, 2022 · 9 comments
Assignees

Comments

@houkunlin
Copy link

When there is an feign-form-spring-3.8.0 dependent library, resourcesToDeploy will scan feign-form-spring-3.8.0.jar!/META-INF/maven/io.github.openfeign.form/, then camundaResource.getFile() will error

@houkunlin
Copy link
Author

image
image

@berndruecker
Copy link
Collaborator

You are right - thanks for reporting this! Linking the code in question:

https://github.com/camunda-community-hub/camunda-platform-7-rest-client-java/blob/main/camunda-engine-rest-client-openapi-springboot/src/main/java/org/camunda/community/rest/client/springboot/CamundaProcessAutodeployment.java#L33-L34

I wonder how we can easily prevent this. Spontaneous ideas:

  • Don't just auto-deploy but really provide an annotation to specify the resource pattern so that you can fix that in your applicxation
  • Adjust the pattern to avoid picking up random forms (but what pattern to do?)

Any feedback @houkunlin?

@houkunlin
Copy link
Author

我的一个想法,自定义个一个属性对象,让SpringBoot从配置文件读取配置的资源信息。

经过简单测试好像发现存在一个问题,在 IDEA开发工具中直接运行项目时camundaResource.getFile() 正常,但是打包成jar后无法获取到文件内容


One of my ideas is to customize a property object and let SpringBoot read the configured resource information from the configuration file.

After a simple test, it seems that there is a problem. When running the project directly in the IDEA development tool, camundaResource.getFile() is normal, but the file content cannot be obtained after packaging it into a jar.

https://github.com/camunda-community-hub/camunda-platform-7-rest-client-java/blob/main/camunda-engine-rest-client-openapi-springboot/src/main/java/org/camunda/community/rest/client/springboot/CamundaProcessAutodeployment.java#L54

@berndruecker
Copy link
Collaborator

This brings me to one idea that should be easy to do: allow to externalize the resource patterns like this:

    @Value("${camunda.autoDeploy.formResources:'classpath*:**/*.form'")
    private Resource[] formResources;

WDYT @houkunlin? This way, Spring still discovers a proper resource and getFile should work in any setting.

@houkunlin
Copy link
Author

这样是没问题的,不过我有一个担心是IDEA SpringBoot在修改配置文件的时候是否能够出现提示建议信息


This is no problem, but one of my concerns is whether IDEA SpringBoot can prompt and suggest information when modifying the configuration file

image

@berndruecker
Copy link
Collaborator

I added a change accordingly: bc2ec1e - that should allow you to solve your problem - right?

Honestly: I have no idea how IntelliJ builds up that list - might be simply scanning existing config files for what it finds? But I would not consider this a show stopper anyway

@berndruecker berndruecker self-assigned this Jun 21, 2022
@houkunlin
Copy link
Author

houkunlin commented Jun 22, 2022

如果有文档提示应该没问题。IDEA的那个配置文件提示内容实际是由SpringBoot的一个提示规则提供的,如果使用一个类来定义配置属性信息(在类上加 @ConfigurationProperties() 注解),在编译成 starter 时会自动给这个类生成提示内容然后参与打包。


It should be fine if there are documentation hints. The configuration file prompt content of IDEA is actually provided by a prompt rule of SpringBoot. If you use a class to define configuration property information (add @ConfigurationProperties() annotation to the class), it will be automatically generated for this class when compiling into a starter Prompt the content and then participate in the packaging.

@Data
@Configuration
@ConfigurationProperties("camunda.deploy")
public class MyProperties {
    /**
     * enable auto deploy
     */
    private boolean enable = false;
}

@berndruecker
Copy link
Collaborator

Great hint - would make sense to introduce a properties class for this then - right?
Maybe you are eager to create a PR for this?

@berndruecker
Copy link
Collaborator

Closing this for inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants