Tag Archives: Problem solution

[Solved] org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘xxx‘

1. Problem description

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Around

2. Anomaly analysis

org. springframework. beans. factory. BeanCreationException: Error creating bean with name ‘XXX’

This exception is: bean injection failure exception. If this exception occurs, the corresponding bean cannot be found! The reasons for bean injection failure include but are not limited to the following:

The corresponding bean is not annotated; There is an error adding annotation to the corresponding bean, for example, the @service of spring is incorrectly selected as Dubbo; Select the wrong automatic injection method, etc.

Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.annotation. Around

Missing aspect, Maven coordinate of AOP

   <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>4.3.12.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>4.3.12.RELEASE</version>
        </dependency>

After adding dependency, the problem is solved

Perfect solution Error:Execution failed for task ‘: APP:transformClassesWithDexForDebug ‘… Problem

believe that everyone in the Android development can not avoid to be integrated in the process of the third party after a project, integration, sometimes it will encounter this ash often hate transformClassesWithDexForDebug, detailed Log is as follows:


Error:Execution failed for task ':APP:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException

The main reason for this problem is that the introduction of Libary overlaps with some Libs in existing projects. Please check in detail and make sure that there is only one copy of lib in use, such as v4, v7, utdid.jar, etc.

if you use other android’s official support library see, http://developer.android.com/tools/support-library/features.html

if there is still a problem after the above situation check, you can try to use the following configuration to solve the problem

defaultConfig {
    ...
    minSdkVersion 14
    targetSdkVersion 21
    ...

    //Enabling multidex support.
    multiDexEnabled true
}
dependencies {
    compile ´com.android.support:multidex:1.0.1´
}


and then in the manifest we introduce this, if there is a custom AppApplication, let your own AppApplication inherit this class

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.multidex.myapplication">
    <application
        ...
        android:name="android.support.multidex.MultiDexApplication">
        ...
    </application>
</manifest>

may also be a JDK version 1.8 problem, which is not an accident, so suspect that Gradle has compatibility problems with JDK 1.8 and try to reduce the number of JDK dependencies to 1.7

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

can be run or there will be errors after the configuration is completed, so we can also add this sentence in app.bulid and re-run after that. The specific amount or 4g can be seen from the computer configuration modification (2g, 3g, 6g, 8g).

dexOptions {
    javaMaxHeapSize "4g"
}

the above is the Error: I met in the Execution failed for task ‘: APP: transformClassesWithDexForDebug’ all solutions, sharing out hope to help everyone.