It's possible define bean stereotypes via XML?
问题 It's possible, via XML, define a bean stereotype? Something as: <bean ... stereotype="org.springframework.stereotype.Service"> </bean> or, <bean...> <stereotype class="mypackage.myStereotype" /> </bean> ? 回答1: Probably the easiest solution would be to use arbitrary spring bean metadata as follows: <bean id="fooService" class="org.example.FooServiceImpl"> <meta key="stereotype" value="mypackage.myStereotype" /> </bean> The definition of the meta element in spring-beans.xsd is: <xsd:complexType