An error was reported during automatic injection, Could not autowire. No beans of'Environment' type found.

It’s because the package
was imported incorrectly. It should have been:
import org.springframework.core.env.Environment;
I imported :
import org.omg.CORBA.Environment;
resulting in the automatic injection of Environment. It is always unsuccessful,
that is, the import and no getProperty( ) This method,
so remember not to go to the wrong package, and you can also find out if your class is in the IOC container (@Component) if the error is automatically injected.

Guess you like

Origin blog.csdn.net/qq_49249150/article/details/109028615