I have two beans. Both implement the distribution function. One only works when deployed to an application server. Another is used for testing.
We have a profile for each developer and environment. I want to conduct bean testing only with actual testing. Another bean should be used when not tested. How can I archive this?
@Component
@Profile("localtest")
public class OfflineMail implements Mailing {}
Approaches to the solution:
Using "default", I read this somewhere, but there seems to be no return to "default" for a profile like "dev":
@Component
@Profile("default")
public class OnlineMail implements Mailing {}
-> Exception for bean for found wiring.
Exit profile:
@Component
public class OnlineMail implements Mailing {}
-> Throws a unique exception when starting the "localtest" profile.
Adding all profiles:
@Component
@Profile("prod")
@Profile("integration")
@Profile("test")
@Profile("dev1")
@Profile("dev2")
@Profile("dev3")
...
public class OnlineMail implements Mailing {}
, , "dev <WindowsLogin> "; , bean, beans, .
- @Profile ( "! localtest" ) .
- , " , bean"?