Spring Boot - javax Import statements not working correctly
Please refer the docs. https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.3-Release-Notes
As of #19550, Web and WebFlux starters do not depend on the validation starter by default anymore. If your application is using validation features, for example you find that javax.validation.* imports are not being resolved, you’ll need to add the starter yourself.
For Maven builds, you can do that with the following:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> </dependency>
For Gradle, you will need to add something like this:
dependencies { ... implementation 'org.springframework.boot:spring-boot-starter-validation' }
Add spring-boot-starter-data-jpa
dependency
If you are using Maven
add to pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
If you are using Gradle
add in build.gradle
compile "org.springframework.boot:spring-boot-starter-data-jpa"
for other refer this.
Perhaps this will help someone: apparently Java persistence api is renamed to Jakarta persistence. So you will have to import Jakarta persistence instead of javax.persistence.