This is a continuation of Last time. This time it is about that the methods that can be used have changed due to Spring Boot 2.
1.findOne The findOne method is used for the teaching material, but if you use this as it is, You will be prompted to make changes to the findById method. The return value is also Optional type.
Teaching materials (previous version)
public MeetingRoom findMeetingRoom(Integer roomId) {
return meetingRoomRepository.findOne(roomId);
}
SpringBoot2 changes
public Optional<MeetingRoom> findMeetingRoom(Integer roomId) {
return meetingRoomRepository.findById(roomId);
}
To get the value of Optional type, you need to add get ().
2.WebMvcConfigurerAdapter This is also deprecated. Use WebMvcConfigurer.
Teaching materials (previous version)
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter{
}
SpringBoot2 changes
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer{
}
Recommended Posts