Let's say I have a class.
@Service
public class SomeService {
private String name;
public void setName(String name) {
this.name = name;
}
public void printHello() {
System.out.println("Spring 3 : Hello ! " + name);
}
}
The someService bean id is created for this bean by default. I want to change this bean id to say "abc". How would I do that ?
@Service("abc") will do the trick you want.
This will applicable for any @Component annotation such as @Service,@Repository and @Controller etc.
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