File tree Expand file tree Collapse file tree 18 files changed +138
-41
lines changed
src/main/java/com/codingapi/example
src/main/java/com/codingapi/example/infra
springboot-starter-data-fast
springboot-starter-security
src/main/java/com/codingapi/springboot/framework/handler Expand file tree Collapse file tree 18 files changed +138
-41
lines changed Original file line number Diff line number Diff line change 55 <parent >
66 <artifactId >springboot-example</artifactId >
77 <groupId >com.codingapi.springboot</groupId >
8- <version >3.3.3 </version >
8+ <version >3.3.4 </version >
99 </parent >
1010 <modelVersion >4.0.0</modelVersion >
1111
Original file line number Diff line number Diff line change 1+ package com .codingapi .example .command ;
2+
3+ import com .codingapi .example .event .TestEvent ;
4+ import com .codingapi .example .infra .entity .TestEntity ;
5+ import com .codingapi .example .infra .jpa .TestEntityRepository ;
6+ import com .codingapi .springboot .framework .event .EventPusher ;
7+ import lombok .AllArgsConstructor ;
8+ import org .springframework .transaction .annotation .Transactional ;
9+ import org .springframework .web .bind .annotation .GetMapping ;
10+ import org .springframework .web .bind .annotation .RequestMapping ;
11+ import org .springframework .web .bind .annotation .RestController ;
12+
13+ @ RestController
14+ @ RequestMapping ("/open/test" )
15+ @ AllArgsConstructor
16+ public class TestController {
17+
18+ private final TestEntityRepository testEntityRepository ;
19+
20+
21+ @ GetMapping ("/hi" )
22+ @ Transactional
23+ public void hi (){
24+ TestEntity testEntity = new TestEntity ("test" );
25+ testEntityRepository .save (testEntity );
26+
27+ TestEvent event = new TestEvent (testEntity .getName ());
28+ EventPusher .push (event );
29+ }
30+ }
Original file line number Diff line number Diff line change 1+ package com .codingapi .example .event ;
2+
3+ import com .codingapi .springboot .framework .event .IAsyncEvent ;
4+ import lombok .AllArgsConstructor ;
5+ import lombok .Getter ;
6+
7+ @ Getter
8+ @ AllArgsConstructor
9+ public class TestEvent implements IAsyncEvent {
10+
11+ private String name ;
12+
13+ }
Original file line number Diff line number Diff line change 1+ package com .codingapi .example .handler ;
2+
3+ import com .codingapi .example .event .TestEvent ;
4+ import com .codingapi .example .infra .entity .TestEntity ;
5+ import com .codingapi .example .infra .jpa .TestEntityRepository ;
6+ import com .codingapi .springboot .framework .handler .IHandler ;
7+ import lombok .AllArgsConstructor ;
8+ import org .springframework .stereotype .Repository ;
9+
10+ @ Repository
11+ @ AllArgsConstructor
12+ public class TestHandler implements IHandler <TestEvent > {
13+
14+ private TestEntityRepository testEntityRepository ;
15+
16+ @ Override
17+ public void handler (TestEvent event ) {
18+ TestEntity entity = new TestEntity (event .getName ()+"123" );
19+ testEntityRepository .save (entity );
20+
21+ throw new IllegalArgumentException ("123" );
22+
23+ }
24+
25+
26+ }
Original file line number Diff line number Diff line change 55 <parent >
66 <artifactId >springboot-example</artifactId >
77 <groupId >com.codingapi.springboot</groupId >
8- <version >3.3.3 </version >
8+ <version >3.3.4 </version >
99 </parent >
1010 <modelVersion >4.0.0</modelVersion >
1111
Original file line number Diff line number Diff line change 55 <parent >
66 <artifactId >springboot-example</artifactId >
77 <groupId >com.codingapi.springboot</groupId >
8- <version >3.3.3 </version >
8+ <version >3.3.4 </version >
99 </parent >
1010 <modelVersion >4.0.0</modelVersion >
1111
Original file line number Diff line number Diff line change 55 <parent >
66 <artifactId >springboot-example</artifactId >
77 <groupId >com.codingapi.springboot</groupId >
8- <version >3.3.3 </version >
8+ <version >3.3.4 </version >
99 </parent >
1010 <modelVersion >4.0.0</modelVersion >
1111
Original file line number Diff line number Diff line change 1+ package com .codingapi .example .infra .entity ;
2+
3+ import jakarta .persistence .Entity ;
4+ import jakarta .persistence .GeneratedValue ;
5+ import jakarta .persistence .GenerationType ;
6+ import jakarta .persistence .Id ;
7+ import lombok .Getter ;
8+ import lombok .NoArgsConstructor ;
9+ import lombok .Setter ;
10+
11+ @ Setter
12+ @ Getter
13+ @ Entity
14+ @ NoArgsConstructor
15+ public class TestEntity {
16+
17+ @ Id
18+ @ GeneratedValue (strategy = GenerationType .IDENTITY )
19+ private long id ;
20+
21+ private String name ;
22+
23+ public TestEntity (String name ) {
24+ this .name = name ;
25+ }
26+ }
Original file line number Diff line number Diff line change 1+ package com .codingapi .example .infra .jpa ;
2+
3+ import com .codingapi .example .infra .entity .TestEntity ;
4+ import com .codingapi .springboot .fast .jpa .repository .FastRepository ;
5+
6+ public interface TestEntityRepository extends FastRepository <TestEntity ,Long > {
7+
8+ }
Original file line number Diff line number Diff line change 55 <parent >
66 <artifactId >springboot-example</artifactId >
77 <groupId >com.codingapi.springboot</groupId >
8- <version >3.3.3 </version >
8+ <version >3.3.4 </version >
99 </parent >
1010 <modelVersion >4.0.0</modelVersion >
1111
You can’t perform that action at this time.
0 commit comments