Spring boot junit test cannot get command line argument (Eclipse - STS) -


i did spring boot application, , use command line arguments. read them in services like

@value("${v}") private string vertical; 

application works , see value passed command line. added same command line arguments junit tests run configurations

--spring.profiles.active=development --m=keyword --v=healthcare --i=keyword_update.json

junit run config

but when try run test crashes message, means application context cannot command line attribute:

2016-05-28 17:16:00.924 error 4204 --- [ main] o.s.boot.springapplicat ion : application startup failed

org.springframework.beans.factory.beancreationexception: error creating bean wit h name 'application': injection of autowired dependencies failed; nested excepti on org.springframework.beans.factory.beancreationexception: not autowir e field: healthjobs.service.catalog healthjobs.app.application.catalog; nested e xception org.springframework.beans.factory.beancreationexception: error creat ing bean name 'catalogimpl': injection of autowired dependencies failed; ne sted exception org.springframework.beans.factory.beancreationexception: not autowire field: healthjobs.service.catalogpage healthjobs.service.catalogim pl.catalogpage; nested exception org.springframework.beans.factory.beancreati onexception: error creating bean name 'catalogpageimpl': injection of autow ired dependencies failed; nested exception org.springframework.beans.factory. beancreationexception: not autowire field: private java.lang.string health jobs.service.catalogpageimpl.vertical; nested exception java.lang.illegalargu mentexception: not resolve placeholder 'v' in string value "${v}"

why? how run tests command line arguments in spring boot?

ps full stack trace appears long attach here. when run mvn package same error test, mvn run config not have ability input command line arguments. environment:

spring tool suite version: 3.7.2.release build id: 201511261048 platform: eclipse mars.1 (4.5.1)


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -