Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions GuessNumber/src/main/java/GuessNumberGame.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class GuessNumberGame {

@Value("15") // Error:java: javacTask: source release 8 requires target release 1.8 - везде Java 8 стоит
private int secretNumber;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked. Setting->Java compiler

@Value("3")
private int attemptsCount;
private GuessSource guessSource;
private ResultOutput output;

@Autowired
public GuessNumberGame(int secretNumber,
int attemptsCount,
GuessSource source,
Expand Down
3 changes: 3 additions & 0 deletions GuessNumber/src/main/java/KeyboardGuess.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import org.springframework.stereotype.Component;

import java.util.Scanner;

@Component
public class KeyboardGuess implements GuessSource {
Scanner scanner = new Scanner(System.in);
@Override
Expand Down
9 changes: 1 addition & 8 deletions GuessNumber/src/main/resources/beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,7 @@
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">

<bean id="keyboardGuess" class="KeyboardGuess"/>
<bean id="consoleOutput" class="ConsoleOutput"/>

<bean id="guessNumberGame" class="GuessNumberGame">
<constructor-arg type="int" value="15"/>
<constructor-arg type="int" value="3"/>
<constructor-arg ref="keyboardGuess"/>
<constructor-arg ref="consoleOutput"/>
</bean>
<context:component-scan base-package=""></context:component-scan>

</beans>