这个问题是关于Spring中的Java配置。是否可以在Java代码中替换以下声明。
<beans xmlns="http://www.springframework.org/schema/beans"
...
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd">
<aop:aspectj-autoproxy />
<mvc:annotation-driven>
<mvc:message-converters register-defaults="false">
<bean class="org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter" />
<bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" />
</mvc:message-converters>
</mvc:annotation-driven>
<context:component-scan base-package="com.abc.secure.service" />
<bean id="securityAspect" class="com.abc.secure.service.Secure" />
</beans>
其中secure-app-context.xml
struct Edge
{
int src, dest, weight;
}; typedef struct Edge Edge;
struct Graph
{
int V, E;
Edge* edge;
}; typedef struct Graph Graph;
答案 0 :(得分:0)
你可以通过使用WebApplicationInitializer来做到这一点(在这种情况下你不需要web.xml)
请参阅下面的帖子:
How to configure Spring MVC with pure Java-based configuration?