Getting a strange duplicate bean name error Since upgraded to Jmix 1.3

I upgraded to Jmix 1.3
Now whenever I edit my existing services, I get an error looking like:

The bean 'pnl_HoldService' could not be registered. A bean with that name has already been defined in file ...

For the error to go away, I have to remove NAME constant from the bean defintion.
Is this something new for JMix 1.3 ?
Before Jmix 1.3, my code was working okay

Try to execute gradlew clean command and then restart your project.

I just tried that and I am still getting the error

I ended up inserting the following code in application.properties:

spring.main.allow-bean-definition-overriding=true

The error went away but I am wondering if this was the best solution ?

Bean overriding was always disabled in Jmix. Do you really need multiple beans with the same name in your project?

I am not using multiple beans with the same name in my project.

The project was working without errors before I upgraded to Jmix 1.3.x

I am seeing what I think is the cause of the error:
Inside folder
C:\Users\Robert\Jmix-Projects\pickandload\.jmix\conf\com\company\pickandload\service
I am seeing classes being generated. Once I delete these class files, the duplicate bean error goes away.

What is causing class files to be generated in C:\Users\Robert\Jmix-Projects\pickandload\.jmix\conf\com\company\pickandload\service folder ?

This is what is causing my problem

Ok, I see then. This happens because Studio hot deploys Spring beans, although it should not. I’ve created an issue.

The standard Run configuration in the IDE should clear the “conf” directory that contains the compiled classes. For some reason it disappeared from your config.

image

Add before launch task to you run configuration.

1 Like

Thank you Maxim !

Your screenshot helped me alot and made me realize that I was running the wrong configuration all this time. I was running a Spring configuration which does not clean hot deploy conf directory.

I see the proper Jmix Application configuration that is setup okay and it works well.

So apparently there is no bug but was my fault.