lang:java:spring
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
lang:java:spring [2016/12/17 23:22] – Création root | lang:java:spring [2020/05/11 00:07] (Version actuelle) – Suppression de la taille par défaut pour les images root | ||
---|---|---|---|
Ligne 4: | Ligne 4: | ||
=====Cycle de vie d'un Bean===== | =====Cycle de vie d'un Bean===== | ||
- | {{: | + | {{: |
- | + | ||
- | [[http:// | + | |
+ | [[https:// | ||
=====POA autour d'un bean managé===== | =====POA autour d'un bean managé===== | ||
Bean basique | Bean basique | ||
Ligne 97: | Ligne 96: | ||
INFOS: Closing org.springframework.context.support.ClassPathXmlApplicationContext@1f17ae12: | INFOS: Closing org.springframework.context.support.ClassPathXmlApplicationContext@1f17ae12: | ||
+ | =====En combinaison avec AspectJ===== | ||
+ | <WRAP center round important 60%> | ||
+ | Le projet ne doit pas être configuré en AspectJ mais les libraires d' | ||
+ | </ | ||
+ | |||
+ | On travaille avec la même classe '' | ||
+ | |||
+ | <file java Logging.java> | ||
+ | package aspects; | ||
+ | |||
+ | import org.aspectj.lang.annotation.Around; | ||
+ | import org.aspectj.lang.annotation.Aspect; | ||
+ | |||
+ | @Aspect | ||
+ | public class Logging { | ||
+ | @Around(" | ||
+ | public String aroundGetMessage() | ||
+ | { | ||
+ | return " | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | <file java Main.java> | ||
+ | package test; | ||
+ | |||
+ | import org.springframework.context.ConfigurableApplicationContext; | ||
+ | import org.springframework.context.support.ClassPathXmlApplicationContext; | ||
+ | |||
+ | import fonction.Bonjour; | ||
+ | |||
+ | public class Main { | ||
+ | public static void main(String[] args) { | ||
+ | try (ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext(" | ||
+ | Bonjour bonjour = (Bonjour) ctx.getBean(" | ||
+ | |||
+ | System.out.println(" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Le fichier '' | ||
+ | |||
+ | Ici, il faut charger la classe bean '' | ||
+ | |||
+ | '' | ||
+ | <file xml Beans.xml> | ||
+ | <?xml version=" | ||
+ | < | ||
+ | xmlns: | ||
+ | xsi: | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ |
lang/java/spring.1482013360.txt.gz · Dernière modification : 2016/12/17 23:22 de root