Spring BOOT: add your beans definition file

In Spring Boot you can add your beans definition file by creating a class and annotating it with @Configuration annotation:

import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

class XmlImportingConfiguration {

and in the application entry point as usually for Spring Boot:

public static void main(String[] args) throws Exception {
        ApplicationContext ctx = SpringApplication.run(SampleWebJspApplication.class, args);
       System.out.println(“Let’s inspect the beans provided by Spring Boot:”);

            String[] beanNames = ctx.getBeanDefinitionNames();
            for (String beanName : beanNames) {

in the list of beans you will find your bean which you defined in applicationContext.xml


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s