Annotations and managed beans declarations in faces-config.xml

I get JSF 2.0 and doubt the new annotation-based auto-signature (declaring managed beans without any code in faces-config.xml).

As far as I know, this is wonderful and easy, but the problem may arise with a certain need to replace one bean with another in a large system, which, if annotations were used, would lead to the need to delete certain classes (or a similar dirty hack), while it can be easily fixed in faces-cofig.xml.

Please share your experience on this. What should be considered more convenient and why?

+3
source share
2 answers

Core JavaServer Faces ( ):

JSF 2.0 beans XML. XML. XML verbose, , beans .

xml. , .

+1

bean

. JSF bean JSF /API. JSF /API-, JSF, JSF bean.

,

@ManagedBean
@SessionScoped
public class User {
    private Long id;
    private String username;
    private String password;
    // ...
}

@ManagedBean
@SessionScoped
public class UserManager {
    private User user;
    // ...
}

public class User {
    private Long id;
    private String username;
    private String password;
    // ...
}

User , API-, . " ".

+2

Source: https://habr.com/ru/post/1793658/


All Articles