Spring sometimes error

 1 Role Authorization

request login when access /admin.

notice: save role in database : ROLE_XXX 


2 Run By spring-boot:run Could not find or load main class 

 


 

Because path or name-project of local project has white-space or Vietnamese


3) Sping-boot 2.4.2 Client request not found 404.

 

Client :

 Log server

How to Fix: 

 

Method 1 : Add @Requestmapping(ContextPath) on head of classes controller of Spring

 

Method 2: If you are using spring boot 2 (spring framework 5), there is a replacement of the property in your application.properties
server.servlet.context-path=/context-path

 


4 Run class bean trong class non bean 

 

Cách 1:  

Thêm service này dùng để getbean khi xài trong class non bean thay cho @Autowired 

cách dùng



Cách 2:  Đánh dấu class đang dùng class bean trở thành 1 class bean bằng cách thêm @Component hoặc @Sevice

 

 




0 comments :

Post a Comment

Cancel Reply

About Me

My photo
Tân An, Long An, Vietnam
Hello everyone, I love programming, I love making friends with people all over the world.