스프링 2.5에서 스프링 4로 webapp을 이전하려고하는데 문제가 발견되었습니다. 동일한 클래스의 두 가지 구성에 대해 작동하는 두 개의 서로 다른 URL이 있습니다.스프링 4 @ 컨트롤러 설정
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/url1.htm">bean1</prop>
<prop key="/url2.htm">bean2</prop>
</props>
</property>
</bean>
와 콩
<bean id="bean1" class="com.package.Controller" scope="session">
<property name="property" value="value of property"/>
</bean>
<bean id="bean2" class="com.package.Controller" scope="session">
<property name="property" value="a different value of the same property"/>
</bean>
같은 것을 어떻게 주석이 할 수 있습니다 : 내 이전 버전에서 , 내가 좋아하는 뭔가를?
같이 할 수있는 방법을 복제 할 것과하지 말아야 경우 왜 당신은 포기해야 할 것? Spring 4를 사용한다고해서 SimpleUrlHandlerMapping을 포기해야한다는 의미는 아닙니다. 유즈 케이스가 유효하다면'@ Controller' 대신'Controller'를 사용하십시오. –
하지만 스프링 4에서도 여전히 사용할 수 있습니까 ?? 주석이 달린 @Configuration 클래스에서 어떻게 구성합니까? – Miscillo
인스턴스를 만들고 매핑을 채우기 만하면됩니다. –