# Is there an $A$ such that $B$ injective iff 1st Ext functor vanishes?

In the category of $\mathbb{Z}$-modules, there exists a module $A$---for instance $\bigoplus_{k=2}^\infty \mathbb{Z}/k\mathbb{Z}$---such that a $\mathbb{Z}$-module $B$ is injective iff $\operatorname{Ext}^1_\mathbb{Z}(A,B)=0$.

Does this hold if $\mathbb{Z}$ is replaced with an arbitrary (unital) ring $R$? If not, what are some sufficient conditions on $R$ for this to hold?

As a comment, note that this is equivalent to requiring the existance of a family $\{A_j\}_{j\in J}$ of $R$-modules indexed by some set $J$ such that an $R$-module $B$ is injective iff $\operatorname{Ext}^1_R(A_j,B)=0$ for all $j\in J$: This is clearly implied by the original statement. To get the other direction, set $A:=\bigoplus_{j\in J} A_j$. Then $$\operatorname{Ext}^1_R(A,B)=\prod_{j\in J} \operatorname{Ext}^1_R(A_j, B)=0$$ since each component is $0$.

Yes, such a module exists for each unital ring $R$: Take $A= \bigoplus_I R/I$ where $I$ runs through the left ideals of $R$. This is because $B$ is injective iff $\text{Ext}^1_R(R/I,B)=0$ for each $I$ (Weibel, Lemma 4.1.11). Also note that this is a straightforward generalization of your example $R=\mathbb{Z}$.
Added: If $R$ is a Noetherian commutative ring, you can also take $A=\bigoplus_P R/P$ where $P$ runs through the prime ideals of $R$ (Bruns, Herzog: Cohen-Macaulay rings, 3.1.12).