2017-10-13 32 views
0

我搜索stackoverflow相当多,但没有找到解决方案,我的问题。 我GTE以下错误部署SpringBoot应用程序为WAR文件到Tomcat 8时,localy它做工精细SpringBoot需要一个无法找到的'boolean'类型的bean

***************************| 
APPLICATION FAILED TO START| 
***************************| 
Description: 
Parameter 0 of method getJobapplicationDTO in 
com.tts.scp.converter.config.ScpDestinationConfig required a bean of 
type 'boolean' that could not be found. 
Action: 
Consider defining a bean of type 'boolean' in your configuration. 

有一个接口

public interface HttpProviderConfig { 
    JobApplicationDTO getJobapplicationDTO(boolean printResume, boolean 
    printCoverletter, boolean printAttachments, String jobApplicationId); 
} 

和两个实现类

@Configuration 
@Profile("production") 
public class ScpDestinationConfig implements HttpProviderConfig{ 

private static final Logger logger = 
LoggerFactory.getLogger(ScpDestinationConfig.class); 

@Override 
@Bean 
public JobApplicationDTO getJobapplicationDTO (boolean resume, boolean coverletter ... 

and second class

@Configuration 
@Profile("dev") 
public class LocalDestinationConfig implements HttpProviderConfig{ 

private static final Logger logger = 
LoggerFactory.getLogger(LocalDestinationConfig.class); 

@Override 
@Bean 
public JobApplicationDTO getJobapplicationDTO (boolean resume, boolean coverletter ... 

和停靠服务

@RestController 
public class ConverterController { 

private static final Logger logger = 
LoggerFactory.getLogger(ConverterController.class); 

@Autowired 
@Lazy 
private HttpProviderConfig client; 

@GetMapping(path = "/convertDocuments", produces=MediaType.APPLICATION_PDF_VALUE) 
public void convertedDocument(@RequestParam(defaultValue = "true") String printResume, 
     @RequestParam(defaultValue = "true") String printCoverLetter, 
     @RequestParam(defaultValue = "true") String printAttachments, @RequestParam String jobApplicationId, 
     HttpServletResponse response) throws IOException { 

    JobApplicationDTO jobApplicationDTO = client.getJobapplicationDTO(

所以啥子我不明白的Tomcat怎么也找不到原始数据类型像布尔,为什么它不工作时,我在本地运行。

任何帮助,将不胜感激

问候 马蒂亚斯

回答

0

所以啥子我不明白的Tomcat怎么也找不到原始数据类型像布尔,为什么它不工作时,我在本地运行。

这与它无关。

在您的配置你有@Bean声明,如:

@Bean 
public JobApplicationDTO getJobapplicationDTO (boolean resume, ...) 

所以基本上你问春季管理JobApplicationDTO你。春天然后需要resume和其他参数来为你构建JobApplicationDTO,它不能找到它们,所以你得到的错误。

我想你不应该首先用@Bean注释你的get...DTO方法。而你的...Config类对我来说实际上看起来不像@Configuration,而非@Service@Component

+0

这是正确的。在他的情况豆看起来应该像'@Bean HttpProviderConfig httpProviderConfig(){return new ScpDestinationConfig} .'我不认为@Mathias Maerker完全理解bean和配置如何工作。一些参考:https://docs.spring.io/spring-javaconfig/docs/1.0.0.M4/reference/html/ch02s02.html – CrazySabbath

+0

是的你的权利我不完全明白我在这里做什么;)但感谢你们两位的帮助! –

相关问题