Bonjour voilà j'ai dans une classe annotée @Config des constantes statiques type String par exemple (requete SQL),
Est il possibles de les recuperer dans d'aurtres classe sans utiliser AppConfig.maconstante? y a t il une pratique, du genre : context.get(maconstante);
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 
 
@Configuration
public class AppConfig {
 
	final static String URL = "jdbc:mysql://localhost:3306/database01";
	final static String USER = "abysr";
	final static String PASSWORD = "********";
	final static String INSERT = "INSERT INTO produits (ID, NOM, CATEGORIE, PRIX, DESCRIPTION) "
									+ "VALUES(?,?,?,?,?)";
	final static String DELETE = "DELETE FROM produits";
	final static String UPDATE = "UPDATE produits SET PRIX=PRIX*1.25 WHERE CATEGORIE=?";
	final static String SELECT = "SELECT ID, NOM, CATEGORIE, PRIX, DESCRIPTION FROM produits";
	final static String INSERT2 = "INSERT INTO produits (ID, NOM, CATEGORIE, PRIX, DESCRIPTION) "
									+ "VALUES(100,'X',1,1,'x')";
	final static String DRIVER_CLASS_NAME = "com.mysql.jdbc.Driver";
.
.
.