Scrivio Interview library
ConceptFoundations5 min read · updated 12 November 2026

What is the difference between full @Configuration mode and lite mode, and what does proxyBeanMethods = false change?

In full mode, the default for @Configuration, Spring generates a CGLIB subclass of the configuration class so that when one @Bean method calls another, the call returns the container's bean instead of creating a new object. In lite mode, which we get with proxyBeanMethods = false or with @Bean methods in a plain @Component, there is no subclass and such a call is a plain Java call that creates a new object. So in lite mode we declare dependencies as @Bean method parameters; in return we skip subclassing, start slightly faster and can use final classes, which is why Spring Boot's auto-configurations use proxyBeanMethods = false.

Why this question is asked

proxyBeanMethods = false appears on almost every auto-configuration class in Spring Boot, and many teams copy it into their own code without knowing what it changes. It is a one-attribute change that can silently create duplicate objects if the class relies on full-mode behaviour. Interviewers ask about it to check that we understand how @Configuration really works. In this answer, we will recap @Bean methods and singletons, look at what full mode does and why, see what lite mode changes with an example, learn the correct way to write lite configuration, and see why Spring Boot chose lite mode.

1A Quick Recap: @Bean Methods and Singletons

A @Bean method tells Spring how to create a bean: Spring calls the method and registers the returned object. Most beans are singletons, so the container calls each @Bean method once and hands the same object to everyone who needs it.

Inside a configuration class, we sometimes write one @Bean method that calls another, for example new JdbcTemplate(dataSource()). In plain Java that call runs dataSource() again and creates a second object. Full mode and lite mode differ exactly in what happens with such a call.

2Full Mode: A CGLIB Subclass Guards Inter-Bean Calls

When a class is annotated with @Configuration and proxyBeanMethods is true, which is the default, Spring's ConfigurationClassPostProcessor generates a subclass of the class at startup using CGLIB, a byte code generation library bundled inside Spring. The subclass overrides each @Bean method. When our code calls dataSource(), the override first checks the container: if a dataSource bean exists, it returns it; only when the container itself is creating the bean does it run our original method.

Java
@Configuration // full mode
class DbConfig {
@Bean DataSource dataSource() { return new HikariDataSource(cfg()); }
@Bean JdbcTemplate jdbcTemplate() { return new JdbcTemplate(dataSource()); } // intercepted
}
DataSource fromContext = ctx.getBean(DataSource.class);
System.out.println(ctx.getBean(JdbcTemplate.class).getDataSource() == fromContext); // true
System.out.println(ctx.getBean(DbConfig.class).getClass().getSimpleName()); // DbConfig$$SpringCGLIB$$0

So in full mode, an inter-bean method call keeps singleton semantics. The cost is the generated subclass: it must be created at startup, the class cannot be final, and @Bean methods cannot be private or final, because CGLIB has to override them.

3Lite Mode: No Subclass, Plain Java Calls

With @Configuration(proxyBeanMethods = false), Spring does not generate a subclass. The same happens when @Bean methods sit in a class annotated with @Component, or in a plain class registered some other way; Spring calls this lite mode. The @Bean methods still create beans, but a call from one method to another is just a Java call.

Java
@Configuration(proxyBeanMethods = false) // lite mode
class DbConfig {
@Bean DataSource dataSource() { return new HikariDataSource(cfg()); }
@Bean JdbcTemplate jdbcTemplate() { return new JdbcTemplate(dataSource()); } // a second pool!
}
System.out.println(ctx.getBean(JdbcTemplate.class).getDataSource() == ctx.getBean(DataSource.class)); // false
System.out.println(ctx.getBean(DbConfig.class).getClass().getSimpleName()); // DbConfig
Full mode compared with lite mode
AspectFull mode (default)Lite mode
How to get it@ConfigurationproxyBeanMethods = false, or @Bean in @Component
CGLIB subclassyesno
Calling another @Bean methodreturns the container's beanplain call, new object
Final class or final @Bean methodsnot allowedallowed
Startup and AOTsubclass generatedslightly faster, simpler for AOT and native
Correct way to express dependenciesparameters, or method callsparameters only

