Created
May 1, 2020 15:50
-
-
Save j-tim/c55b96619ed612ca897788288d285088 to your computer and use it in GitHub Desktop.
Spring Boot 2.3.0 @ConditionalOnWarDeployment example
This file contains hidden or 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
package nl.jtim.conditional.on.war.deployment; | |
import lombok.extern.slf4j.Slf4j; | |
import org.springframework.boot.autoconfigure.condition.ConditionalOnWarDeployment; | |
import org.springframework.stereotype.Component; | |
import org.springframework.stereotype.Service; | |
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.RestController; | |
@Slf4j | |
@Service | |
@ConditionalOnWarDeployment | |
public class SomeService { | |
public SomeService() { | |
log.info("I'm still running in a Servlet container or application server :("); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment