I'm reading below exercise in Brezis' Functional Analysis, i.e.,
Exercise 4.9 Jensen's inequality (page 120):
Let $(\Omega, \mathcal F, \mu)$ be a measure space with $\mu(\Omega) < \infty$. Let $J:\mathbb R \to (-\infty, +\infty]$ be a convex lower semi-continuous function such that $J$ is not identically equal to $+\infty$. Let $f \in L^1 (\Omega)$ such that $f(\omega) \in D(J)$ for $\mu$-a.e. $\omega \in \Omega$ and that $J(f) \in L^1 (\Omega)$. Then $$ J \bigg ( \frac{1}{\mu(\Omega)} \int_\Omega f \, \mathrm d \mu \bigg ) \le \frac{1}{\mu(\Omega)} \int_\Omega J(f) \, \mathrm d \mu. $$ Here $D(J) := \{x \in \mathbb R : f(x) \neq +\infty\}$ is the domain of $J$. Clearly, $D(J)$ is a convex set.
We have $f(\omega) \in D(J)$ for $\mu$-a.e. $\omega \in \Omega$. We only know that $D(J)$ is convex.
Could you explain how to obtain $$ \frac{1}{\mu(\Omega)} \int_\Omega f \, \mathrm d \mu\in D(J) $$ ?
We have a related result, i.e.,
Fundamental inclusion for convex sets Let $C$ be a closed subset of $\mathbb{R}^n$. Then, $C$ is convex if and only if $\int_\Omega f \, \mathrm d\mu \in C$ for every probability space $(\Omega, \mathcal F, \mu)$ and for every $\mathbb{R}^n$-valued integrable functions $f$ on $\Omega$ satisfying $f(\omega)\in C$ for $\mu$-a.e. $\omega\in\Omega$.
Since $J$ is a l.s.c. function and $J(\mathbb{R})\cap\mathbb{R}\neq\emptyset$, $f$ is proper, that is its effective domain $D(J)=\{x: J(x)\neq+\infty\}\neq\emptyset$ and $J^{-1}(-\infty)=\emptyset$. This means that $D(J)$ is an interval in $\mathbb{R}$. Let $a=\inf D(J)$ and $b=\sup D(J)$. Then $a\mu(\Omega)\leq \int f\leq b\mu(\Omega)$. Since $f\in L_1(\Omega)$, $|\int f\,d\mu|\neq\infty$ and so either $m_f:=\frac{1}{\mu(\Omega)}\int f\in\operatorname{int}(D(J))$ or $m_f\in\partial D(J)\cap\mathbb{R}=\{a,b\}\cap\mathbb{R}$. In the latter case $f$ is a constant $\mu$-a.s. From there one can argue to show that $f\equiv a\in D(J)\cap\mathbb{R}$, or $f\equiv b\in D(J)\cap\mathbb{R}$
This shows that $m_f\in D(J)$.
Here is what I mean by convex, proper functions and by effective domain. Also, here is a proof that under the hypothesis of the OP's posting, $J$ is proper.
Suppose $X$ is a topological linear space (for the OP it suffices to consider $X=\mathbb{R}$ with the usual topology of the real line).
Proof: Suppose $x,y\in \operatorname{dom}(f)$ and let $a,\,b\in\mathbb{R}$ such that $a>J(x)$ and $b>J(y)$. Then $(x,a),\, (y,b)\in\operatorname{epi}(J)$. Hence $J(\lambda x+(1-\lambda)y)\leq \lambda a + (1-\lambda)b$ for all $0\leq \lambda\leq1$. The conclusion follows by letting $a\searrow J(x)$ and $b\searrow J(y)$.
Suppose there is $x_1\in X$ with $J(x_1)=-\infty$. Let $x_\lambda:=\lambda x_0+(1-\lambda)x_1$. Since $\operatorname{epi}(J)$ is convex, and $(x_0,J(x_0)), (x_1,a)\in\operatorname{epi}(J)$ for all $a\in\mathbb{R}$, $J(x_\lambda)=-\infty$ for all $0\leq\lambda<1$. Since $J$ is lower semicontinuous, $J(x_0)\leq\liminf_{\lambda\rightarrow1}J(x_\lambda)=-\infty$ which is a contradiction.