在之前的博客中写了一个测试配置问件的方法,那个项目是一个spring boot项目,当时是在一个Controller类里面.创建了main方法.然后直接run as java application
这个时候测试结果挺好.没什么问题.这个时候spring boot通过eclipse的run as spring boot app也是可以正常访问的,但是在通过mvn package命令打包的时候
总是出错就报了个错误
错误详细内容是:
Caused by: java.lang.IllegalStateException: Unable to find a single main class f
rom the following candidates [com.example.app.App, com.example.app.controller.Te
stPropertiesController]
这个时候只要把Controller类里面的main方法注释掉,再运行打包就没有这个问题了