Now there are two HikariDataSource objects, two connection pools, and only one is managed by the container. Nothing fails at startup; the bug is silent. This is why switching an existing class to lite mode needs care.

4Writing Lite Configuration Correctly

The fix is to express dependencies as @Bean method parameters. Spring resolves each parameter from the container before calling the method, so we always receive the managed bean.

Java
@Configuration(proxyBeanMethods = false)
class DbConfig {
@Bean DataSource dataSource() { return new HikariDataSource(cfg()); }
@Bean JdbcTemplate jdbcTemplate(DataSource dataSource) { // injected by the container
return new JdbcTemplate(dataSource);
}
}
// getDataSource() == ctx.getBean(DataSource.class) -> true, one pool

Parameters work in full mode too, so this style is correct whichever mode the class uses. It also makes the dependencies visible in the method signature, the same way constructor injection makes a class's dependencies visible.

5Why Lite Mode, and Why Spring Boot Uses It

Lite mode has three practical benefits. Spring does not generate and load a subclass for each configuration class, which saves a little startup time and memory; with hundreds of auto-configuration classes in a Boot application, that adds up. The class can be final and its methods can be final or private, which some teams prefer. And without a runtime-generated subclass, Spring AOT and GraalVM native images have less to handle.

Spring Boot's own auto-configurations are therefore written as @AutoConfiguration classes, which use proxyBeanMethods = false, with every dependency taken as a parameter. For our own new configuration classes, the same style is a good default. The only reason to keep full mode is existing code that relies on inter-bean method calls, and such code can be migrated by turning those calls into parameters.

6Follow-up questions

Is there any case where lite mode calls are intentional?

Rarely. Occasionally a @Bean method calls a helper method that is not itself a @Bean, such as a private method that builds a settings object; that is fine in both modes because no bean is involved. Calling another @Bean method in lite mode almost always indicates a bug.

What happens with static @Bean methods?

Static @Bean methods are never intercepted, even in full mode, because a subclass cannot override a static method. That is fine for post-processors, which should be static anyway, but it means calling a static @Bean method from another method always creates a new object.

Does lite mode affect @Transactional or other proxies on the beans themselves?

No. proxyBeanMethods only controls the subclass of the configuration class. Beans created by its @Bean methods still get their AOP proxies from BeanPostProcessors as usual, as long as they are obtained through the container, which parameters guarantee.

7Conclusion

In this answer, we saw that full-mode @Configuration classes are subclassed with CGLIB so that inter-bean method calls return container-managed beans. Lite mode, with proxyBeanMethods = false or @Bean methods in a @Component, has no subclass, so calling another @Bean method is a plain Java call that creates a new object. In lite mode we express dependencies as @Bean method parameters. Lite mode avoids subclassing, slightly improves startup and works with final classes, which is why Spring Boot's auto-configurations use proxyBeanMethods = false.

What to say in the interviewAbout 90 seconds aloud

Open with

A class annotated with @Configuration runs in full mode by default. Spring generates a CGLIB subclass of it at startup and overrides the @Bean methods, so when one @Bean method calls another, say new JdbcTemplate(dataSource()), the call is intercepted and returns the singleton from the container instead of creating a new object.

Then, if they want more

That keeps singleton semantics even with direct method calls, but it costs a generated class, and the configuration class and its @Bean methods cannot be final. Lite mode is what we get with proxyBeanMethods = false, or with @Bean methods inside a plain @Component.

There is no subclass, so the same dataSource() call is just a Java call and creates a second DataSource, a second connection pool, outside the container. That is why in lite mode I always declare dependencies as method parameters, jdbcTemplate(DataSource dataSource), so the container injects its bean. That style is correct in both modes anyway.

The benefit of lite mode is that Spring skips the subclassing, which slightly improves startup and memory, makes AOT and native images simpler, and allows final classes.

Spring Boot's own auto-configurations all use proxyBeanMethods = false with parameter injection, and I use the same default for new configuration classes, while being careful when switching existing classes that might call @Bean methods directly.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "What is the difference between full @Configuration mode and lite mode, and what does...": https://scrivio-interview-library.netlify.app/spring-boot/ioc-container/8be8066e60/