Last active
December 27, 2015 04:48
-
-
Save arwagner/7268989 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'foobarService' defined in file [/Users/wagnera/workspace/j+hs/onboard/onboardservices/target/classes/com/agilex/onboardservices/services/FoobarService.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanInitializationException: Property 'text' is required for bean 'foobarService' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
public class FoobarService { | |
private static final Logger logger = LoggerFactory.getLogger(FoobarService.class); | |
private String text; | |
public void report() { | |
logger.info("text: " + getText()); | |
} | |
public String getText() { | |
return text; | |
} | |
@Required | |
public void setText(String text) { | |
logger.info("setText called"); | |
this.text = text; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Controller | |
public class HomeController { | |
@Autowired | |
private FoobarService foobarService; | |
@RequestMapping(value = "/", method = RequestMethod.GET) | |
public String home(Locale locale, Model model) { | |
foobarService.report(); | |
return "home"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root-context.xml: | |
... | |
<bean id="foobarService" class="com.agilex.onboardservices.services.FoobarService"> | |
<property name="text" value="foobar"/> | |
</bean> | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment