What is the easiest way to have CDI and JPA in Java SE?

后端 未结 2 1592
难免孤独
难免孤独 2020-12-09 05:59

I would like to have in Java SE

@Stateless
public class CarDAO {
    @Inject
    private EntityManager em;

    public Car findById(Long id) {
        return         


        
2条回答
  •  没有蜡笔的小新
    2020-12-09 06:26

    Peter's answer seems to work, but the Maven dependencies are outdated (see this bug)

    
        org.jboss.weld.se
        weld-se-core
        2.3.1.Final
    
    
        org.jboss.weld
        weld-core
        2.3.1.Final
    
    
        org.jboss
        jandex
        1.2.2.Final
    
    

提交回复
热议问题