Moving from Spring Boot 2.0.0.M6 to 2.0.0.M7 - dependencies.dependency.version' for org.springframework.social:spring-social-security:jar is missing - spring

I'm trying to upgrade my application from Spring Boot 2.0.0.M6 to 2.0.0.M7
After upgrading my Maven application I ran into the following errors:
For example the following dependency
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-security</artifactId>
</dependency>
shows the following error:
Project build error: 'dependencies.dependency.version' for org.springframework.social:spring-social-security:jar is missing.
What am I doing wrong and how to fix it?

Dependency management and auto-configuration for Spring Social was removed from Spring Boot in 2.0 M7. The longer-term plan is for it to move into Spring Social itself but that has yet to happen.

Related

Upgrading To Spring Boot 2.4.0 Breaks Legacy Applications

I'm upgrading a set of legacy applications to Spring Boot 2.4.0, running on OpenJDK 8, deployed to Pivotal Cloud Foundry.
The app and all its unit tests ran perfectly under Spring 2.3.4-RELEASE before I started this upgrade.
There was work to be done right off the bat: Spring Boot 2.4.0 brings in JUnit 5.x, so I had to fix all the JUnit 4.x tests to use the new annotations and classes.
After fixing all the tests I tried to run in IntelliJ 2020.2. All the tests failed, for the same reason: java.lang.IllegalStateException: Failed to load ApplicationContext. The root of the stack trace gives this cause:
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata
They removed a fundamental class from Spring Boot for the sake of Kubernetes, from the sound of it. I'm not sure I see why.
I did a Google search and found this explanation and fix.
I added spring.config.use-legacy-processing to my application.yml and a test application.properties file:
spring:
config:
use-legacy-processing: true
Still no joy - all the tests fail.
I'm confused by other links I've seen. Is this an issue with spring-cloud-dependencies? I'm reading that there might an issue with the Hoxton version. Do I need to add it to my app? It never needed this dependency before the upgrade:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Hoxton.SR9</version>
<type>pom</type>
<scope>import</scope>
</dependency>
The problem is bigger than the tests. If I ignore them and try to run the app I still fail:
ERROR [main]: Application run failed |ApplicationName=Risk_Advisor | sourcedfrom=ERROR
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesBeans' defined in class path resource [org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [sun.misc.Launcher$AppClassLoader#18b4aac2]
The root cause is the same:
java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
when ever you do upgrades on spring, pls always look at the spring / cloud compatibility matrix and then upgrades the versions for both spring and cloud accordingly:
Also, pls note that you may not have added spring cloud as direct dependency but it may be coming into your final jar as a transitive dependency so its always better to add below spring cloud dependency as direct dependency management in your pom to stay away from any conflicts:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring.cloud-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
I got the same error when migrating to Spring Boot 2.4.4 which forced me to migrate to Spring Cloud 2020.0.1 as well. In my case, the error was due to Bootstrap, provided by spring-cloud-commons, not being any longer enabled by default. I had to re-enabled it by adding the following new starter in my build.gradle file as stated here:
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap'
You say your app doesn't use Spring Cloud, so I'm not sure why you ended up facing which seems to be the same issue. Hopefully this workaround might work for you and help out others using Spring Cloud.
To fix the failing JUnit 4 tests, I have just added it as a dependency:
testImplementation 'junit:junit:4.13'
I had the same error for JUnit 4 tests after migration my project to Spring Boot 2.5.6. Adding JUnit 4 dependencies did not fix this error as well as migration JUnit 4 tests to JUnit 5. My project does not define Spring Cloud dependencies in build.gradle so in order to find where those dependencies come from I simply ran gradle command:
gradle dependencyInsight --dependency org.springframework.cloud
and saw that spring cloud dependencies were pulled within one of the custom libraries. Upgrade spring cloud dependencies to a compatible version there and reimport custom library fixed the error.

QueryDslPredicateExecutor working with spring boot version 1.4.2.RELEASE but not working with spring boot version 2.2.6.RELEASE

When I try to migrate my Spring Boot application from version 1.4.2.RELEASE to version 2.2.6.RELEASE I found that org.springframework.data.querydsl.QueryDslPredicateExecutor not found
Cannot resolve symbol QueryDslPredicateExecutor
i should add spring-data-commons version 1.12.8.RELEASE
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>1.12.8.RELEASE</version>
</dependency>
and then i found another probleme
GitHub repo: https://github.com/dali05/SpringBootMultipleMavenModules
thnaks
Please note that the name of the class over time has been changed, in that one 'D' has changed from its uppercase to a lowercase 'd', ie: QueryDslPredicateExecutor is now QuerydslPredicateExecutor. Probably this caused some headache for you as it did for me too.
Refer to the class in your source code as QuerydslPredicateExecutor and your source code will build again.

Create a Spring Boot 1.5.8 Quartz scheduler app

I want to create a Spring Boot Quartz scheduler app. using Spring Boot 1.5.8 with Spring Tool Suite Version: 3.9.0.RELEASE using the option Spring Starter Project, but the Quartz scheduler option is disabled:
I also tried to added manually adding to the pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>
and then I got the error:
Project build error: 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-quartz:jar is
missing.
You have to create your spring-boot starter app with version >= 2.0.0.M2. At start.spring.io you can see for which version some dependencies are available.
After using the correct version, everything should work.

Weblogic 12.2.1 + Java 8 + Spring Data JPA + Hibernate 5.x Deployment conflict

I am trying to deploy an EAR file using WebLogic 12.2.1 with Hibernate 5.x and Spring-data-jpa 1.9.4. The same configuration deployed fine on Weblogic 12.1.3. JPA 2.1 is used on both of them.
Weblogic is throwing a ClassNotFoundException and looking for the QueryDsl library which is optional with spring-data:
weblogic.management.DeploymentException: java.lang.ClassNotFoundException: com.mysema.query.types.path.PathBuilder
The manifest for Spring-data even references this jar as optional. Since Oracle publishes none of their source I can't exactly debug the problem .. it seems to throw an error long before my ApplicationContext actually initializes any of the Spring wiring.
The same configuration deploys fine on Websphere 8.5.5. There seems to be some kind of deployment conflict with using Weblogic 12.2.1 but I can't spot any other meaningful differences. Is anyone experiencing something similar?
I managed to overcome this error by explicitly adding querydsl-core and querydsl-jpa to my poms.
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-core</artifactId>
</dependency>

What replaces FacesContextUtils in Spring 3?

We just upgraded from Spring 2.5 to Spring 3.0.7. The class:
org.springframework.web.jsf.FacesContextUtils
doesn't appear exist in 3.0.7. We are trying to call:
FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance()).getBeansOfType(type);
Is there a replacement in Spring 3?
This class also exists in Spring 3.0.7, maybe you missed a jar or downloaded a different release?
You can use the following maven dependency:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.web</artifactId>
<version>3.0.7.RELEASE</version>
</dependency>
You can also get the jar from the spring repo.
If this doesn't help you may update your question with the stacktrace of the error msg.

Resources