application context in spring boot code example

Example 1: context path spring boot

server.servlet.context-path=/baeldung

Example 2: set spring context

server.servlet.context-path=/SOMETHING

Example 3: get spring application context

public class SpringBean {
  @Autowired
  private ApplicationContext appContext;
}

Example 4: spring document application context example

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans.xsd">

  <bean id="..." class="...">
    <!-- collaborators and configuration for this bean go here -->
  </bean>

  <bean id="..." class="...">
    <!-- collaborators and configuration for this bean go here -->
  </bean>

  <!-- more bean definitions go here -->

</beans>

Tags:

Java Example