"SpringBoot Actual Combat" reading notes

"SpringBoot Actual Combat" reading notes:

Recently I am studying the SpringBoot actual combat book. Due to the updated SpringBoot version, some of the code in the book is no longer available. This article lists the codes that need to be updated in the first three chapters.


Chapter two:

The html code on page 35, the id attribute is not added to the input, and the id attribute needs to be bound to the label tag

<form method="POST" >
    <label for="title">Title:</label>
    <input  id="title" type="text" name="title" size="50"/><br/>
    <label for="author">Author:</label>
    <input  id="author" type="text" name="author" size="50"/><br/>
    <label for="isbn">ISBN:</label>
    <input id="isbn" type="text" name="isbn" size="15"/><br/>
    <label id="description" for="description">Description:</label><br/>
    <textarea  name="description" cols="80" rows="5">
 </textarea><br/>
    <input type="submit"/>
</form>

third chapter:

On page 45, the findOne() method of JpaRepository in Java code is obsolete

 @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    
    
        auth.userDetailsService(new UserDetailsService() {
    
    
                    @Override
                    public UserDetails loadUserByUsername(String username)
                            throws UsernameNotFoundException {
    
    
                        return readerRepository.findById(username).get();
                    }
                });

On page 63, the picture should be placed under static/image

<html>
 <div class="errorPage">
 <span class="oops">Oops!</span><br/>
 <img th:src="@{/image/missingPage.png}"></img>
 <p>There seems to be a problem with the page you requested
 (<span th:text="${path}"></span>).</p>

Guess you like

Origin blog.csdn.net/weixin_40835745/article/details/109282829