The @value gets the configuration file Value returns NULL
In custom parameters parser implementation HandlerMethodArgumentResolver subclasses, access to @ the Value label Value is null.
Example:
In custom parameters parser implementation HandlerMethodArgumentResolver subclasses, access to @ the Value label Value is null.
Example:
@Configuration
public class ArgumentResolverConfig extends WebMvcConfigurerAdapter {
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)
{
argumentResolvers.add(new UserArgumentResolver());
}
}
Direct new UserArgumentResolver(), not managed by the Spring container, so use @value to get an invalid Value in the UserArgumentResolver
Revised:
@Configuration
public class ArgumentResolverConfig extends WebMvcConfigurerAdapter {
@Bean
public UserArgumentResolver getUserArgumentResolver(){
return new UserArgumentResolver();
}
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(getUserArgumentResolver());
}
}
The @bean annotation is given to the Spring container-managed Bean, at which point @Value gets the configuration file Value.
Read More:
- Opencv’s imread() function returns null when reading images
- How to Solve mybatis returns null when querying Oracle database with char type field
- After modifying the Tomcat configuration file in development, the modified configuration file will be automatically restored after ecplise starts Tomcat
- org.apache.ibatis.type.TypeException: Error setting non null for parameter #4 with JdbcType null
- Configuration error in mybatis configuration file
- SqlNullValueException: Data is Null. This method or property cannot be called on Null values.
- Git command line configuration and configuration file to solve clone error libressl_ connect: SSL_ ERROR_ SYSCALL in connection to github. com:443
- Error:null value in entry: incrementalFolder=null
- OpenGL configuration file, as well as unable to parse the file solution
- Specify the configuration file when the spring boot command starts
- VBA returns “n / a” and other error information
- Springboot error, unable to read configuration file: could not resolve placeholder ‘xxx’ in value “${XXX}
- Create an Apex class that returns contacts based on incoming parameters
- Python reads the configuration file. Ini and resolves the error
- Moveit configuration manipulator error: kin.parameters file
- Cannot read configuration file due to insufficient permissions
- Java regular matching returns all matches
- torch.cuda.is_ Available() returns false
- VTK beginner 1, configuration of pro file
- About error statuslogger no log4j2 configuration file found