dromara / sureness

A efficient security framework focus on protection of API.

Home Page:https://usthe.com/sureness

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

找不到 sureness.yml 文件的位置

baodingfengyun opened this issue · comments

Describe the bug
2020-12-29 15:40:37,223 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile dev): com.usthe.sureness.matcher.SurenessLoadDataException: sureness file: sureness.yml not found, please create
the file if you need config resource

Used Version
sureness 0.4
quarkus 1.10.5.Final

To Reproduce
Steps to reproduce the behavior:
mvnw quarkus:dev

Expected behavior
如果采用 mvnw package的方式打包,java -jar xxx.jar 运行可以正常。期望 mvnw quarkus:dev 开发方式也正常

@baodingfengyun 好的 这几天解决下,如果你有好的解决非常欢迎pr奥 😉

@tomsun28
Bot detected the issue body's language is not English, translate it automatically. For the convenience of others, please use English next time👯.


@baodingfengyun Okay, we will solve it these days, if you have a good solution, you are very welcome to prao 😉

增加一个QuarkusMain注解的启动类,就不会报错了。猜测是mvnw命令启动的原因,具体的没有解决。

@baodingfengyun
Bot detected the issue body's language is not English, translate it automatically. For the convenience of others, please use English next time👯.


Adding a startup class annotated by QuarkusMain will not report an error. It is guessed that the mvnw command is started, but the specific problem is not solved.

我在 https://github.com/tomsun28/sureness/tree/master/samples/quarkus-sureness 这个样例项目里 mvn quarkus:dev 可以运行测试ok,你参照下这个demo呢 是不是在resources没有配置sureness.yml 如果不是能分享下代码看下就更好了

@tomsun28
Bot detected the issue body's language is not English, translate it automatically. For the convenience of others, please use English next time👯.


I am in https://github.com/tomsun28/sureness/tree/master/samples/quarkus-sureness in this sample project, mvn quarkus:dev can run the test ok, you can refer to this demo, is there no sureness configured in the resources .yml It would be better if you could not share the code and see

@baodingfengyun hi 感谢提供的demo,问题是由于最新版本的quarkus加载三方class与工程代码的classLoader不一样,使用加载三方class的classLoader去getResource类路径下的文件会找不到,解决就是使用当前线程类加载器Thread.currentThread().getContextClassLoader()去查找,具体修改见 #46

使用sureness 0.4.1版本来解决此问题

<dependency>
    <groupId>com.usthe.sureness</groupId>
    <artifactId>sureness-core</artifactId>
    <version>0.4.1</version>
</dependency>

感谢假期抽出时间来修复。

@baodingfengyun
Bot detected the issue body's language is not English, translate it automatically. For the convenience of others, please use English next time👯.


Thanks for taking the time to fix it during the holidays.