I have defined in a xml config file:
<bean id="bootstrap" class="com.package.Bootstrap"></bean>
this works fine.
The bootsrap class :
public class Bootstrap {
@PostConstruct
public void onServerStart() {
System.out.println("PRINTSSSSSSSSSSSSSSSSSSS");
}
}
The method gets fired.
But how can I get rid of the xml part, and annotate bootstrap to be a bean instead?
I have
<mvc:annotation-driven />
<context:annotation-config />
and
<context:component-scan base-package="com.package" />
But I was wondering what the annotation used should be that replaces:
<bean id="bootstrap" class="com.package.Bootstrap"></bean>
I could not find anything about this online and in the spring docs :(
There's documentation regarding this; you'll want a stereotype annotation like @Component
.
Stereotype bean annotations
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With