N
N
Nastya19202020-06-18 12:36:56
Java
Nastya1920, 2020-06-18 12:36:56

Why RefreshScope doesn't work with config class?

I set up the application-client to work with the config-server (remote update app.properties). Maven I
entered all standard data into bootstrap.props, into the server config itself. Allowed the client to access the refresh endpoint.
Problem:
1. Removed all used values ​​from application.properties, transferred them to the github repository.
Values ​​at me are registered in a configuration class. I connect this class via autowired later, where these values ​​are used:


@Configuration
@ManagedResource
@RefreshScope
public class JWTConfiguration {

Map authenticatedUsers = new ConcurrentHashMap<>();

@Value("${jwt.secret}")
String secret;

@Value("${jwt.expPeriodValue}")
long expPeriodValue;

@Value("${jwt.message}")
String message;

@ManagedAttribute
public long getExpPeriodValue() {
return expPeriodValue;
}


RefreshSkoup put above the class. But the server does not rise: it says that the beanfactory cannot initially create beans at launch.
What am I doing wrong?

P.s. Where does the client initially (before the refresh) take app.properties at startup, if they are only in the repository on github, but not in the application itself? Gets initially from an external file?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question