Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8571763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:51:12+00:00 2026-06-11T18:51:12+00:00

I have problem in Mule when I was using custom tcp protocol and inside

  • 0

I have problem in Mule when I was using custom tcp protocol and inside the custom protocol has a spring dependency injection using @Autowired annotation.

CustomProtocol.java

public class ContentLengthProtocol extends AbstractByteProtocol{
  @Autowired
  private Adapter adapter;

  @Lookup("atm-inbound")
  private ImmutableEndpoint inboundEndpoint;

  public ContentLengthProtocol(){
      super(true);
  }

  public Object read(InputStream is) throws IOException{
    // do some reading
  }
}

Mule Configuration snippet

<spring:beans>
    <spring:bean id="adapter" class="id.company.dao.Adapter"/>
    <spring:bean id="contentLengthProtocol" class="id.company.protocol.ContentLengthProtocol"/>
</spring:beans>
<tcp:connector name="TCPConnector" validateConnections="true" sendBufferSize="0" receiveBufferSize="1024" receiveBacklog="50" reuseAddress="true" keepAlive="true" clientSoTimeout="0" serverSoTimeout="0" socketSoLinger="0" doc:name="TCPConnector">
    <tcp:custom-protocol ref="contentLengthProtocol"/>
</tcp:connector>
<tcp:endpoint name="tcp-inbound" address="tcp://localhost:1234" connector-ref="TCPConnector" doc:name="TCP"/>
<flow name="AdapterFlow" doc:name="AdapterFlow">
    <tcp:inbound-endpoint ref="tcp-inbound" doc:name="Inbound TCP"/>
    <echo-component doc:name="Echo"/>
</flow>

When the flow reading input and processing read method on ContentLengthProtocol, the adapter always null. But the strange thing is, if i just define ContentLengthProtocol bean but doesn’t referenced the bean inside the TCP connector as custom protocol, spring injection works as usual and adapter is not null.

Can someone give me enlightment of what happened here ?
Any help is kindly appreciated.
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:51:13+00:00Added an answer on June 11, 2026 at 6:51 pm

    I found the exact problem which alter the @Autowired process. There are some details that I haven’t informed, The Adapter class is actually a service that holds a MyBatis mapper. The MyBatis mapper is configured using spring-mybatis integration, org.mybatis.spring.mapper.MapperScannerConfigurer to be specific. This class(bean) scan certain package to be proxied. Somehow If I combine this beans with a spring bean and mule, @Autowired doesn’t work, even using <property> to manually inject object into ContentLengthProtocol won’t work properly (The Adapter bean is injected, but not the MyBatis mapper class inside the Adapter bean). As a workaround, I managed to make it work using the old and tedious way, which is org.mybatis.spring.mapper.MapperFactoryBean bean. Basically this bean has to be declared for each mapper I have.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with my query on C, I’m using the oci8 driver. This
I have problem with parsing XML file using XLTS. <html xmlns=http://www.w3.org/1999/xhtml xml:lang=pl> <body style=margin-top:
I have problem with Uploadify: I log in the project using: FormsAuthentication.SetAuthCookie(myName, false); Then,
I have problem running my app on Android 2.3 (Gingerbread). The app has a
I have problem with resized editText (I made him smaller, actually), he has 40dip
I have problem with getting rows from my database using Hibernate. When I would
I have problem with display of table. My table initially has rows. But next
I have problem with http://abfoodpolicy.com/ . In IE 8 and 9 the right sidebar
I have problem with repopulating form_upload after validation. Other input fields or selectboxes are
I have problem with show or hide form in Window Form Application. I start

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.