How to disable circular reference in Spring Boot

One way to completely disable circular bean reference resolution magic in Spring Boot is to replace in your main method

SpringApplication.run(YourApplication.class, args);

with

new SpringApplicationBuilder(YourApplication.class)
    .initializers(new ApplicationContextInitializer<GenericApplicationContext>() {
        @Override
        public void initialize(GenericApplicationContext applicationContext) {
            applicationContext.setAllowCircularReferences(false);
        }
    })
.run(args);

You can set other parameters there as well.