Here the spring wiring for beans with the annotation facade:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<context:component-scan base-package="demo.design"> | |
<context:include-filter type="annotation" | |
expression="com.seitenbau.demo.stereotypes.Facade" /> | |
</context:component-scan> |
The facade annotation:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Target({ElementType.TYPE}) | |
@Retention(RetentionPolicy.RUNTIME) | |
public @interface Facade {} |
And here a demo facade spring bean:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Facade | |
public class AddressFacadeImpl implements AddressFacade | |
{ | |
private AddressService addressService; | |
private UserRepository userRepository; | |
@Override | |
public List<AdresseBean> getAdresses() throws ApplicationException | |
{ | |
return addressService.getAdresses(); | |
} | |
@Override | |
public void saveAdresse(AdresseBean adresse) throws ApplicationException | |
{ | |
addressService.saveAdresse(adresse); | |
} | |
@Override | |
public boolean userExists(String username) | |
{ | |
return userRepository.userExists(username); | |
} | |
@Autowired | |
public void setAddressService(AddressService addressService) | |
{ | |
this.addressService = addressService; | |
} | |
@Autowired | |
public void setUserRepository(UserRepository userRepository) | |
{ | |
this.userRepository = userRepository; | |
} | |
} |