Spring boot not search components in package when up with proguard


Maybe someone can help me understand what’s going on.
I have a project on spring boot 3, maven.
After obfuscate I launch the application.
And when raising, Components and Services within this service are not created. Beans are created from other connected dependencies, as well as from the main file with SpringBootApplication annotation.

For example, service package com.ex.app service:
com.ex.app.AppApplication with @SpringBootApplication annotation
com.ex.app.config.AppConfig with @Component annotation

I connect my dependencies in the pom, for example com.ex.app.lib.AppLib with the @Component annotation.

When the application is launched, Spring scans only the AppApplication file and com.ex.app.lib… and other Spring libraries.

But it does not scan the package from the com.ex.app.config service itself.

What can be wrong?

My proguard config :



-optimizations !class/marking/final,!method/inlining/short,!method/inlining/unique


# move all classes eligible for renaming to this package
# this also ensures that their names are unique so that their corresponding Spring beans don't mix up
-repackageclasses com.ex.app.all

-adaptresourcefilenames **.properties
-adaptresourcefilecontents **.properties,META-INF/MANIFEST.MF,META-INF/spring.factories

-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,Synthetic,EnclosingMethod,Bean,RequestMapping,Controller,ExceptionHandler


# don't touch enum values (in case they are mapped onto database or request/response/diff fields)
-keepclassmembers enum * { *; }
-keep class * implements java.io.Serializable { *; }

# don't touch aspects
-keepclassmembers @org.aspectj.lang.annotation.Aspect class *  { *; }
-keepclassmembers class * {
    @org.aspectj.** *** *(...) ;
    @org.springframework.context.annotation.Bean *** *(...) ;

# don't touch configuration properties mapped onto application.yaml files
-keepclassmembers @org.springframework.context.annotation.Configuration class * { *; }
-keepclassmembers @org.springframework.boot.context.properties.ConfigurationProperties class * { *; }

# also keep names for nested properties defined in inner classes
-if @org.springframework.boot.context.properties.ConfigurationProperties class **.* { *; }
-keepclassmembers class <1>.<2>$* { *; }

# keep metadata for Criteria Query
-keep @jakarta.persistence.metamodel.StaticMetamodel class **.* { *; }

# keep Main classes
-keep @org.springframework.boot.autoconfigure.SpringBootApplication class * { *; }

# keep entity and repository members mapped onto the database
-keep @jakarta.persistence.Entity class * { *; }
-keep @jakarta.persistence.MappedSuperClass class * { *; }
-keep @org.springframework.data.redis.core.RedisHash class * { *; }
-keep class * extends org.springframework.data.jpa.repository.JpaRepository { *; }

Pom config:




It turns out the problem was with the jib plugin, not with proguard. Сan close the issue.