What is the equivalent of
<bean id="myClass" class="com.xxx.MyClass" factory-method="aspectOf" />
when using a Spring 4 @Bean-annotated method?
What is the equivalent of
<bean id="myClass" class="com.xxx.MyClass" factory-method="aspectOf" />
when using a Spring 4 @Bean-annotated method?
There is no annotation for the factory method, but you can use the @Configuration and @Bean annotations
@Configuration
public class MyClass {
@Bean
public MyClass myObject() {
return MyStaticFactory.getObject();
}
}
MyStaticFactory does not require any Spring annotations.
Use @Configurable
with <context:spring-configured>