Open LiHanGod opened 1 year ago
我加了@ForestScan
import com.dtflys.forest.springboot.annotation.ForestScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ForestScan
@SpringBootApplication
public class SpringBootStuApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootStuApplication.class);
}
}
D:\Software\Java\jdk-17.0.6\bin\java.exe -XX:TieredStopAtLevel=1 -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-Dmanagement.endpoints.jmx.exposure.include=*" -javaagent:D:\Software\ideaIU-2023.2.2.win\lib\idea_rt.jar=11152:D:\Software\ideaIU-2023.2.2.win\bin -Dfile.encoding=UTF-8 -classpath D:\WorkSpeace\IDEA-Workspeace\SpringBoot-Stu\build\classes\java\main;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-web\3.1.3\d4326db157b4cf73647ae69b588de0dc65cb702\spring-boot-starter-web-3.1.3.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\com.dtflys.forest\forest-spring-boot-starter\1.5.33\6503c5722b3f74e9f0463ed6fb8502a22139ba42\forest-spring-boot-starter-1.5.33.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-json\3.1.3\853a7b3152846d685e38c34ad8e14f221228c846\spring-boot-starter-json-3.1.3.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter\3.1.3\c59f038f005cf8fb3338b7b9e50e9a65bac1ebca\spring-boot-starter-3.1.3.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-tomcat\3.1.3\af588c29407cd056296be081c281b3e196c4860a\spring-boot-starter-tomcat-3.1.3.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.springframework\spring-webmvc\6.0.11\892b4a63b5d930c2c43058c6db0c2c65401fb078\spring-webmvc-6.0.11.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.springframework\spring-web\6.0.11\c32a7bf6b88b83bac6aa63866fcf208892640446\spring-web-6.0.11.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\com.dtflys.forest\forest-core\1.5.33\6163f2a3776c7355dc6548a38ca2b090b2a34173\forest-core-1.5.33.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\com.dtflys.forest\forest-spring\1.5.33\7faacfffb5c287d00da2046b4299687e0128107e\forest-spring-1.5.33.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-configuration-processor\3.1.3\eb2d30fe86b3e7ebd4307b4a117e11962696195b\spring-boot-configuration-processor-3.1.3.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\com.google.protobuf\protobuf-java\3.16.1\23b80908eaf488134ceef1904e83e6f6821908c0\protobuf-java-3.16.1.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jsr310\2.15.2\30d16ec2aef6d8094c5e2dce1d95034ca8b6cb42\jackson-datatype-jsr310-2.15.2.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\com.fasterxml.jackson.module\jackson-module-parameter-names\2.15.2\75f8d2788db20f6c587c7a19e94fb6248c314241\jackson-module-parameter-names-2.15.2.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jdk8\2.15.2\66a50e089cfd2f93896b9b6f7a734cea7bcf2f31\jackson-datatype-jdk8-2.15.2.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.15.2\9353b021f10c307c00328f52090de2bdb4b6ff9c\jackson-databind-2.15.2.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-autoconfigure\3.1.3\d7d4e0cdf5a42158a5460feb67d0c56aba2ef8b2\spring-boot-autoconfigure-3.1.3.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.springframework.boot\spring-boot\3.1.3\7161dbfbbdde423513c89deae00da8068319a26a\spring-boot-3.1.3.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-logging\3.1.3\8a4402a80f01fb8193907b1ea6c9f4a71df6589e\spring-boot-starter-logging-3.1.3.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\jakarta.annotation\jakarta.annotation-api\2.1.1\48b9bda22b091b1f48b13af03fe36db3be6e1ae3\jakarta.annotation-api-2.1.1.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.springframework\spring-core\6.0.11\87834b5cf95c6fa28f5bdf8a85e0daf0bff918a8\spring-core-6.0.11.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.33\2cd0a87ff7df953f810c344bdf2fe3340b954c69\snakeyaml-1.33.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-websocket\10.1.12\c96beb8e6d5a6783d6e026909aa65c2aaa6d95da\tomcat-embed-websocket-10.1.12.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-core\10.1.12\55acd05b20308a39d08a6a02e8f8bc0c17b7b5f\tomcat-embed-core-10.1.12.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-el\10.1.12\2a8cfb1053b6f7c445d78186ac32c73eb773973c\tomcat-embed-el-10.1.12.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.springframework\spring-context\6.0.11\a7b10f3d3c1492bfc4e6d7c966cd2e21f4d441f5\spring-context-6.0.11.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.springframework\spring-aop\6.0.11\15b85c825558fadb85e3c77779d7225ce7e4a7bc\spring-aop-6.0.11.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.springframework\spring-beans\6.0.11\8513efc6e94b407b5cd85f69eeec511f1ef34164\spring-beans-6.0.11.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.springframework\spring-expression\6.0.11\1d0940120a275719c3988c592068f4acf807fe59\spring-expression-6.0.11.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\io.micrometer\micrometer-observation\1.11.3\aaea9efe8f00c184b12f729a2f37e18ca4f33b8d\micrometer-observation-1.11.3.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\com.googlecode.juniversalchardet\juniversalchardet\1.0.3\cd49678784c46aa8789c060538e0154013bb421b\juniversalchardet-1.0.3.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient-cache\4.5.13\4abee263cbc9edc12393212ca3a7c89af0755b1f\httpclient-cache-4.5.13.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.5.13\efc110bad4a0d45cda7858e6beee1d8a8313da5a\httpmime-4.5.13.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient\4.5.13\e5f6cae5ca7ecaac1ec2827a9e2d65ae2869cada\httpclient-4.5.13.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.4.16\51cf043c87253c9f58b539c9f7e44c8894223850\httpcore-4.4.16.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\com.squareup.okhttp3\okhttp\4.10.0\cd63657ac15770ed1420647154c9f44645533bef\okhttp-4.10.0.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\com.google.code.findbugs\jsr305\3.0.1\f7be08ec23c21485b9b5a1cf1654c2ec8c58168d\jsr305-3.0.1.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\commons-io\commons-io\2.7\3f2bd4ba11c4162733c13cc90ca7c7ea09967102\commons-io-2.7.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.slf4j\slf4j-api\2.0.7\41eb7184ea9d556f23e18b5cb99cad1f8581fc00\slf4j-api-2.0.7.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.15.2\4724a65ac8e8d156a24898d50fd5dbd3642870b8\jackson-annotations-2.15.2.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.15.2\a6fe1836469a69b3ff66037c324d75fc66ef137c\jackson-core-2.15.2.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.4.11\54450c0c783e896a1a6d88c043bd2f1daba1c382\logback-classic-1.4.11.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-to-slf4j\2.20.0\d37f81f8978e2672bc32c82712ab4b3f66624adc\log4j-to-slf4j-2.20.0.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.slf4j\jul-to-slf4j\2.0.7\a48f44aeaa8a5ddc347007298a28173ac1fbbd8b\jul-to-slf4j-2.0.7.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.springframework\spring-jcl\6.0.11\c9b16cdb6d4874ba4118fcdd4b0335f6278b378\spring-jcl-6.0.11.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\io.micrometer\micrometer-commons\1.11.3\3422d6b1e5ce99cc3ad9ae83dbc83409e2f07603\micrometer-commons-1.11.3.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\commons-logging\commons-logging\1.2\4bfc12adfe4842bf07b657f0369c4cb522955686\commons-logging-1.2.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\commons-codec\commons-codec\1.15\49d94806b6e3dc933dacbd8acb0fdbab8ebd1e5d\commons-codec-1.15.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib\1.8.22\636bf8b320e7627482771bbac9ed7246773c02bd\kotlin-stdlib-1.8.22.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.4.11\2f9f280219a9922a74200eaf7138c4c17fb87c0f\logback-core-1.4.11.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.20.0\1fe6082e660daf07c689a89c94dc0f49c26b44bb\log4j-api-2.20.0.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\com.squareup.okio\okio-jvm\3.0.0\ab5a73fa2ccb4a36b0b5c69fe10b16d0255bcf8\okio-jvm-3.0.0.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-common\1.8.22\1a8e3601703ae14bb58757ea6b2d8e8e5935a586\kotlin-stdlib-common-1.8.22.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.jetbrains\annotations\13.0\919f0dfe192fb4e063e7dacadee7f8bb9a2672a9\annotations-13.0.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-jdk8\1.8.22\b25c86d47d6b962b9cf0f8c3f320c8a10eea3dd1\kotlin-stdlib-jdk8-1.8.22.jar;D:\WorkSpeace\Gradle-Workspeace\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-jdk7\1.8.22\4dabb8248310d833bb6a8b516024a91fd3d275c\kotlin-stdlib-jdk7-1.8.22.jar com.indi.SpringBootStuApplication
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.1.3)
2023-09-21T14:08:25.534+08:00 INFO 2976 --- [ main] com.indi.SpringBootStuApplication : Starting SpringBootStuApplication using Java 17.0.6 with PID 2976 (D:\WorkSpeace\IDEA-Workspeace\SpringBoot-Stu\build\classes\java\main started by lihan in D:\WorkSpeace\IDEA-Workspeace\SpringBoot-Stu)
2023-09-21T14:08:25.536+08:00 INFO 2976 --- [ main] com.indi.SpringBootStuApplication : No active profile set, falling back to 1 default profile: "default"
2023-09-21T14:08:25.751+08:00 ERROR 2976 --- [ main] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: Unable to retrieve @EnableAutoConfiguration base packages
at org.springframework.boot.autoconfigure.AutoConfigurationPackages.get(AutoConfigurationPackages.java:78) ~[spring-boot-autoconfigure-3.1.3.jar:3.1.3]
at com.dtflys.forest.springboot.annotation.ForestScannerRegister.registerBeanDefinitions(ForestScannerRegister.java:64) ~[forest-spring-boot-starter-1.5.33.jar:1.5.33]
at org.springframework.context.annotation.ImportBeanDefinitionRegistrar.registerBeanDefinitions(ImportBeanDefinitionRegistrar.java:86) ~[spring-context-6.0.11.jar:6.0.11]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromRegistrars$1(ConfigurationClassBeanDefinitionReader.java:373) ~[spring-context-6.0.11.jar:6.0.11]
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721) ~[na:na]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:372) ~[spring-context-6.0.11.jar:6.0.11]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:148) ~[spring-context-6.0.11.jar:6.0.11]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:120) ~[spring-context-6.0.11.jar:6.0.11]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:427) ~[spring-context-6.0.11.jar:6.0.11]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:287) ~[spring-context-6.0.11.jar:6.0.11]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:344) ~[spring-context-6.0.11.jar:6.0.11]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:115) ~[spring-context-6.0.11.jar:6.0.11]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:771) ~[spring-context-6.0.11.jar:6.0.11]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:589) ~[spring-context-6.0.11.jar:6.0.11]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.1.3.jar:3.1.3]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-3.1.3.jar:3.1.3]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:436) ~[spring-boot-3.1.3.jar:3.1.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-3.1.3.jar:3.1.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-3.1.3.jar:3.1.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-3.1.3.jar:3.1.3]
at com.indi.SpringBootStuApplication.main(SpringBootStuApplication.java:14) ~[main/:na]
Process finished with exit code 1
这个是版本问题嘛
springboot3 和 springboot2 适配的 forest maven 坐标不同
请看 https://forest.dtflyx.com/pages/1.5.33/spring_boot3_install/
我按照官网的配置,找不到对应注入的Bean
启动类
HTTP接口
Service
版本配置
build.gradle.kts
运行结果