Created
June 1, 2020 03:48
-
-
Save ahwinemman/5fb7d0aed2eba63ee484c4812cc1315f to your computer and use it in GitHub Desktop.
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
package com.javaee.injectprops; | |
import com.javaee.injectprops.annotations.StringProperty; | |
import javax.annotation.PostConstruct; | |
import javax.ejb.Singleton; | |
import javax.ejb.Startup; | |
import javax.inject.Inject; | |
import java.util.logging.Logger; | |
@Singleton | |
@Startup | |
public class MainClass { | |
@Inject | |
@StringProperty(value = "base_url") | |
private String baseUrl; | |
@Inject | |
@StringProperty(value = "username") | |
private String username; | |
@Inject | |
@StringProperty(value = "password") | |
private String password; | |
private static final Logger LOGGER = Logger.getLogger(MainClass.class.getName()); | |
@PostConstruct | |
public void logPropertyValues() { | |
LOGGER.info("The value of the baseUrl is : " + baseUrl); | |
LOGGER.info("The value of the username is : " + username); | |
LOGGER.info("The value of the password is : " + password); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment