[Java - Spring Boot] Spring Boot FAQs

Spring Boot FAQs

Cannot instantiate interface org.springframework.context.ApplicationListener : org.springframework.nativex.NativeListener

This is a symptom of a version mismatch in your Spring dependencies. Check and make the same version.

Maven Repository: org.springframework.boot » spring-boot-dependencies - https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies

module jdk.compiler does not “opens com.sun.tools.javac.processing” to unnamed module

1
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private com.sun.tools.javac.processing.JavacProcessingEnvironment$DiscoveredProcessors com.sun.tools.javac.processing.JavacProcessingEnvironment.discoveredProcs accessible: module jdk.compiler does not "opens com.sun.tools.javac.processing" to unnamed module @5da6b062

Make lombok version to match Spring Boot version.

1
2
3
4
5
6
7
8
9
10
11
// build.gradle

ext {
lombokVersion = '1.18.22'
}

dependencies {
compileOnly "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
implementation("org.projectlombok:lombok:${lombokVersion}")
}

error: package org.junit.jupiter.api does not exist import org.junit.jupiter.api.Test;

Add org.junit.jupiter:junit-jupiter-api to fix that issue.

1
2
3
4
dependencies {

+ implementation 'org.junit.jupiter:junit-jupiter-api:5.5.1'
}

javax.management.InstanceNotFoundException: org.springframework.boot:type=Admin,name=SpringApplication

Unchecking Enable JMX Agent on Edit Configuration window helped me getting rid of the error on IntelliJ.

This is normal and nothing to be worried about.

You can see this exception when the log level is in TRACE Or DEGUG. There is always some time lag between RMI TCP server start and spring boot tomcat start up . RMI TCP will start first and it will try to find SpringApplication Insatance which is started latter. till that time RMI TCP server will poll to find this SpringApplication instance .Once it finds SpringApplication instance this error is gone and Auto Configuration of spring boot starts .

See spring - javax.management.InstanceNotFoundException: org.springframework.boot:type=Admin,name=SpringApplication - Stack Overflow - https://stackoverflow.com/questions/50436108/javax-management-instancenotfoundexception-org-springframework-boottype-admin to learn more.

Disable CONDITIONS EVALUATION REPORT

1
2
3
4
5
6
7
8
9
10
11
12
13
14
2022-01-15 05:59:28.088 DEBUG 1 --- [           main] ConditionEvaluationReportLoggingListener :


============================
CONDITIONS EVALUATION REPORT
============================


Positive matches:
-----------------

AopAutoConfiguration matched:
- @ConditionalOnProperty (spring.aop.auto=true) matched (OnPropertyCondition)
...

Set logging.level.org.springframework.boot.autoconfigure to error to disable the ConditionEvaluationReportLogging.

1
2
3
4
5
# application.properties

logging.level.root=debug

+ logging.level.org.springframework.boot.autoconfigure=error

References

[1] Spring Boot - https://spring.io/projects/spring-boot

[2] Spring | Spring Quickstart Guide - https://spring.io/quickstart